{"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","tarball":"http://registry-npm.ywwl.com/pupa/download/pupa-1.0.0.tgz","integrity":"sha512-WTQm0CKSL1kn+DQCuu970eBPGmhIcfDyDBa9cbgR/grZ2jLrQmLDHoqqAPWLTRlOHFUrBBmL7FQJBZALA+llQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDPpplOFiDJ0t5Mon80jYG80Usw7Qz9MK+jRRbRMOMKWQIhAPLy1oPA43DU9HpRa8/3nSlDkM4nv1M67YaWGlk6+z3B"}],"size":1960,"noattachment":false,"key":"/pupa/-/pupa-1.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/pupa-1.0.0.tgz_1484024976343_0.21447648899629712"},"directories":{},"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","publish_time":1484024978131,"_cnpm_publish_time":1484024978131,"dist-tags":{"latest":"3.3.0"}}