mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
ce7dc2be92
Adds support for running npm package lifecycle scripts, opted into via a new `--allow-scripts` flag. With this PR, when running `deno cache` (or `DENO_FUTURE=1 deno install`) you can specify the `--allow-scripts=pkg1,pkg2` flag to run lifecycle scripts attached to the given packages. Note at the moment this only works when `nodeModulesDir` is true (using the local resolver). When a package with un-run lifecycle scripts is encountered, we emit a warning suggesting things may not work and to try running lifecycle scripts. Additionally, if a package script implicitly requires `node-gyp` and it's not found on the system, we emit a warning. Extra things in this PR: - Extracted out bits of `task.rs` into a separate module for reuse - Added a couple fields to `process.config` in order to support `node-gyp` (it relies on a few variables being there) - Drive by fix to downloading new npm packages to test registry --- TODO: - [x] validation for allow-scripts args (make sure it looks like an npm package) - [x] make allow-scripts matching smarter - [ ] figure out what issues this closes --- Review notes: - This adds a bunch of deps to our test registry due to using `node-gyp`, so it's pretty noisy
1 line
No EOL
20 KiB
JSON
1 line
No EOL
20 KiB
JSON
{"_id":"sprintf-js","_rev":"85-97c6aee62cb30de147488515fd2dd883","name":"sprintf-js","description":"JavaScript sprintf implementation","dist-tags":{"latest":"1.1.3"},"versions":{"0.0.7":{"name":"sprintf-js","version":"0.0.7","description":"JavaScript sprintf implementation","main":"src/sprintf.js","directories":{"test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"https://github.com/alexei/sprintf.js.git"},"author":{"name":"Alexandru Marasteanu","email":"hello@alexei.ro","url":"http://alexei.ro/"},"license":"BSD","_id":"sprintf-js@0.0.7","dist":{"shasum":"f00d78fd160130809b4ab340c0310faa71253dbd","tarball":"http://localhost:4260/sprintf-js/sprintf-js-0.0.7.tgz","integrity":"sha512-KJ+dRU+F2fCeQ5g5YDnybY5G7pkLryQMzPdufddLi5GtdFt/PkbcwrE2BiSczxmpUvsjUCFB4CeWbNfK/w6W9w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGR6itT7M1VXP5CksSKYv/cRA6HX1ijbV8qc+DeBkwsFAiEA4AdiLGzXa7bHa+Z5UVYviLaMDR30WCxdtEpxvNBND2Y="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}]},"1.0.1":{"name":"sprintf-js","version":"1.0.1","description":"JavaScript sprintf implementation","author":{"name":"Alexandru Marasteanu","email":"hello@alexei.ro","url":"http://alexei.ro/"},"main":"src/sprintf.js","scripts":{"test":"mocha test/test.js"},"repository":{"type":"git","url":"https://github.com/alexei/sprintf.js.git"},"license":"BSD-3-Clause","devDependencies":{"mocha":"*","grunt":"*","grunt-contrib-watch":"*","grunt-contrib-uglify":"*"},"gitHead":"6d742809698ee0caff18c71251cba3ed8b03de5d","bugs":{"url":"https://github.com/alexei/sprintf.js/issues"},"homepage":"https://github.com/alexei/sprintf.js","_id":"sprintf-js@1.0.1","_shasum":"57ed6d7fe6240c1b2e7638431b57704f86a7f0ef","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"dist":{"shasum":"57ed6d7fe6240c1b2e7638431b57704f86a7f0ef","tarball":"http://localhost:4260/sprintf-js/sprintf-js-1.0.1.tgz","integrity":"sha512-MjYdFr100X0Ax2XU9L0iPqpR7SLuedw5fJx/JdeW7XEdGAboHddbrQfJ7IKfqw+T8AMxuNNKDv4rKVO6kRPGjA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB1XBkmVWfLFwt6X7m0zkYgTHAIJEiP5FxxROIF2b/hmAiBNg9jkeUjfUdCg47EOZCcAtlAYOP3OCNeBdFr9j35vXA=="}]},"directories":{}},"1.0.2":{"name":"sprintf-js","version":"1.0.2","description":"JavaScript sprintf implementation","author":{"name":"Alexandru Marasteanu","email":"hello@alexei.ro","url":"http://alexei.ro/"},"main":"src/sprintf.js","scripts":{"test":"mocha test/test.js"},"repository":{"type":"git","url":"https://github.com/alexei/sprintf.js.git"},"license":"BSD-3-Clause","devDependencies":{"mocha":"*","grunt":"*","grunt-contrib-watch":"*","grunt-contrib-uglify":"*"},"gitHead":"e8c73065cd1a79a32c697806a4e85f1fe7917592","bugs":{"url":"https://github.com/alexei/sprintf.js/issues"},"homepage":"https://github.com/alexei/sprintf.js","_id":"sprintf-js@1.0.2","_shasum":"11e4d84ff32144e35b0bf3a66f8587f38d8f9978","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"dist":{"shasum":"11e4d84ff32144e35b0bf3a66f8587f38d8f9978","tarball":"http://localhost:4260/sprintf-js/sprintf-js-1.0.2.tgz","integrity":"sha512-PLfl5haQqcprzBZvDxQD6PzrQqaCmHSx0U/OERxTAU9lLtWbpPpxTPrDKdvbHfPW/BHhQPb0o5ktMNo0ejRD9Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCnAR6ztBhxcq/Rz4TvfyLXlzfgFQAZd6erOjRVTy456AIhAJOUp25da9Mbdq7afCsPiMwRRvkBUKDOLwJXPJxQxSjO"}]},"directories":{}},"1.0.3":{"name":"sprintf-js","version":"1.0.3","description":"JavaScript sprintf implementation","author":{"name":"Alexandru Marasteanu","email":"hello@alexei.ro","url":"http://alexei.ro/"},"main":"src/sprintf.js","scripts":{"test":"mocha test/test.js"},"repository":{"type":"git","url":"git+https://github.com/alexei/sprintf.js.git"},"license":"BSD-3-Clause","devDependencies":{"mocha":"*","grunt":"*","grunt-contrib-watch":"*","grunt-contrib-uglify":"*"},"gitHead":"747b806c2dab5b64d5c9958c42884946a187c3b1","bugs":{"url":"https://github.com/alexei/sprintf.js/issues"},"homepage":"https://github.com/alexei/sprintf.js#readme","_id":"sprintf-js@1.0.3","_shasum":"04e6926f662895354f3dd015203633b857297e2c","_from":".","_npmVersion":"2.10.1","_nodeVersion":"0.12.4","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"dist":{"shasum":"04e6926f662895354f3dd015203633b857297e2c","tarball":"http://localhost:4260/sprintf-js/sprintf-js-1.0.3.tgz","integrity":"sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDSB/raarzaOUXXEaSDKssErvTM4Z3cvCQiIPvLi68d6AiAB2PIbdMo0LWWF/Adn+tb00uQT/t7+9335DWW5SSkG4w=="}]},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"directories":{}},"1.1.0":{"name":"sprintf-js","version":"1.1.0","description":"JavaScript sprintf implementation","author":{"name":"Alexandru Marasteanu","email":"hello@alexei.ro"},"main":"src/sprintf.js","scripts":{"test":"mocha test/test.js"},"repository":{"type":"git","url":"git+https://github.com/alexei/sprintf.js.git"},"license":"BSD-3-Clause","devDependencies":{"benchmark":"^2.1.4","gulp":"^3.9.0","gulp-benchmark":"^1.1.1","gulp-header":"^1.7.1","gulp-jshint":"^2.0.0","gulp-mocha":"^4.3.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^2.6.0","gulp-uglify":"^2.1.2","jshint":"^2.9.1","mocha":"^3.3.0"},"gitHead":"2e19f9a9b2c358749eb53d63be60ff7d3465711b","bugs":{"url":"https://github.com/alexei/sprintf.js/issues"},"homepage":"https://github.com/alexei/sprintf.js#readme","_id":"sprintf-js@1.1.0","_shasum":"cffcaf702daf65ea39bb4e0fa2b299cec1a1be46","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.8.0","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"dist":{"shasum":"cffcaf702daf65ea39bb4e0fa2b299cec1a1be46","tarball":"http://localhost:4260/sprintf-js/sprintf-js-1.1.0.tgz","integrity":"sha512-F5Eiffg9i6Jcq0H3iSr/2HQXTw3/BlrWqxDXS45szJfgR8EBTfQogrPXMxmJ6ylyvwE2XC4MTxPKO5/ivODOnQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD3793MG2qmpLka0zwJxtm3HOXpbsfbYNpP8SrE5/uEmgIgMKhRZuma+R/krrJc12P0H0U1+9TUMvdGttjTGHW4Hsk="}]},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/sprintf-js-1.1.0.tgz_1494081358347_0.5414827775675803"},"directories":{}},"1.1.1":{"name":"sprintf-js","version":"1.1.1","description":"JavaScript sprintf implementation","author":{"name":"Alexandru Mărășteanu","email":"hello@alexei.ro"},"main":"src/sprintf.js","scripts":{"test":"mocha test/test.js","posttest":"npm run lint","lint":"eslint .","lint:fix":"eslint --fix ."},"repository":{"type":"git","url":"git+https://github.com/alexei/sprintf.js.git"},"license":"BSD-3-Clause","devDependencies":{"benchmark":"^2.1.4","eslint":"3.19.0","gulp":"^3.9.1","gulp-benchmark":"^1.1.1","gulp-eslint":"^3.0.1","gulp-header":"^1.8.8","gulp-mocha":"^4.3.1","gulp-rename":"^1.2.2","gulp-sourcemaps":"^2.6.0","gulp-uglify":"^3.0.0","mocha":"^3.4.2"},"gitHead":"6bfe81840e560d675a9de3d79c06354a47ac9236","bugs":{"url":"https://github.com/alexei/sprintf.js/issues"},"homepage":"https://github.com/alexei/sprintf.js#readme","_id":"sprintf-js@1.1.1","_shasum":"36be78320afe5801f6cea3ee78b6e5aab940ea0c","_from":".","_npmVersion":"4.2.0","_nodeVersion":"7.8.0","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"dist":{"shasum":"36be78320afe5801f6cea3ee78b6e5aab940ea0c","tarball":"http://localhost:4260/sprintf-js/sprintf-js-1.1.1.tgz","integrity":"sha512-h/U+VScR2Ft+aXDjGTLtguUEIrYuOjTj79BAOElUvdahYMaaa7SNLjJpOIn+Uzt0hsgHfYvlbcno3e9yXOSo8Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDwbIkyxheP8rgp++juukMf6BPlTzM/mlrbKYypQYKXLQIhAIz/Fe/Uq4oiZ/a54IEZT3bUKU4109XR4HsXeRPx61oc"}]},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-js-1.1.1.tgz_1496074852444_0.6851142619270831"},"directories":{}},"1.1.2":{"name":"sprintf-js","version":"1.1.2","description":"JavaScript sprintf implementation","author":{"name":"Alexandru Mărășteanu","email":"hello@alexei.ro"},"main":"src/sprintf.js","scripts":{"test":"mocha test/*.js","pretest":"npm run lint","lint":"eslint .","lint:fix":"eslint --fix ."},"repository":{"type":"git","url":"git+https://github.com/alexei/sprintf.js.git"},"license":"BSD-3-Clause","devDependencies":{"benchmark":"^2.1.4","eslint":"^5.10.0","gulp":"^3.9.1","gulp-benchmark":"^1.1.1","gulp-eslint":"^5.0.0","gulp-header":"^2.0.5","gulp-mocha":"^6.0.0","gulp-rename":"^1.4.0","gulp-sourcemaps":"^2.6.4","gulp-uglify":"^3.0.1","mocha":"^5.2.0"},"gitHead":"ceb9b805e6d594a9c24cdde02890d3c00c6643b7","bugs":{"url":"https://github.com/alexei/sprintf.js/issues"},"homepage":"https://github.com/alexei/sprintf.js#readme","_id":"sprintf-js@1.1.2","_npmVersion":"6.4.1","_nodeVersion":"9.0.0","_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"dist":{"integrity":"sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==","shasum":"da1765262bf8c0f571749f2ad6c26300207ae673","tarball":"http://localhost:4260/sprintf-js/sprintf-js-1.1.2.tgz","fileCount":12,"unpackedSize":40231,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcDSE4CRA9TVsSAnZWagAAaNwP/1h7BqeK4PRzJRpu7PsQ\nEohuxkAhwGYnx6iTt+S5kB55BiVot9WSzOxDCvTfdcD9msg2ejdtgOLPq9kN\ntTBQOtvoXy6Xc5RwYiH+o3Kla6qir+69XBXC9CkwdOAEcPSkDvB2QFUmiUo/\ni8Mkg9r/JGtsjwSxAYcryLUUIOZkDuoMu/YCVeUWRcxPi7WiKgumQsRGW8VY\nQnJiplaydvcYREw5efMvKo3iiK2Puts0Y6KohrBvLTxFK1gnAIX/Ycq/PfYa\npDLFMwLiuvZ799Hbs44yb+52M7SX1H0Y3VULOeFWY5vYJT1I5Xqnr6U8QsQ2\nFIVMeOL2jn8gq+LcP+nUT41V1ij/L3MvMISo4YBqr32dji3+JgC0tqHxqjdi\nph36pRpEgz8cU4Nu0d0ssH9Ubx+MsbLfQ2+cWAR5BJfs79Yhu/6eo1Te0XUi\njQMstGdcQi2jyKCiBMUVaatrqiMeXhvBdnnGd7QRR0ooRZatrCpYATvnwPGl\nXfRG7MjLiFSbrYmMsnpZW09IT3FG88SwoVVnk8VhMR5glUMTS+XUJ5QT7h8F\nqhz9gjQNSUJceKMsSsrjiiRUj93/diqVVGAp7juCHQESEKHe8BCKWDguCAGg\nOsb4YsSCnj5YnCLjuvTF4dYZln9OQ5/kq3PIUbfrBp6KBg4UwQKwems9C+sp\nWCGx\r\n=4TfB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDLrYox3B7TVrVwp6JhCgq4JHze+AHVBzABb2D14BIlYgIgDObujuR953IJNu3Pku6Cg1c4oUiKzF9Z45tQGWnczAs="}]},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-js_1.1.2_1544364344346_0.16399656635245852"},"_hasShrinkwrap":false},"1.1.3":{"name":"sprintf-js","version":"1.1.3","description":"JavaScript sprintf implementation","author":{"name":"Alexandru Mărășteanu","email":"hello@alexei.ro"},"main":"src/sprintf.js","scripts":{"test":"mocha test/*.js","pretest":"npm run lint","lint":"eslint .","lint:fix":"eslint --fix ."},"repository":{"type":"git","url":"git+https://github.com/alexei/sprintf.js.git"},"license":"BSD-3-Clause","devDependencies":{"benchmark":"^2.1.4","eslint":"^5.10.0","gulp":"^3.9.1","gulp-benchmark":"^1.1.1","gulp-eslint":"^5.0.0","gulp-header":"^2.0.5","gulp-mocha":"^6.0.0","gulp-rename":"^1.4.0","gulp-sourcemaps":"^2.6.4","gulp-uglify":"^3.0.1","mocha":"^5.2.0"},"overrides":{"graceful-fs":"^4.2.11"},"gitHead":"3a0d8c26d291b5bd9f1974877ecc50739921d6f5","bugs":{"url":"https://github.com/alexei/sprintf.js/issues"},"homepage":"https://github.com/alexei/sprintf.js#readme","_id":"sprintf-js@1.1.3","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==","shasum":"4914b903a2f8b685d17fdf78a70e917e872e444a","tarball":"http://localhost:4260/sprintf-js/sprintf-js-1.1.3.tgz","fileCount":11,"unpackedSize":39879,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFqEdBzxc5TO4qHn2Vaj+rUbeXXAIrldXZrm+Oh3ctpGAiA9wmSjDRjIGR5h/m5RnndPawduJOh1VPtIhc1D08pEew=="}]},"_npmUser":{"name":"alexei","email":"hello@alexei.ro"},"directories":{},"maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sprintf-js_1.1.3_1694437928849_0.6056137367139747"},"_hasShrinkwrap":false}},"readme":"# sprintf-js\n\n[![Build Status][travisci-image]][travisci-url] [![NPM Version][npm-image]][npm-url] [![Dependency Status][dependencies-image]][dependencies-url] [![devDependency Status][dev-dependencies-image]][dev-dependencies-url]\n\n[travisci-image]: https://travis-ci.org/alexei/sprintf.js.svg?branch=master\n[travisci-url]: https://travis-ci.org/alexei/sprintf.js\n\n[npm-image]: https://badge.fury.io/js/sprintf-js.svg\n[npm-url]: https://badge.fury.io/js/sprintf-js\n\n[dependencies-image]: https://david-dm.org/alexei/sprintf.js.svg\n[dependencies-url]: https://david-dm.org/alexei/sprintf.js\n\n[dev-dependencies-image]: https://david-dm.org/alexei/sprintf.js/dev-status.svg\n[dev-dependencies-url]: https://david-dm.org/alexei/sprintf.js#info=devDependencies\n\n**sprintf-js** is a complete open source JavaScript `sprintf` implementation for the **browser** and **Node.js**.\n\n**Note: as of v1.1.1 you might need some polyfills for older environments. See [Support](#support) section below.**\n\n## Usage\n\n var sprintf = require('sprintf-js').sprintf,\n vsprintf = require('sprintf-js').vsprintf\n\n sprintf('%2$s %3$s a %1$s', 'cracker', 'Polly', 'wants')\n vsprintf('The first 4 letters of the english alphabet are: %s, %s, %s and %s', ['a', 'b', 'c', 'd'])\n\n## Installation\n\n### NPM\n\n npm install sprintf-js\n\n### Bower\n\n bower install sprintf\n\n## API\n\n### `sprintf`\n\nReturns a formatted string:\n\n string sprintf(string format, mixed arg1?, mixed arg2?, ...)\n\n### `vsprintf`\n\nSame as `sprintf` except it takes an array of arguments, rather than a variable number of arguments:\n\n string vsprintf(string format, array arguments?)\n\n## Format specification\n\nThe placeholders in the format string are marked by `%` and are followed by one or more of these elements, in this order:\n\n* An optional number followed by a `$` sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string.\n* An optional `+` sign that forces to precede the result with a plus or minus sign on numeric values. By default, only the `-` sign is used on negative numbers.\n* An optional padding specifier that says what character to use for padding (if specified). Possible values are `0` or any other character preceded by a `'` (single quote). The default is to pad with *spaces*.\n* An optional `-` sign, that causes `sprintf` to left-align the result of this placeholder. The default is to right-align the result.\n* An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. When used with the `j` (JSON) type specifier, the padding length specifies the tab size used for indentation.\n* An optional precision modifier, consisting of a `.` (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used with the `g` type specifier, it specifies the number of significant digits. When used on a string, it causes the result to be truncated.\n* A type specifier that can be any of:\n * `%` — yields a literal `%` character\n * `b` — yields an integer as a binary number\n * `c` — yields an integer as the character with that ASCII value\n * `d` or `i` — yields an integer as a signed decimal number\n * `e` — yields a float using scientific notation\n * `u` — yields an integer as an unsigned decimal number\n * `f` — yields a float as is; see notes on precision above\n * `g` — yields a float as is; see notes on precision above\n * `o` — yields an integer as an octal number\n * `s` — yields a string as is\n * `t` — yields `true` or `false`\n * `T` — yields the type of the argument<sup><a href=\"#fn-1\" name=\"fn-ref-1\">1</a></sup>\n * `v` — yields the primitive value of the specified argument\n * `x` — yields an integer as a hexadecimal number (lower-case)\n * `X` — yields an integer as a hexadecimal number (upper-case)\n * `j` — yields a JavaScript object or array as a JSON encoded string\n\n## Features\n\n### Argument swapping\n\nYou can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to:\n\n sprintf('%2$s %3$s a %1$s', 'cracker', 'Polly', 'wants')\n\nAnd, of course, you can repeat the placeholders without having to increase the number of arguments.\n\n### Named arguments\n\nFormat strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - `(` and `)` - and begin with a keyword that refers to a key:\n\n var user = {\n name: 'Dolly',\n }\n sprintf('Hello %(name)s', user) // Hello Dolly\n\nKeywords in replacement fields can be optionally followed by any number of keywords or indexes:\n\n var users = [\n {name: 'Dolly'},\n {name: 'Molly'},\n {name: 'Polly'},\n ]\n sprintf('Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s', {users: users}) // Hello Dolly, Molly and Polly\n\nNote: mixing positional and named placeholders is not (yet) supported\n\n### Computed values\n\nYou can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on the fly.\n\n sprintf('Current date and time: %s', function() { return new Date().toString() })\n\n### AngularJS\n\nYou can use `sprintf` and `vsprintf` (also aliased as `fmt` and `vfmt` respectively) in your AngularJS projects. See `demo/`.\n\n## Support\n\n### Node.js\n\n`sprintf-js` runs in all active Node versions (4.x+).\n\n### Browser\n\n`sprintf-js` should work in all modern browsers. As of v1.1.1, you might need polyfills for the following:\n\n - `String.prototype.repeat()` (any IE)\n - `Array.isArray()` (IE < 9)\n - `Object.create()` (IE < 9)\n\nYMMV\n\n## License\n\n**sprintf-js** is licensed under the terms of the BSD 3-Clause License.\n\n## Notes\n\n<small><sup><a href=\"#fn-ref-1\" name=\"fn-1\">1</a></sup> `sprintf` doesn't use the `typeof` operator. As such, the value `null` is a `null`, an array is an `array` (not an `object`), a date value is a `date` etc.</small>\n","maintainers":[{"name":"alexei","email":"hello@alexei.ro"}],"time":{"modified":"2023-09-11T13:12:09.369Z","created":"2013-04-03T13:24:36.516Z","0.0.7":"2013-04-03T13:24:39.808Z","1.0.1":"2014-10-25T09:32:31.819Z","1.0.2":"2014-10-25T09:37:23.896Z","1.0.3":"2015-07-10T13:41:29.308Z","1.1.0":"2017-05-06T14:35:59.835Z","1.1.1":"2017-05-29T16:20:53.315Z","1.1.2":"2018-12-09T14:05:44.561Z","1.1.3":"2023-09-11T13:12:09.207Z"},"author":{"name":"Alexandru Mărășteanu","email":"hello@alexei.ro"},"repository":{"type":"git","url":"git+https://github.com/alexei/sprintf.js.git"},"users":{"blalor":true,"jimnox":true,"guumaster":true,"rsp":true,"tnagengast":true,"dbck":true,"battlemidget":true,"chocolateboy":true,"flozz":true,"acollins-ts":true,"mattonfoot":true,"jahnestacado":true,"m80126colin":true,"evandrix":true,"redmonkeydf":true,"brightchen":true,"rreusser":true,"kabirbaidhya":true,"sopepos":true,"monsterkodi":true,"roberkules":true,"hyokosdeveloper":true,"claudiopro":true,"limit":true,"shanewholloway":true,"axelrindle":true,"armantaherian":true,"ys_sidson_aidson":true,"nbuchanan":true,"agamlarage":true,"peter.forgacs":true,"create3000":true,"yuch4n":true,"keyn":true,"justjavac":true,"touskar":true,"soerenskoett":true,"panlw":true},"homepage":"https://github.com/alexei/sprintf.js#readme","bugs":{"url":"https://github.com/alexei/sprintf.js/issues"},"license":"BSD-3-Clause","readmeFilename":"README.md"} |