{"_id":"@cjs-mifi-test/mimic-fn","_rev":"1-d5ce05c40c773cc2bf21b06f56f034e9","name":"@cjs-mifi-test/mimic-fn","dist-tags":{"latest":"4.0.0"},"versions":{"4.0.0":{"name":"@cjs-mifi-test/mimic-fn","version":"4.0.0","description":"CJS version: Make a function mimic another one","keywords":["function","mimic","imitate","rename","copy","inherit","properties","name","func","fn","set","infer","change"],"license":"MIT","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"main":"./index.js","scripts":{},"engines":{"node":">=12"},"devDependencies":{"ava":"^3.15.0","tsd":"^0.14.0","xo":"^0.38.2"},"types":"./index.d.ts","_id":"@cjs-mifi-test/mimic-fn@4.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"integrity":"sha512-GZ844ZBJpoINkEQLBv91ko032yU2YDD/S86iWzhtKpPSLIiR7vg2XhILlsdApKfzJ7kFDC0CQKpaCKA0LwUIdA==","shasum":"e80ff70a4e60704dda6eefc4ed57645d308de268","tarball":"https://registry.npmjs.org/@cjs-mifi-test/mimic-fn/-/mimic-fn-4.0.0.tgz","fileCount":5,"unpackedSize":8259,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh7lQtCRA9TVsSAnZWagAAutIP/20L/wvk51zR5gI6V9ZD\nO98RJWTNfEIldMPSei85BLRCertMrt+xwdV1m6ei24Drac9DA0RL5KOiJkS0\nqdRZjANW7rNJo1pTtSwoAvNbnq0r6anO3hfjygRgCE+JlpnHo+rSG8WA9TKi\n6CDLpGXZAs+F9fi17lwlzPEZmkQBWKmblAJVewXcOyob4pk0O3jTveX+WXX3\nKhxW/S6XHa0kHV22+yj6nskr3Qp0ZqzA83oYfVlgTyqwkmMnxN4tupzylelU\nGL28UrONT4gXkldNExaiBZpk2JJA/z1OvqiVZSYT9BV+mfe9Lf+VBhFL8TuR\ndxOqXEj30MvRd6ISRLybvTAgJdjdpoW77PITAJxJDNVWJElMf0idOSehqfO6\nBpiEB77Owroyl13Qwt28PwI47vjAHulQrJbYetTuHOR30Kve8C2jWY4quWpI\nPSkV3/vEKoRzObXzPQ+XM+/QJ4U67zjm2NTu80NvyE083sexe3dTKQbGKFM+\nDxpXn2FV0umRbukhV6I6Y2VKQP7VL6GSPMCoNSRYAH9n7BYn5IbsKcoT+irq\n7eguteRpLTUwv+XPAf6VZprjjS7NaKyDnAFF+gNwvJZjlzUxspn7iDvx9SNd\nCRHdlISCBtCCLKyoArLqr3XHzE6FtoLVh8N56NmmtoDkFTvxIUc/3vBFcJGx\nz36H\r\n=EnZN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDfj0h3bFF9HIonAE1S5AOpZ4qsJzb8Fc0x9xnbqgQKKQIgdWad5BxrMMhZpDTJ1Q/3KF3E2YJo+4xMATSG16eJibE="}]},"_npmUser":{"name":"mifi","email":"finstaden@gmail.com"},"directories":{},"maintainers":[{"name":"mifi","email":"finstaden@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mimic-fn_4.0.0_1643009069429_0.6619408317964646"},"_hasShrinkwrap":false}},"time":{"created":"2022-01-24T07:24:29.340Z","4.0.0":"2022-01-24T07:24:29.548Z","modified":"2022-04-04T23:09:35.938Z"},"maintainers":[{"name":"mifi","email":"finstaden@gmail.com"}],"description":"CJS version: Make a function mimic another one","keywords":["function","mimic","imitate","rename","copy","inherit","properties","name","func","fn","set","infer","change"],"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","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","readmeFilename":"readme.md"}