{"name":"mimic-fn","version":"2.1.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":">=6"},"scripts":{"test":"xo && ava && tsd"},"keywords":["function","mimic","imitate","rename","copy","inherit","properties","name","func","fn","set","infer","change"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.1","xo":"^0.24.0"},"gitHead":"d29f5387f4c19814a042d03a780ff4481ceac5a3","bugs":{"url":"https://github.com/sindresorhus/mimic-fn/issues"},"homepage":"https://github.com/sindresorhus/mimic-fn#readme","_id":"mimic-fn@2.1.0","_nodeVersion":"8.15.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==","shasum":"7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b","tarball":"http://registry-npm.ywwl.com/mimic-fn/download/mimic-fn-2.1.0.tgz","fileCount":5,"unpackedSize":4457,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcoP6eCRA9TVsSAnZWagAABhUP/0r53cJjmLHgRJsHmF5j\nVbo/ZfYjnaYVOtWnhLMqKckmQyZwFrlWnVqgvpAX+9zT4mwWQrs9b5BklbRH\nEW0EnFbfov2GtzngwpLlEFu1I8zCcwtSNgXFLjC2zRBIyoZwfMcmR8AnVXVE\nYeKl7lpF+k2UO6e6qBqaTfOyiHfaT2KqGHgrojvi2807BNL+mAiwt/HOA+A/\nj47kuPGK3gwvfoXqU0FFHtvx8/cF4KxJuL2bOqOfJRFMvDYzszIn9hMsODMN\nivLzdtqU2KN4GVALWdgIgmBOiivCvQWfeveJpN+FCGS+tqhI8pA++jai5Bc9\noplfu08LTp44MxEWNqA/4ZvYNtGqdDhfuCbkYJfWs1JVsdMiy+/+GjOg9GSr\nuMAvgO7xCjg/4bmt5xhGRf458zNHcK85M0N6E4bTZUCnUlpmwVtNYyv5IG0r\nKANhkq2vRyzb6XbNgWgaTuV75EA/qtlF2aM3MJqn0abyfOb/KbsADYNFLF13\nYnWKZLL0zyIzNTa8yMggOa4hIM+qczWoPbxXQYWNUKjheFWw4Z0HXJG9DiN5\nLe0CBrtqUB9RNuFSPpfySoGQZ26iGeLTVMCYSouoednp/5iqD5/uKcRqhmEE\nZ/LhXFoCea95amej1cFLV/4kKp8XnY2aN8cmawYtTTTL8QKpro534KGlPg0h\nYOd+\r\n=2q3H\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDxU+rLv+cNZnG5Ij14sX0PMBPR9oXTreQjipFjWhEWEQIgFdCUrsiBSFkkylqnzlC9y5B65EKgtdbZPvlr/VvFBqo="}],"size":2119,"noattachment":false,"key":"/mimic-fn/-/mimic-fn-2.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mimic-fn_2.1.0_1554054813982_0.46010347442389166"},"_hasShrinkwrap":false,"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":1554054814125,"_cnpm_publish_time":1554054814125,"dist-tags":{"latest":"5.0.0"}}