Deep Equality with Object Identity Checks
JSON →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.
Traffic · last 30 days ↑91% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇸🇬 Singapore · 🇫🇷 France · 🇩🇪 Germany