isEqual
Tests whether two values are equal.
IMPORT
import { isEqual } from "@donedeal0/superdiff";
FORMAT
Input
a: unknown;
b: unknown;
options: { ignoreArrayOrder: boolean }; // false by default
a
: the value to be compared to the valueb
.b
: the value to be compared to the valuea
.ignoreArrayOrder
: if set totrue
,["hello", "world"]
and["world", "hello"]
will be treated asequal
, because the two arrays contain the same values, just in a different order.
Output
boolean
USAGE
Input
isEqual(
[ { name: "joe", age: 99 }, { name: "nina", age: 23 } ],
[ { name: "joe", age: 98 }, { name: "nina", age: 23 } ],
);
Output
false;
Last updated