{"name":"printf","version":"0.6.0","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":"95b0d3c0173a9c53a9332ab4ac7a3e510e3625e2","_id":"printf@0.6.0","_nodeVersion":"13.12.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-Fddn0Zb7jO5BZDiIZgjHN6eGBVj/0tIWJm4u5ZTV/WtIA7czrEwEYnqzm6QfirB+sWVRpHC/9ADE1LRbiq2AHg==","shasum":"a04797a8844ec8d37e41288ddf367288f7dbfff0","tarball":"http://registry-npm.ywwl.com/printf/download/printf-0.6.0.tgz","fileCount":6,"unpackedSize":23337,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfWdjnCRA9TVsSAnZWagAAfy0P/Ak1YjBKaqi/0Q7qQOgT\nezZy1jpS7DIMdzx1jEjBvy0UtdZw/DxpJfB7aqE+mDvSpP5cgnrFemaosmYb\njphRmPLS8bmM+p3aNtvesarP059f2d57eWzPRUSER86feDdO7/HnZrYrsnps\nEL9o2v3fmN7xsN/tEO3K3Vk8w0xsR9KH4cU3Z683fSWOuYkD/P/CTr3HiBao\nEy382DIIg0EmxViOYLYasHSEHD6b5xPyR5YLAB4yDEEyKASzc7z7zSniC3rJ\n6q2f7QtDcABZXVdACcV6pkFZ4K+1kaO+fDeRSqukqlzCNyH5rOBQRG7ZIV73\nu5qgdwwaOlAZ2BWiwA0zfu52I4zUQjUwF2EneMoKXzu7BGUsW7DGvQZFK5rz\neaGGJrR9BAPnIOqzjFnMVlohuXBtX3XiWfofB/FlQt/KEvR2n8XinIRImB4I\n76a42o5zAV8JaNcOYJuv3TuvqPeGaZGNHviRdcKqJ2vYg1iThsOp4PLjofPe\nf3Duk9PTVB0GWZfzfdY0HJ03CEYpCNKT4bkOtTGXtmcRKwGwc4fFineu86fD\ngT2L0nGwcUN+OR+892+Q4CnxVvmcnv0R9l0lr20rVTD63cN/1ZFK2AJFESzw\nCudFP5nmo3V6uFGQXUXWbcirSXG6hxm1leH234HNwijLCoJT3J4HKGEt/6F1\ntjj+\r\n=0OyE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHt8MIp5AIqv/8tG5Jbpj4hw2wjsDBLQEcavnl2LmRd6AiB9mMm4KAsx0XT3c+JarMbixp2rzohIFL9u3li7rwU0Ag=="}],"size":7942,"noattachment":false,"key":"/printf/-/printf-0.6.0.tgz"},"_npmUser":{"name":"david","email":"david@adaltas.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/printf_0.6.0_1599723751044_0.04174852929478212"},"_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":1599723751170,"_cnpm_publish_time":1599723751170,"dist-tags":{"latest":"0.6.1"}}