Concordance is a robust JavaScript utility library designed for deep comparison, human-readable formatting, detailed diffing, and consistent serialization of any JavaScript value. Currently stable at version 5.0.4, it maintains an active release cadence with frequent patch releases addressing minor issues and less frequent major versions that introduce breaking changes or significant feature enhancements. A key differentiator is its consistent underlying algorithm applied across all core operations—comparison, formatting, and diffing—ensuring predictable behavior. It offers granular control over comparisons, notably treating `-0` as distinct from `0`, `NaN` as equal to `NaN`, and comparing functions, promises, and symbols strictly by identity. Formatting is optimized for legibility, including special handling for multi-line strings and control characters. Concordance also supports serialization for later comparison, with specific behavioral changes noted when a deserialized value is used as the 'actual' value in comparisons.
npm install concordanceVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `diff` to compare two complex JavaScript objects and `format` to render the differences in a human-readable way. It also includes an example highlighting Concordance's unique handling of `-0` versus `0`.
Review existing comparison logic, especially for tests involving circular data structures, to ensure the new behavior aligns with expectations and update any assertions if needed.
Upgrade your Node.js environment to version 6 or higher to use Concordance v4.x, or Node.js 10 or higher for v5.x and beyond.
Ensure your Node.js environment is version 10 or higher. For continuous integration setups, verify and update the Node.js version specified in your `package.json` `engines` field and CI configuration.
Always pass the deserialized value as the *actual* value to comparison and diffing methods. Be aware that comparisons involving deserialized values may not behave identically to comparisons between original, live JavaScript values for certain types.
When performing comparisons or writing assertions, ensure your test expectations account for Concordance's specific handling of `-0` and `NaN`.
Switch to ES module import syntax: `import { compare } from 'concordance';`Use named imports for ES Modules: `import { compare } from 'concordance';`. If in a CommonJS context, ensure correct destructuring: `const { compare } = require('concordance');`.If your project is CommonJS, use `const { format } = require('concordance');`. If you intend to use ES Modules, ensure your `package.json` includes `"type": "module"` or rename your file to `.mjs`.No dependency data recorded yet.