fast-equals is a high-performance utility library designed for deep and shallow equality comparisons between JavaScript values, offering significant speed advantages and a small bundle size (~2KB minified and gzipped). Currently stable at version 6.0.0, the library maintains a steady release cadence with minor updates for bug fixes and features, and major versions for breaking changes and significant enhancements. It differentiates itself by providing a comprehensive suite of equality methods (deep, shallow, SameValue, SameValueZero, strict, and circular-aware comparisons), built-in support for a wide array of JavaScript types including Objects, Arrays, TypedArrays, Dates, RegExps, Maps, Sets, Promises, and custom class instances. Furthermore, it offers robust customization options through `createCustomEqual`, allowing developers to define comparison logic for specific types or use cases, all without any external dependencies.
npm install fast-equalsVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the core `deepEqual`, `shallowEqual`, `strictEqual`, and `createCustomEqual` methods with various data types, illustrating their differing behaviors for object, array, and custom value comparisons.
Migrate your module imports to use standard ESM (`import ... from 'fast-equals'`) or CommonJS (`require('fast-equals')`) conventions. Ensure your build tooling is configured to correctly resolve these module formats.Review your imports and rely only on the public API exposed directly from the `fast-equals` package root. Consult the official documentation for the current list of exported functions and types.
Be aware of this specific behavior when comparing `Map` instances. If you require strict `SameValueZero` comparison for Map keys, you might need to implement a custom comparator using `createCustomEqual` that explicitly bypasses this deep comparison logic for Maps.
Refactor your code to use the public API functions (`deepEqual`, `shallowEqual`, `createCustomEqual`, etc.) instead of relying on internal indirect methods.
Use `strictEqual` specifically when you intend to compare for referential equality or primitive value equality. For comparing the content and structure of objects, arrays, or other complex types, use `deepEqual`.
Update your import statements or bundler configuration to use the ESM (`import ... from 'fast-equals'`) or CommonJS (`require('fast-equals')`) builds. The default package entry point should resolve correctly.Ensure you are using `import { deepEqual } from 'fast-equals';` for ESM environments and `const { deepEqual } = require('fast-equals');` for CommonJS environments. Verify your `tsconfig.json` and bundler settings (`moduleResolution`, `module`) are correctly configured for your target environment.Review the official `fast-equals` documentation or source code for the current set of publicly exposed types. If a specific type is no longer available, consider if you truly need to import it, or if a more general type definition suffices.
No dependency data recorded yet.