{"name":"printf","version":"0.5.3","description":"Full implementation of the `printf` family in pure JS.","keywords":["printf","formatting","sprintf","format","output","print"],"homepage":"https://github.com/adaltas/node-printf","license":"MIT","author":{"name":"David Worms","email":"david@adaltas.com","url":"https://www.adaltas.com"},"maintainers":[{"name":"david","email":"david@adaltas.com"}],"contributors":[{"name":"David Worms","email":"david@adaltas.com"},{"name":"Aluísio Augusto Silva Gonçalves","email":"aluisio@aasg.name"},{"name":"Xavier Mendez","email":"jmendeth@gmail.com"},{"name":"LLeo","email":"lleoem@gmail.com"},{"name":"Derrell Lipman","email":"https://github.com/derrell"}],"coffeelintConfig":{"indentation":{"level":"error","value":2},"line_endings":{"level":"error","value":"unix"},"max_line_length":{"level":"ignore"}},"main":"./lib/printf","types":"./lib/printf.d.ts","engines":{"node":">= 0.9.0"},"scripts":{"preversion":"grep '## Trunk' CHANGELOG.md && npm test","version":"version=`grep '^  \"version\": ' package.json | sed 's/.*\"\\([0-9\\.]*\\)\".*/\\1/'` && sed -i \"s/## Trunk/## Version $version/\" CHANGELOG.md && git add CHANGELOG.md","postversion":"git push origin master && git push origin master --tags && npm publish","patch":"npm version patch -m 'Bump to version %s'","minor":"npm version minor -m 'Bump to version %s'","major":"npm version major -m 'Bump to version %s'","test":"mocha test/**/*.coffee"},"devDependencies":{"coffeescript":"^2.2.4","should":"13.2.1","mocha":"5.1.0","semver":"5.5.0"},"repository":{"type":"git","url":"git+https://github.com/adaltas/node-printf.git"},"bugs":{"url":"https://github.com/adaltas/node-printf/issues"},"gitHead":"b8b59c576ad6600c85e61166d9e5aba7f1d5eb89","_id":"printf@0.5.3","_nodeVersion":"12.13.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-t3lYN6vPU5PZXDiEZZqoyXvN8wCsBfi8gPoxTKo2e5hhV673t/KUh+mfO8P8lCOCDC/BWcOGIxKyebxc5FuqLA==","shasum":"8b7eec278d886833312238b2bf42b2b6f250880a","tarball":"http://registry-npm.ywwl.com/printf/download/printf-0.5.3.tgz","fileCount":6,"unpackedSize":23256,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJecKcvCRA9TVsSAnZWagAAb2AQAJfWfN9wxDsMM/G4TU6d\nK2jNi2pepUgHMIHEPDFZ443IV3sOrEkkvDk1+npDmigR6A7BcCYDnpuHsyX1\n34wnRrcE/BBr6MPXRhrLs8ipMvHtHHGrtcmf65+DNr3h0hRbX5Q3IgfnxRT1\nZExDaRAQ8Re9ATIAvhMI3eXbfvnJqTsyl2p9P5ITL+1V2m7WsifyL7a62w50\n7LnxdB4TxMi0AYtMgqBA+j8rzatV2BsabuFYrC36pVKmiG7Cn/cfuUNZ8qP8\nvpTWArAr/QyHofd0wDE7R0Z7+bNF5vEeIJYWlWFLeCtln8fjT7Pt036EOBCy\nWYZoNzHOVTyRGkQyZgwjctlxDgV9dkzkkQFfQ2Ul05PfPlEDY7ITAUhcmGqH\n3J4aK8F8Tj4WTCOhzQdqCTlyT2l/9fKYwboihcxVLDYOcy/fekIDP0ZKQ23K\nU2ZKx4IfpwG6wWY9ofeAHh8NW8M9EodCtMiAK9gtHcIDUicu1RzvLgLLNSbS\nkRitRyjF2H1hlOuxdUhCc1XeWTBS0ew0sYxg5t/wxMCPOTErD9e+w+PhscSA\n5ZuMwKJzYuCZw0Ho9Ngc4b0C6d9rJpeKm/7K5jCou+wP5XmopFYw329E2eby\ngapu9omRwEj0wvV7k8qzuqIOpLHiReLdiUdOCntRQpz3FHvh0acj2rhweUz2\nZ6Os\r\n=f49d\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDtQAFa7U1eLYHVai2HiFu3cdnj/VfumZFWs+RPThTtAAIhAJqoAM2hWkgIGHdGL5hb56ktuyWgTiQ2lL+CLr7SBMkU"}],"size":7911,"noattachment":false,"key":"/printf/-/printf-0.5.3.tgz"},"_npmUser":{"name":"david","email":"david@adaltas.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/printf_0.5.3_1584441135353_0.6504042734644626"},"_hasShrinkwrap":false,"readme":"[![Build Status](https://secure.travis-ci.org/adaltas/node-printf.svg)](http://travis-ci.org/adaltas/node-printf)\n\nA complete implementation of the **`printf` C functions family**\nfor [Node.JS][node], written in pure JavaScript.\n\n**Bonus!** You get extra features, like the `%O` converter (which `inspect`s\nthe argument). See [Extra Features](#extra-features) below.\n\n## Installing\n\nVia [NPM][npm]:\n\n``` bash\n$ npm install printf\n```\n\n## Usage\n\nUse it like you would in C (`printf`/`sprintf`):\n\n``` javascript\nvar printf = require('printf');\nvar result = printf(format, args...);\n```\n\nIt can also output the result for you, as `fprintf`:\n\n``` javascript\nvar printf = require('printf');\nprintf(write_stream, format, args...);\n```\n\n## Features\n\n### Flag ` ` (space)\n\n``` javascript\nassert.eql('  -42', printf('% 5d', -42));\n```\n\n### Flag `+` (plus)\n\n``` javascript\nassert.eql('  +42', printf('%+5d', 42));\n```\n\n### Flag `0` (zero)\n\n``` javascript\nassert.eql('00042', printf('%05d', 42));\n```\n\n### Flag `-` (minus)\n\n``` javascript\nassert.eql('42   ', printf('%-5d', 42));\n```\n\n### Width / precision\n\n``` javascript\nassert.eql('42.90', printf('%.2f', 42.8952));\nassert.eql('042.90', printf('%06.2f', 42.8952));\n```\n\n### Numerical bases\n\n``` javascript\nassert.eql('\\x7f', printf('%c', 0x7f));\nassert.eql('a', printf('%c', 'a'));\nassert.eql('\"', printf('%c', 34));\n```\n\n### Miscellaneous\n\n``` javascript\nassert.eql('10%', printf('%d%%', 10));\nassert.eql('+hello+', printf('+%s+', 'hello'));\nassert.eql(\"a\", printf(\"%c\", \"a\"));\nassert.eql('\"', printf(\"%c\", 34));\nassert.eql('$', printf('%c', 36));\nassert.eql(\"10\", printf(\"%d\", 10));\n```\n\n## Extra features!\n\n### Inspector\n\nThe `%O` converter will call [`util.inspect(...)`][util_inspect] at the argument:\n\n``` javascript\nassert.eql(\"Debug: { hello: 'Node', repeat: false }\",\n  printf('Debug: %O', {hello: 'Node', \"repeat\": false})\n);\nassert.eql(\"Test: { hello: 'Node' }\",\n  printf('%2$s: %1$O', {\"hello\": 'Node'}, 'Test')\n);\n```\n\n**Important:** it's a capital \"O\", *not* a zero!\n\nSpecifying a precision lets you control the depth up to which the object is formatted:\n\n``` javascript\nassert.eql(\"Debug: { depth0: { depth1_: 0, depth1: [Object] } }\",\n  printf('Debug: %.1O', {depth0: {depth1: {depth2: {depth3: true}}, depth1_: 0}})\n);\n```\n\nYou can use the alternative form flag together with `%O` to disable representation of non-enumerable properties (useful for arrays):\n\n``` javascript\nassert.eql(\"With non-enumerable properties: [ 1, 2, 3, 4, 5, [length]: 5 ]\",\n  printf('With non-enumerable properties: %O', [1, 2, 3, 4, 5])\n);\nassert.eql(\"Without non-enumerable properties: [ 1, 2, 3, 4, 5 ]\",\n  printf('Without non-enumerable properties: %#O', [1, 2, 3, 4, 5])\n);\n```\n\nYou can use the sign flag together with `%O` to enable colors in `util.inspect`:\n\n``` javascript\nassert.eql(\"With colors: { bar: \\u001b[33mtrue\\u001b[39m, baz: \\u001b[33mfalse\\u001b[39m }\",\n  printf('With colors: %+O', {bar: true, baz: false})\n);\n```\n\n### Argument mapping\n\nIn addition to the old-fashioned `n$`,\nyou can use **hashes** and **property names**!\n\n``` javascript\nassert.eql('Hot Pockets',\n  printf('%(temperature)s %(crevace)ss', {\n    temperature: 'Hot',\n    crevace: 'Pocket'\n  })\n);\nassert.eql('Hot Pockets',\n  printf('%2$s %1$ss', 'Pocket', 'Hot')\n);\n```\n\n### Positionals\n\nLength and precision can now be variable:\n\n``` javascript\nassert.eql(' foo', printf('%*s', 'foo', 4));\nassert.eql('      3.14', printf('%*.*f', 3.14159265, 10, 2));\nassert.eql('000003.142', printf('%0*.*f', 3.14159265, 10, 3));\nassert.eql('3.1416    ', printf('%-*.*f', 3.14159265, 10, 4));\n```\n\n## Development\n\nTests are written in [CoffeeScript][coffee] and are executed with [Mocha][mocha]. To use it, simple run `npm install`, it will install Mocha and its dependencies in your project's `node_modules` directory followed by `npm test`.\n\nTo run the tests:\n\n```bash\nnpm install\nnpm test\n```\n\nThe test suite is run online with [Travis][travis] against the versions 6, 7, 8 and 9 of Node.js.\n\n## Contributors\n\n*   David Worms <https://github.com/wdavidw>\n*   Aluísio Augusto Silva Gonçalves <https://github.com/AluisioASG>\n*   Xavier Mendez <https://github.com/jmendeth>\n*   LLeo <https://github.com/lleo>\n*   Derrell Lipman <https://github.com/derrell>\n\nThis package is developed by [Adaltas](http://www.adaltas.com).\n\n[node]: http://nodejs.org \"The Node.JS platform\"\n[npm]:  https://github.com/isaacs/npm \"The Node Package Manager\"\n[util_inspect]: http://nodejs.org/api/util.html#util_util_inspect_object_showhidden_depth_colors \"util.inspect() documentation\"\n[travis]: https://travis-ci.org \"Continuous Integration system\"\n[mocha]: http://mochajs.org/ \"The Mocha test framework\"\n[coffee]: http://coffeescript.org/\n","publish_time":1584441135522,"_cnpm_publish_time":1584441135522,"dist-tags":{"latest":"0.6.1"}}