Back to Explore

sindresorhus/mimic-function

GitHub
1 watchersOpen source

Last release:

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

  • Maintenance status: Active maintenance is not evident, the most recent upstream push is 2024-10-28, and the most recent published updates are from 2024-03-14 (v5.0.1). As of 2026-06-09, this source appears quiet/dormant rather than actively maintained.
  • Update cadence: Updates arrive infrequently, with a gap of about 2+ years between v4.0.0 (2021-04-07) and v5.0.0/v5.0.1 (2023-11 to 2024-03), suggesting low cadence and occasional maintenance bursts.

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v5.0.1

    v5.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

    v5.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.

    Breaking
  • v4.0.0

    v4.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.

    Breaking
  • v3.1.0

    v3.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

    v3.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.

    BreakingFeatures
  • v2.1.0

    v2.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

    This 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