mimic-function is a JavaScript utility that modifies one function to mimic another function’s name and properties. It’s useful when wrapping a function but you want the wrapper to preserve the original function’s identity details, while keeping a modified to.toString() that reflects the wrapper.
Project status
- Likely actively maintained, as evidenced by a recent 5.0.1 update in 2024 that fixes a specific function composition issue around redefining a non-value
.toStringproperty descriptor. - Apparent update cadence is low frequency, with a major update in 2023-11, a patch in 2024-03, and an older major update in 2021. (There is also an upstream push recorded for 2024-10, but no corresponding published
updatesentry is shown here.)
AI summary generated Today
Recent updates
v5.0.1
3/14/2024v5.0.1 is a small patch release focused on fixing how mimic-function composes functions when the target has a non-value `.toString` property descriptor. The code changes adjust how the `.toString` property is redefined to avoid issues with accessor descriptors.
v5.0.0
11/5/2023v5.0.0 is primarily a major release that renames the package from mimic-fn to mimic-function and raises the minimum supported Node.js version to 18. The code diff also includes a few packaging and TypeScript declaration changes beyond what is mentioned in the release notes.
Breakingv4.0.0
4/7/2021v4.0.0 makes mimic-fn a pure ESM package and raises the minimum supported Node.js version to 12. The core runtime behavior is the same (wraps a function and copies properties), but the module interface for consumers changes due to the switch to ES modules and a default export.
Breakingv3.1.0
7/24/2020v3.1.0 improves React Native compatibility. The code change adds an explicit guard to prevent copying the function properties named "arguments" and "caller" when mimicking properties from the source function.
v3.0.0
6/13/2019v3.0.0 expands mimic-fn's behavior by copying more function properties while also changing how certain properties are handled, notably `length`. It also introduces an `ignoreNonConfigurable` option, patches `to.toString` so that `String(to)` reflects the original function, and updates runtime support to drop Node 6.
BreakingFeaturesv2.1.0
3/31/2019v2.1.0 primarily updates the TypeScript typings and module export shape to be compatible with CommonJS usage. It also adjusts the project’s TypeScript test tooling (tsd vs tsd-check) and makes small documentation/test-related changes.
v2.0.0
3/7/2019This v2.0.0 release introduces TypeScript type definitions and updates the package's runtime requirements. It also contains a breaking change that increases the minimum supported Node.js version.
BreakingFeatures