I want to compare some selected fields of two objects.
E.g
const a = {type: "media", value: "TV"}
const b = {type: "media", value: "TV", name: "John"}
Can we have something to compare these two object with some specific keys like
const keys = [type, value]
compare(a, b, keys);
I just need to know some best practices to handle this logic and wants to avoid simple loops. Do we have any lodash lib for that ? Or any JavaScript ES6 function.
FYI: this is just simple example my real time scenario are far very complex.
Updates: This is what I have tried
Values are coming from react state and I am building my object E.g
const myObject = {a: aVal, b: bVal, c: cVal .......}
const compareObject = compareObject.exclude(the keys which I dont need) // example
const result = isEqual(myObject, compareObject)
Thanks