$ cd into-your-project-root
$ npm install object-help --save
// Sorted object is enabled by default
const { objectsAreEqual } = require('object-help');
const equalSorted = objectsAreEqual([{a: 'b', b: 'a'}, {b: 'a', a: 'b'])
console.log(equalSorted) // returns true
const equalUnsortedFalse = objectsAreEqual([{a: 'b', b: 'a'}, {b: 'a', a: 'b'}], {sorted: false})
console.log(equalUnsortedFalse) // returns false
const equalUnsortedTrue = objectsAreEqual([{a: 'b', b: 'a'}, {a: 'b', b: 'a'}], {sorted: false})
console.log(equalUnsortedTrue) // returns true
Tests (Jest)
$ cd into-your-project-root
$ npm i
$ npm test
Edison Cury Neto
MIT