Using this npm package, You can compare two objects.
var object_match = require("object_matching");
const a = {foo: "poteto",bar: "apple" }
const b = {bar: "apple",foo: "poteto" }
const c = {bar: "poteto",foo: "apple" }
console.log(object_match(a,b)) //true
console.log(object_match(b,c)) //false
$ npm install object_matching