{"_id":"pupa","_rev":"827229","name":"pupa","description":"Simple micro templating","dist-tags":{"latest":"3.1.0"},"maintainers":[{"name":"sindresorhus","email":""}],"time":{"modified":"2021-09-13T14:30:56.000Z","created":"2017-01-10T05:09:38.131Z","3.1.0":"2021-09-13T14:28:34.620Z","3.0.0":"2021-07-13T09:54:54.321Z","2.1.1":"2020-10-25T18:34:03.969Z","2.1.0":"2020-10-21T10:47:34.592Z","2.0.1":"2019-07-27T15:53:32.679Z","2.0.0":"2019-04-30T13:47:05.949Z","1.0.0":"2017-01-10T05:09:38.131Z"},"users":{"rocket0191":true,"rubiadias":true},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"repository":{"type":"git","url":"git+https://github.com/sindresorhus/pupa.git"},"versions":{"3.1.0":{"name":"pupa","version":"3.1.0","description":"Simple micro templating","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/pupa.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12.20"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","formatting","template","object","format","interpolate","interpolation","templating","expand","simple","replace","placeholders","values","transform","micro"],"dependencies":{"escape-goat":"^4.0.0"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","typescript":"^4.3.5","xo":"^0.41.0"},"gitHead":"17f43fa78e84f7344b583718ea2d374e70e77454","bugs":{"url":"https://github.com/sindresorhus/pupa/issues"},"homepage":"https://github.com/sindresorhus/pupa#readme","_id":"pupa@3.1.0","_nodeVersion":"12.22.1","_npmVersion":"7.20.3","dist":{"shasum":"f15610274376bbcc70c9a3aa8b505ea23f41c579","size":2927,"noattachment":false,"key":"/pupa/-/pupa-3.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pupa/download/pupa-3.1.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pupa_3.1.0_1631543314505_0.26047106851744783"},"_hasShrinkwrap":false,"publish_time":1631543314620,"_cnpm_publish_time":1631543314620},"3.0.0":{"name":"pupa","version":"3.0.0","description":"Simple micro templating","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/pupa.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":"./index.js","engines":{"node":">=12.20"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","formatting","template","object","format","interpolate","interpolation","templating","expand","simple","replace","placeholders","values","transform","micro"],"dependencies":{"escape-goat":"^4.0.0"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.17.0","typescript":"^4.3.5","xo":"^0.41.0"},"gitHead":"9df7c542e1f95b434674669a1157ef43c5bcd554","bugs":{"url":"https://github.com/sindresorhus/pupa/issues"},"homepage":"https://github.com/sindresorhus/pupa#readme","_id":"pupa@3.0.0","_nodeVersion":"12.22.1","_npmVersion":"7.10.0","dist":{"shasum":"e78cc0ec9b5d533a58665411ab42f965146e3f96","size":2928,"noattachment":false,"key":"/pupa/-/pupa-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pupa/download/pupa-3.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pupa_3.0.0_1626170094001_0.37693329741624915"},"_hasShrinkwrap":false,"publish_time":1626170094321,"_cnpm_publish_time":1626170094321},"2.1.1":{"name":"pupa","version":"2.1.1","description":"Simple micro templating","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/pupa.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","formatting","template","object","format","interpolate","interpolation","templating","expand","simple","replace","placeholders","values","transform","micro"],"dependencies":{"escape-goat":"^2.0.0"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"10b60a3b0cde712d9d059161a02e6dab6119512b","bugs":{"url":"https://github.com/sindresorhus/pupa/issues"},"homepage":"https://github.com/sindresorhus/pupa#readme","_id":"pupa@2.1.1","_nodeVersion":"14.11.0","_npmVersion":"6.14.8","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"f5e8fd4afc2c5d97828faa523549ed8744a20d62","size":2372,"noattachment":false,"key":"/pupa/-/pupa-2.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/pupa/download/pupa-2.1.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pupa_2.1.1_1603650843852_0.7855436442218846"},"_hasShrinkwrap":false,"publish_time":1603650843969,"_cnpm_publish_time":1603650843969},"2.1.0":{"name":"pupa","version":"2.1.0","description":"Simple micro templating","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/pupa.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","formatting","template","object","format","interpolate","interpolation","templating","expand","simple","replace","placeholders","values","transform","micro"],"dependencies":{"escape-goat":"^2.0.0"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"5bb137186a92fe2304fd71996bb6638c52700da6","bugs":{"url":"https://github.com/sindresorhus/pupa/issues"},"homepage":"https://github.com/sindresorhus/pupa#readme","_id":"pupa@2.1.0","_nodeVersion":"14.11.0","_npmVersion":"6.14.8","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"9e4ec587952b5e4f2c06fe577b0e7db97e8ef721","size":2370,"noattachment":false,"key":"/pupa/-/pupa-2.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pupa/download/pupa-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pupa_2.1.0_1603277254422_0.8562450293594945"},"_hasShrinkwrap":false,"publish_time":1603277254592,"_cnpm_publish_time":1603277254592},"2.0.1":{"name":"pupa","version":"2.0.1","description":"Simple micro templating","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/pupa.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","formatting","template","object","format","interpolate","interpolation","templating","expand","simple","replace","placeholders","values","transform","micro"],"dependencies":{"escape-goat":"^2.0.0"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"e4c915c8851e432ff707c3f270e2aaf22116a6c5","bugs":{"url":"https://github.com/sindresorhus/pupa/issues"},"homepage":"https://github.com/sindresorhus/pupa#readme","_id":"pupa@2.0.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"dbdc9ff48ffbea4a26a069b6f9f7abb051008726","size":2280,"noattachment":false,"key":"/pupa/-/pupa-2.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/pupa/download/pupa-2.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pupa_2.0.1_1564242812501_0.9540517658148819"},"_hasShrinkwrap":false,"publish_time":1564242812679,"_cnpm_publish_time":1564242812679},"2.0.0":{"name":"pupa","version":"2.0.0","description":"Simple micro templating","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/pupa.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["string","formatting","template","object","format","interpolate","interpolation","templating","expand","simple","replace","placeholders","values","transform","micro"],"dependencies":{"escape-goat":"^2.0.0"},"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"5fe0eeab4d3b6395ba97c2cc58481c34620a5ecb","bugs":{"url":"https://github.com/sindresorhus/pupa/issues"},"homepage":"https://github.com/sindresorhus/pupa#readme","_id":"pupa@2.0.0","_nodeVersion":"10.15.3","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"2b385e4c79d7eb7c703a6e24cbeca2c90d8cf697","size":2264,"noattachment":false,"key":"/pupa/-/pupa-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pupa/download/pupa-2.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/pupa_2.0.0_1556632025797_0.8563917558100542"},"_hasShrinkwrap":false,"publish_time":1556632025949,"_cnpm_publish_time":1556632025949},"1.0.0":{"name":"pupa","version":"1.0.0","description":"Simple micro templating","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/pupa.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["string","formatting","template","object","format","interpolate","interpolation","templating","str","obj","tpl","expand","simple","replace","placeholders","values","fmt","transform","micro"],"devDependencies":{"ava":"*","xo":"*"},"xo":{"esnext":true},"gitHead":"05a5d7e3cbe99cb303b6d0fda6984c45e59ec45d","bugs":{"url":"https://github.com/sindresorhus/pupa/issues"},"homepage":"https://github.com/sindresorhus/pupa#readme","_id":"pupa@1.0.0","_shasum":"9a9568a5af7e657b8462a6e9d5328743560ceff6","_from":".","_npmVersion":"2.15.11","_nodeVersion":"4.6.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"9a9568a5af7e657b8462a6e9d5328743560ceff6","size":1960,"noattachment":false,"key":"/pupa/-/pupa-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/pupa/download/pupa-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pupa-1.0.0.tgz_1484024976343_0.21447648899629712"},"directories":{},"publish_time":1484024978131,"_cnpm_publish_time":1484024978131,"_hasShrinkwrap":false}},"readme":"# pupa\n\n> Simple micro templating\n\nUseful when all you need is to fill in some placeholders.\n\n## Install\n\n```\n$ npm install pupa\n```\n\n## Usage\n\n```js\nimport pupa from 'pupa';\n\npupa('The mobile number of {name} is {phone.mobile}', {\n\tname: 'Sindre',\n\tphone: {\n\t\tmobile: '609 24 363'\n\t}\n});\n//=> 'The mobile number of Sindre is 609 24 363'\n\npupa('I like {0} and {1}', ['????', '????']);\n//=> 'I like ???? and ????'\n\n// Double braces encodes the HTML entities to avoid code injection.\npupa('I like {{0}} and {{1}}', ['<br>????</br>', '<i>????</i>']);\n//=> 'I like &lt;br&gt;????&lt;/br&gt; and &lt;i&gt;????&lt;/i&gt;'\n```\n\n## API\n\n### pupa(template, data, options?)\n\n#### template\n\nType: `string`\n\nText with placeholders for `data` properties.\n\n#### data\n\nType: `object | unknown[]`\n\nData to interpolate into `template`.\n\n#### options\n\nType: `object`\n\n##### ignoreMissing\n\nType: `boolean`\\\nDefault: `false`\n\nBy default, Pupa throws a `MissingValueError` when a placeholder resolves to `undefined`. With this option set to `true`, it simply ignores it and leaves the placeholder as is.\n\n##### transform\n\nType: `((data: {value: unknown; key: string}) => unknown) | undefined` (default: `({value}) => value`)\n\nPerforms arbitrary operation for each interpolation. If the returned value was `undefined`, it behaves differently depending on the `ignoreMissing` option. Otherwise, the returned value will be interpolated into a string (and escaped when double-braced) and embedded into the template.\n\n### MissingValueError\n\nExposed for instance checking.\n\n## FAQ\n\n### What about template literals?\n\nTemplate literals expand on creation. This module expands the template on execution, which can be useful if either or both template and data are lazily created or user-supplied.\n\n## Related\n\n- [pupa-cli](https://github.com/sindresorhus/pupa-cli) - CLI for this module\n","_attachments":{},"homepage":"https://github.com/sindresorhus/pupa#readme","bugs":{"url":"https://github.com/sindresorhus/pupa/issues"},"license":"MIT"}