Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs deep equal with differences

Is there a assertion library that will show me what are the differences between two objects when compared deeply ?

I've tried using chai but it just tells me that the objects are different but not where. Same thing for node's assert....

like image 864
foobarcode Avatar asked Dec 09 '12 23:12

foobarcode


People also ask

Is Deep equal?

deepEqual() method tests if two objects, and their child objects, are equal, using the == operator. If the two objects are not equal, an assertion failure is being caused, and the program is terminated. To compare the objects using the === operator, use the assert.

How do you do deep comparison in JavaScript?

Using the isEqual() method from this library, we can perform a deep comparison between the given operands. It will return a Boolean value indicating whether the operands are equal based on JavaScript strict equality (===) on all attributes of the two given objects.


1 Answers

Substack's difflet is probably what you need

Update: but wait, there is more: https://github.com/andreyvit/json-diff https://github.com/algesten/jsondiff https://github.com/samsonjs/json-diff

like image 108
Andrey Sidorov Avatar answered Oct 20 '22 00:10

Andrey Sidorov