deep-equal-ident is a JavaScript utility function that performs a deep comparison between two values, extending the functionality typically found in libraries like Lodash's `isEqual`. While most deep equality checks, including Lodash's, only compare the *values* of nested objects, `deep-equal-ident` critically tracks and compares the *identity* of nested objects and arrays. This means that two structures like `[[a, a]]` and `[[a, b]]` will be considered unequal by `deep-equal-ident` even if `a` and `b` are themselves deeply value-equal, because the former contains two references to the *same* object `a`, while the latter contains references to two *different* objects (`a` and `b`). This distinction is crucial for preserving structural integrity, mirroring how a robust deep cloning algorithm would behave, ensuring that if two structures are deemed equal, they will behave identically under mutation. The current stable version is 1.1.1, with recent updates focused on stability fixes. It is primarily intended for unit testing scenarios, offering direct integration with the Chai.js assertion framework for both `expect` and `assert` interfaces.
npm install deep-equal-identVerified import paths — ran on the pinned version, not inferred.
Demonstrates the core `deepEqualIdent` function, highlighting its identity-aware comparison, and shows integration with the Chai.js assertion framework.
Ensure you understand the distinction of 'identical deep equality' as explained in the documentation. This is its core feature, not a bug.
Use `require()` syntax for importing in CommonJS environments. For ESM, consider a dynamic import (`import(...)`) or a build step that handles CJS interoperability.
Use `const deepEqualIdent = require('deep-equal-ident');` to correctly import the CommonJS module.If your project is CommonJS, use `const deepEqualIdent = require('deep-equal-ident');`. If your project is ESM, you might need to use dynamic `import()` or configure your bundler/runtime for CJS interoperability.Re-evaluate the data structures being compared. If you intend for two distinct objects that happen to have the same values to be considered equal, `deep-equal-ident` is not the right tool; use a standard deep equality library like `lodash.isEqual` instead. If object identity *is* important, this assertion indicates a real structural difference.
No dependency data recorded yet.