node-sameValuesAs
A very relaxed 'deep equals' that allows for any order in arrays, even if array values are objects.
This is a quick hack on https://www.npmjs.org/package/deep-equal and is probably full of bugs and strange behaviours
Usage
var compare = compare; ; // throws an exception telling you what the first difference is ; // returns true with no exception
Features
- Considers
null
andundefined
to be equal - Compares the contents of arrays regardless of order (even if the children are objects)
- Throws an error if the objects don't match and tells you the first difference, with a path in the object.
- Tries to compare dates in a relaxed way (including where they are in strings or tick values)
- Considers a property with an empty array to equal a missing property
That last one should be explained:
"one": 234 "optional":
is considered to be equal to
"one": 234
but not equal to
"one": 234 "optional": null