{"name":"mimic-fn","version":"1.2.0","description":"Make a function mimic another one","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/mimic-fn.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=4"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["function","mimic","imitate","rename","copy","inherit","properties","name","func","fn","set","infer","change"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"d762fc495eef1e48718e1f39b82c39ff5e95dfe4","bugs":{"url":"https://github.com/sindresorhus/mimic-fn/issues"},"homepage":"https://github.com/sindresorhus/mimic-fn#readme","_id":"mimic-fn@1.2.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==","shasum":"820c86a39334640e99516928bd03fca88057d022","tarball":"http://registry-npm.ywwl.com/mimic-fn/download/mimic-fn-1.2.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGXAvBn91EsNdSaXeBsi4CXYaVZ1TzabXETiWr1gLqxaAiB5xNXsbIni0E0ZkI/nlGzUBdL/oqDAtfByOb+dU/nNyw=="}],"size":1765,"noattachment":false,"key":"/mimic-fn/-/mimic-fn-1.2.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mimic-fn-1.2.0.tgz_1517542098165_0.264689544448629"},"directories":{},"readme":"<img src=\"media/logo.svg\" alt=\"mimic-fn\" width=\"400\">\n<br>\n\n> Make a function mimic another one\n\nUseful when you wrap a function in another function and like to preserve the original name and other properties.\n\n## Install\n\n```\n$ npm install mimic-fn\n```\n\n## Usage\n\n```js\nimport mimicFunction from 'mimic-fn';\n\nfunction foo() {}\nfoo.unicorn = '🦄';\n\nfunction wrapper() {\n\treturn foo();\n}\n\nconsole.log(wrapper.name);\n//=> 'wrapper'\n\nmimicFunction(wrapper, foo);\n\nconsole.log(wrapper.name);\n//=> 'foo'\n\nconsole.log(wrapper.unicorn);\n//=> '🦄'\n\nconsole.log(String(wrapper));\n//=> '/* Wrapped with wrapper() */\\nfunction foo() {}'\n```\n\n\n## API\n\n### mimicFunction(to, from, options?)\n\nModifies the `to` function to mimic the `from` function. Returns the `to` function.\n\n`name`, `displayName`, and any other properties of `from` are copied. The `length` property is not copied. Prototype, class, and inherited properties are copied.\n\n`to.toString()` will return the same as `from.toString()` but prepended with a `Wrapped with to()` comment.\n\n#### to\n\nType: `Function`\n\nMimicking function.\n\n#### from\n\nType: `Function`\n\nFunction to mimic.\n\n#### options\n\nType: `object`\n\n##### ignoreNonConfigurable\n\nType: `boolean`\\\nDefault: `false`\n\nSkip modifying [non-configurable properties](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor#Description) instead of throwing an error.\n\n## Related\n\n- [rename-fn](https://github.com/sindresorhus/rename-fn) - Rename a function\n- [keep-func-props](https://github.com/ehmicky/keep-func-props) - Wrap a function without changing its name and other properties\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-mimic-fn?utm_source=npm-mimic-fn&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n","publish_time":1517542098400,"_cnpm_publish_time":1517542098400,"dist-tags":{"latest":"5.0.0"}}