deepCompare
performs a deep comparison of two objects. It automatically unwraps JS Map
s, Set
s, and ImmutableJS objects.
deepCompare(left, right)
// Will output:
// {
// isEqual: false,
// reason: "left[...] !== right[...]",
// path: ".variables.d4d7eb27b6ed4f3cb061eb56e4bd9b7b.evaluatedExpression.__DEFAULT_SCENARIO__._lookup.0._lookup.0.distribution.histogram.data.0.0.0",
// left: 65656595.47231187,
// right: 55
// }
//
// or:
// {
// isEqual: true
// }
deepCompare
returns as soon as it finds the first difference. It doesn’t collect all the differences.
The return object is either
type ReturnObject = {
isEqual: true;
}
or
type ReturnObject = {
isEqual: false;
reason: string;
// Path to the first field where the comparison found the difference
path: string;
// If the comparison found two properties not === to each other,
// it will return their values
left?: any;
right?: any;
}