{"_id":"sprintf-kit","_rev":"1751461","name":"sprintf-kit","description":"sprintf parser and basic formatter","dist-tags":{"latest":"2.0.1"},"maintainers":[{"name":"medikoo","email":""}],"time":{"modified":"2021-11-29T01:34:52.000Z","created":"2018-04-09T14:31:58.695Z","2.0.1":"2021-06-24T12:49:29.561Z","2.0.0":"2018-10-02T12:57:43.743Z","1.5.0":"2018-09-28T15:20:55.583Z","1.4.0":"2018-08-03T19:34:00.100Z","1.3.0":"2018-06-05T08:27:13.216Z","1.2.1":"2018-06-01T15:53:53.427Z","1.2.0":"2018-06-01T08:21:58.971Z","1.1.0":"2018-05-30T07:17:29.592Z","1.0.0":"2018-04-09T14:31:58.695Z"},"users":{},"author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"versions":{"2.0.1":{"name":"sprintf-kit","version":"2.0.1","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.53"},"devDependencies":{"browserstack-tape-runner":"^3.0.0","eslint":"^7.29.0","eslint-config-medikoo":"^4.0.0","essentials":"^1.1.1","git-list-updated":"^1.2.1","husky":"^4.3.8","lint-staged":"^11.0.0","nyc":"^15.1.0","prettier-elastic":"^2.2.1","tape":"^5.2.2","tape-index":"^3.1.0"},"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"*.js":["eslint"],"*.{css,html,js,json,md,yaml,yml}":["prettier -c"]},"eslintConfig":{"extends":"medikoo/es5","root":true},"scripts":{"coverage":"nyc --reporter=lcov --reporter=html --reporter=text-summary npm test","check-coverage":"npm run coverage && nyc check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","lint-updated":"pipe-git-updated --ext=js -- eslint --ignore-pattern '!*'","prettier-check-updated":"pipe-git-updated --ext=css --ext=html --ext=js --ext=json --ext=md --ext=yaml --ext=yml -- prettier -c","prettify":"prettier --write --ignore-path .gitignore '**/*.{css,html,js,json,md,yaml,yml}'","test":"npm run test-prepare && npm run test-run","test-browsers":"tape-index && browserstack-tape-runner test.index.js","test-prepare":"tape-index","test-run":"node test.index.js"},"browserstack":{"browsers":["chrome_current","firefox_current","safari_current","opera_current","ie_11","edge_current"]},"license":"ISC","gitHead":"a6a126af4e3b53ba87918e824ee78f08854bbf8a","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@2.0.1","_nodeVersion":"14.17.1","_npmVersion":"6.14.13","dist":{"shasum":"bb837e8fa4b28f094531d8e33669120027236bb8","size":7292,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-2.0.1.tgz"},"_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"directories":{},"maintainers":[{"name":"medikoo","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_2.0.1_1624538969414_0.13171740329824977"},"_hasShrinkwrap":false,"publish_time":1624538969561,"_cnpm_publish_time":1624538969561},"2.0.0":{"name":"sprintf-kit","version":"2.0.0","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.46"},"devDependencies":{"browserstack-tape-runner":"2","eslint":"^5.6","eslint-config-medikoo-es5":"^1.7.1","istanbul":"^0.4.5","tape":"^4.9.1","tape-index":"2"},"eslintConfig":{"extends":"medikoo-es5","root":true},"scripts":{"coverage":"tape-index && istanbul cover test.index.js","check-coverage":"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","test":"tape-index && node test.index.js","test-browsers":"tape-index && browserstack-tape-runner test.index.js"},"browserstack":{"browsers":["chrome_current","firefox_current","safari_current","opera_current","ie_11","edge_current"]},"license":"ISC","gitHead":"e202598db501016b4888f598d17507daf3910a84","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"47499d636e9cc68f2f921d30eb4f0b911a2d7835","size":9238,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-2.0.0.tgz"},"maintainers":[{"name":"medikoo","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_2.0.0_1538485063619_0.059647575437069555"},"_hasShrinkwrap":false,"publish_time":1538485063743,"_cnpm_publish_time":1538485063743},"1.5.0":{"name":"sprintf-kit","version":"1.5.0","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.46"},"devDependencies":{"browserstack-tape-runner":"2","eslint":"^5.6","eslint-config-medikoo-es5":"^1.7.1","istanbul":"^0.4.5","tape":"^4.9.1","tape-index":"2"},"eslintConfig":{"extends":"medikoo-es5","root":true},"scripts":{"coverage":"tape-index && istanbul cover test.index.js","check-coverage":"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","test":"tape-index && node test.index.js","test-browsers":"tape-index && browserstack-tape-runner test.index.js"},"browserstack":{"browsers":["chrome_current","firefox_current","safari_current","opera_current","ie_11","edge_current"]},"license":"ISC","gitHead":"a3425a03b4ddb4c52652a17a8e1535498bd21d9c","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@1.5.0","_npmVersion":"6.4.1","_nodeVersion":"10.11.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"a3d0513ae0858a0eeae195d13a13036655f39d16","size":8450,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-1.5.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-1.5.0.tgz"},"maintainers":[{"name":"medikoo","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_1.5.0_1538148055411_0.6032603084653525"},"_hasShrinkwrap":false,"publish_time":1538148055583,"_cnpm_publish_time":1538148055583},"1.4.0":{"name":"sprintf-kit","version":"1.4.0","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.45"},"devDependencies":{"browserstack-tape-runner":"2","eslint":"^5.2","eslint-config-medikoo-es5":"^1.5","istanbul":"^0.4.5","tape":"^4.9.1","tape-index":"2"},"eslintConfig":{"extends":"medikoo-es5","root":true},"scripts":{"coverage":"tape-index && istanbul cover test.index.js","check-coverage":"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","test":"tape-index && node test.index.js","test-browsers":"tape-index && browserstack-tape-runner test.index.js"},"browserstack":{"browsers":["chrome_current","firefox_current","safari_current","opera_current","ie_11","edge_current"]},"license":"ISC","gitHead":"ba5f8277a917475e3bc14db0e4d7cf0a89257764","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@1.4.0","_npmVersion":"6.2.0","_nodeVersion":"10.8.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"ac302a2b390a181d511fa1103a6562207e249b24","size":7948,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-1.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-1.4.0.tgz"},"maintainers":[{"name":"medikoo","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_1.4.0_1533324839970_0.28076278602106486"},"_hasShrinkwrap":false,"publish_time":1533324840100,"_cnpm_publish_time":1533324840100},"1.3.0":{"name":"sprintf-kit","version":"1.3.0","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.44"},"devDependencies":{"browserstack-tape-runner":"2","eslint":"^4.19.1","eslint-config-medikoo-es5":"^1.4.11","istanbul":"^0.4.5","tape":"^4.9","tape-index":"2"},"eslintConfig":{"extends":"medikoo-es5","root":true},"scripts":{"coverage":"tape-index && istanbul cover test.index.js","check-coverage":"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","test":"tape-index && node test.index.js","test-browsers":"tape-index && browserstack-tape-runner test.index.js"},"browserstack":{"browsers":["chrome_current","firefox_current","safari_current","opera_current","ie_11","edge_current"]},"license":"ISC","gitHead":"37a185cef1af5fea4e776b0dfcda5e519f26b3f5","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@1.3.0","_npmVersion":"6.1.0","_nodeVersion":"10.3.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"10a82348d405eb00c878c35e44cc2aebff258f92","size":7523,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-1.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-1.3.0.tgz"},"maintainers":[{"name":"medikoo","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_1.3.0_1528187233105_0.9102008514596756"},"_hasShrinkwrap":false,"publish_time":1528187233216,"_cnpm_publish_time":1528187233216},"1.2.1":{"name":"sprintf-kit","version":"1.2.1","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.44"},"devDependencies":{"browserstack-tape-runner":"2","eslint":"^4.19.1","eslint-config-medikoo-es5":"^1.4.11","istanbul":"^0.4.5","tape":"^4.9","tape-index":"2"},"eslintConfig":{"extends":"medikoo-es5","root":true},"scripts":{"coverage":"tape-index && istanbul cover test.index.js","check-coverage":"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","test":"tape-index && node test.index.js","test-browsers":"tape-index && browserstack-tape-runner test.index.js"},"browserstack":{"browsers":["chrome_current","firefox_current","safari_current","opera_current","ie_11","edge_current"]},"license":"ISC","gitHead":"44c35d8c1a7d4bd9f2f8fc59e46d888615ba05ad","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@1.2.1","_npmVersion":"6.1.0","_nodeVersion":"10.3.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"9b37b46529ca22161ac147e0ff2ba86fae60b481","size":7383,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-1.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-1.2.1.tgz"},"maintainers":[{"name":"medikoo","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_1.2.1_1527868433360_0.1493099140593801"},"_hasShrinkwrap":false,"publish_time":1527868433427,"_cnpm_publish_time":1527868433427},"1.2.0":{"name":"sprintf-kit","version":"1.2.0","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.44"},"devDependencies":{"browserstack-tape-runner":"2","eslint":"^4.19.1","eslint-config-medikoo-es5":"^1.4.11","istanbul":"^0.4.5","tape":"^4.9","tape-index":"2"},"eslintConfig":{"extends":"medikoo-es5","root":true},"scripts":{"coverage":"tape-index && istanbul cover test.index.js","check-coverage":"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","test":"tape-index && node test.index.js","test-browsers":"tape-index && browserstack-tape-runner test.index.js"},"browserstack":{"browsers":["chrome_current","firefox_current","safari_current","opera_current","ie_11","edge_current"]},"license":"ISC","gitHead":"6a18fe00f6f3bb86899e9e8bb59bc299d70eb597","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@1.2.0","_npmVersion":"6.1.0","_nodeVersion":"10.3.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"690a889bfec545e1ea8a1afc17a42b574634f3bc","size":7345,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-1.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-1.2.0.tgz"},"maintainers":[{"name":"medikoo","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_1.2.0_1527841318773_0.8310418856353516"},"_hasShrinkwrap":false,"publish_time":1527841318971,"_cnpm_publish_time":1527841318971},"1.1.0":{"name":"sprintf-kit","version":"1.1.0","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.44"},"devDependencies":{"browserstack-tape-runner":"2","eslint":"^4.19.1","eslint-config-medikoo-es5":"^1.4.11","istanbul":"^0.4.5","tape":"^4.9","tape-index":"2"},"eslintConfig":{"extends":"medikoo-es5","root":true},"scripts":{"coverage":"tape-index && istanbul cover test.index.js","check-coverage":"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","test":"tape-index && node test.index.js","test-browsers":"tape-index && browserstack-tape-runner test.index.js"},"browserstack":{"browsers":["chrome_current","firefox_current","safari_current","opera_current","ie_11","edge_current"]},"license":"ISC","gitHead":"d09cf1bba6cfdea3da26013f39513e394835d3a3","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"10.2.1","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"6354f85f509bdd98451becd5584bc01563d288ae","size":7305,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-1.1.0.tgz"},"maintainers":[{"name":"medikoo","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_1.1.0_1527664648569_0.2252479712128448"},"_hasShrinkwrap":false,"publish_time":1527664649592,"_cnpm_publish_time":1527664649592},"1.0.0":{"name":"sprintf-kit","version":"1.0.0","description":"sprintf parser and basic formatter","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["printf","sprintf","log","format","string"],"repository":{"type":"git","url":"git://github.com/medikoo/sprintf-kit.git"},"dependencies":{"es5-ext":"^0.10.42"},"devDependencies":{"browserstack-tape-runner":"2","eslint":"^4.19.1","eslint-config-medikoo-es5":"^1.4.9","istanbul":"^0.4.5","tape":"^4.9","tape-index":"2"},"eslintConfig":{"extends":"medikoo-es5","root":true},"scripts":{"coverage":"tape-index && istanbul cover test.index.js","check-coverage":"npm run coverage && istanbul check-coverage --statements 100 --function 100 --branches 100 --lines 100","lint":"eslint --ignore-path=.gitignore .","test":"tape-index && node test.index.js","test-browsers":"tape-index && browserstack-tape-runner test.index.js"},"browserstack":{"browsers":["chrome_latest","firefox_latest","safari_latest","opera_latest","ie_11","edge_latest"]},"license":"ISC","gitHead":"dc05b7ed5db6822b72c8b68d65e6a8aa002468b9","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"homepage":"https://github.com/medikoo/sprintf-kit#readme","_id":"sprintf-kit@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"9.11.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"shasum":"76b586b8d83b78c4ea7fe1a2222e180c36262865","size":7052,"noattachment":false,"key":"/sprintf-kit/-/sprintf-kit-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/sprintf-kit/download/sprintf-kit-1.0.0.tgz"},"maintainers":[{"name":"medikoo","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-kit_1.0.0_1523284318592_0.4285174572394801"},"_hasShrinkwrap":false,"publish_time":1523284318695,"_cnpm_publish_time":1523284318695}},"readme":"[![*nix build status][nix-build-image]][nix-build-url]\n[![Windows build status][win-build-image]][win-build-url]\n[![Tests coverage][cov-image]][cov-url]\n![Transpilation status][transpilation-image]\n[![npm version][npm-image]][npm-url]\n\n# sprintf-kit\n\n## sprintf parser and basic formatter\n\n-   Full [printf format parser](#parser)\n-   Basic (ECMAScript level) modifier [resolvers](#preconfigured-modifiers)\n-   Format function [generator](#format-function-generator).\n\n### Installation\n\n```bash\nnpm install sprintf-kit\n```\n\n### Utilities\n\n#### Parser\n\nParses format string into data map with respect to [printf syntax](https://en.wikipedia.org/wiki/Printf_format_string)\n\n```javascript\nconst parse = require(\"sprintf-kit/parse\");\n\nconst data = parse(\"Some %s with %d count\");\n\n// `data` resolves with following content:\n{\n  literals: [\"Some \", \" with \", \" count\"],\n  placeholders: [\n    { type: \"s\", content: \"%s\" },\n    { type: \"d\", content: \"%d\" }\n  ],\n  isParameterIndexingValid: true\n}\n```\n\n`data` spec:\n\n-   `literals` - Surrounding string literals\n-   `placeholders` - Meta data of parsed placholders.\n    Placeholder properties map (refer to [spec](https://en.wikipedia.org/wiki/Printf_format_string) for explanation of each property)\n    -   `parameter` - (optional) parameter setting (e.g. `1`)\n    -   `flags` - (optional) array of flags (e.g. `[\"0\", \"-\"]`)\n    -   `width` - (optional) width (e.g. `4` or `\"*\"` if dynamic)\n    -   `precision` - (optional) precision (e.g. `4` or `\"*\"` if dynamic)\n    -   `length` - (optional) length (e.g. `\"z\"`)\n    -   `type` - Modifier type (e.g. `\"s\"` or `\"d\"`)\n    -   `content` - Full string representation of placeholder (e.g. `\"%s\"`)\n-   `isParameterIndexingValid` - Whether parameter indexing is valid across all placeholders.\n    e.g. if no placeholders come with parameters it'll be true. If some but not all of them will come with parameters, it'll be false (if used, then all placeholders should use them).\n\n#### Format function generator\n\n```javascript\n// Configure format function that resolves 's' and 'd' modifiers\nlet format = require(\"sprintf-kit\")({\n    d: require(\"sprintf-kit/modifiers/d\"),\n    s: require(\"sprintf-kit/modifiers/s\")\n});\n\nformat(\"Some %s with %d count %x boo\", \"foo\", 12, \"ignored\"); // Some foo with 12 count %x boo\n\n// Special `rest` formater can be used to handle leftover arguments\n\nformat = require(\"sprintf-kit\")({\n    d: require(\"sprintf-kit/modifiers/d\"),\n    s: require(\"sprintf-kit/modifiers/s\"),\n    rest: args => \" \" + args.join(\" \")\n});\n\nformat(\"Some %s with %d count\", \"foo\", 12, \"rest\", \"args\"); // Some foo with 12 count rest args\n\n// Message string literals (all but placeholders text) can be additionally decorated\n// Useful when we want to apply some specific color to message without affecting format of special arguments\n\nconst clc = require(\"cli-color\");\n\nformat = require(\"sprintf-kit\")({\n    d: require(\"sprintf-kit/modifiers/d\"),\n    s: require(\"sprintf-kit/modifiers/s\"),\n    literal: literal => clc.red(literal)\n});\n```\n\n#### Parts resolver generator\n\nResolver returns resolved data in form of object parts, which maybe helpful if additional programmatical processing is needed\n\n```javascript\n// Configure format function that resolves 's' and 'd' modifiers\nlet resolve = require(\"sprintf-kit/get-resolver\")({\n    d: require(\"sprintf-kit/modifiers/d\"),\n    s: require(\"sprintf-kit/modifiers/s\")\n});\n\nresolve(\"Some %s with %d count %x boo\", \"foo\", 12, \"ignored\");\n// {\n//   literals: [\"Some \", \" with \", \" count \", \" boo\"],\n//   substitutions: [\n//     { value: \"foo\", placeholder: { type: \"s\", content: \"%s\" } },\n//     { value: \"12\", placeholder:  { type: \"d\", content: \"%d\" } },\n//     { value: \"%x\", placeholder: { type: \"x\", content: \"%x\" }\n//   ],\n//   rest: null\n// }\n\nresolve = require(\"sprintf-kit/get-resolver\")({\n    d: require(\"sprintf-kit/modifiers/d\"),\n    s: require(\"sprintf-kit/modifiers/s\"),\n    rest: args => \" \" + args.join(\" \")\n});\n\nresolve(\"Some %s with %d count\", \"foo\", 12, \"rest\", \"args\");\n// {\n//   literals: [\"Some \", \" with \", \" count\"],\n//   substitutions: [\n//     { value: \"foo\", placeholder: { type: \"s\", content: \"%s\" } },\n//     { value: \"12\", placeholder:  { type: \"d\", content: \"%d\" } }\n//   ],\n//   rest: \" rest args\"\n// }\n```\n\n#### Preconfigured modifiers\n\nCurrently just basic modifiers are configured in (PR's welcome to extend this support).\n\nModifiers can be found at `sprintf-kit/modifiers` folder.\n\nPreconfigured modifiers\n\n-   `d` - Number\n-   `f` - Floating point value\n-   `i` - Integer\n-   `j` - JSON\n-   `s` - String\n\nEvery modifier is exception safe, in case of approaching invalid value, adequate error message token is displayed in place of placeholder\n\n### Tests\n\n```bash\nnpm test\n```\n\nProject cross-browser compatibility supported by:\n\n<a href=\"https://browserstack.com\"><img src=\"https://bstacksupport.zendesk.com/attachments/token/Pj5uf2x5GU9BvWErqAr51Jh2R/?name=browserstack-logo-600x315.png\" height=\"150\" /></a>\n\n[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/sprintf-kit/branches/master/shields_badge.svg\n[nix-build-url]: https://semaphoreci.com/medikoo-org/sprintf-kit\n[win-build-image]: https://ci.appveyor.com/api/projects/status/o3dnowm0ftn21u61?svg=true\n[win-build-url]: https://ci.appveyor.com/api/projects/status/o3dnowm0ftn21u61\n[cov-image]: https://img.shields.io/codecov/c/github/medikoo/sprintf-kit.svg\n[cov-url]: https://codecov.io/gh/medikoo/sprintf-kit\n[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg\n[npm-image]: https://img.shields.io/npm/v/sprintf-kit.svg\n[npm-url]: https://www.npmjs.com/package/sprintf-kit\n","_attachments":{},"homepage":"https://github.com/medikoo/sprintf-kit#readme","bugs":{"url":"https://github.com/medikoo/sprintf-kit/issues"},"license":"ISC"}