{"_id":"@cjser/mimic-fn__v4_0_0","name":"@cjser/mimic-fn__v4_0_0","dist-tags":{"latest":"4.0.0-cjser.2"},"versions":{"4.0.0-cjser.2":{"name":"@cjser/mimic-fn__v4_0_0","version":"4.0.0-cjser.2","description":"Make a function mimic another one","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"require":"./dist-cjser/index.cjs","default":"./index.js"},"engines":{"node":">=12"},"scripts":{"test":"xo && ava && tsd"},"keywords":["function","mimic","imitate","rename","copy","inherit","properties","name","func","fn","set","infer","change"],"devDependencies":{"ava":"^3.15.0","tsd":"^0.14.0","xo":"^0.38.2"},"main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"4.0.0","cjserVersion":2,"original":{"name":"mimic-fn","version":"4.0.0","exports":"./index.js","repository":"sindresorhus/mimic-fn","files":["index.js","index.d.ts"],"scripts":{"test":"xo && ava && tsd"}}},"_id":"@cjser/mimic-fn__v4_0_0@4.0.0-cjser.2","gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-E/t7uscreQ1GJ0OclVhwnfiPlAHd5RZfNJjT8rVF9uKM/FO92opKQhpbeE/GpBXwzjxU8OSBK+qVy/t9qhmSvw==","shasum":"f6eb13416e67b329b9a6dc51e831ef00b1c5abec","tarball":"https://registry.npmjs.org/@cjser/mimic-fn__v4_0_0/-/mimic-fn__v4_0_0-4.0.0-cjser.2.tgz","fileCount":6,"unpackedSize":12083,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBv9IF349Ge/HiJndxMQPTfo/IcAM0/qEd5GnB3rg/YIAiEAwJ1iLeCY1b6/wgdZLPFr6wkcUmzrodI+urVNrAx7bds="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mimic-fn__v4_0_0_4.0.0-cjser.2_1778159065641_0.006329795130100013"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T13:04:25.561Z","4.0.0-cjser.2":"2026-05-07T13:04:25.856Z","modified":"2026-05-07T13:04:26.037Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Make a function mimic another one","keywords":["function","mimic","imitate","rename","copy","inherit","properties","name","func","fn","set","infer","change"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"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\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/mimic-fn\n","readmeFilename":"readme.md","_rev":"1-0c329ca76be493386e89db06aa54ec94"}