just-compare
Part of a library of zero-dependency npm modules that do just do one thing.
Guilt-free utilities for every occasion.
🍦 Try it
npm install just-compare
yarn add just-compare
Compare two collections
import compare from 'just-compare';
compare([1, [2, 3]], [1, [2, 3]]);
compare([1, [2, 3], 4], [1, [2, 3]]);
compare({a: 2, b: 3}, {a: 2, b: 3});
compare({a: 2, b: 3}, {b: 3, a: 2});
compare({a: 2, b: 3, c: 4}, {a: 2, b: 3});
compare({a: 2, b: 3}, {a: 2, b: 3, c: 4});
compare([1, [2, {a: 4}], 4], [1, [2, {a: 4}]]);
compare([1, [2, {a: 4}], 4], [1, [2, {a: 4}], 4]);
compare(NaN, NaN);