There is an equals function in Ramdajs which is totally awesome, it will provide the following:
// (1) true
R.equals({ id: 3}, { id: 3})
// (2) true
R.equals({ id: 3, name: 'freddy'}, { id: 3, name: 'freddy'})
// (3) false
R.equals({ id: 3, name: 'freddy'}, { id: 3, name: 'freddy', additional: 'item'});
How would I go about enhancing this function, or in some other way produce a true
result for number 3
I would like to ignore all the properties of the rValue
not present in the lValue
, but faithfully compare the rest. I would prefer the recursive nature of equals
remain intact - if that's possible.
I made a simple fiddle that shows the results above.