Value equality check with semantics similar to Object.is
, but treats
Immutable Iterable
s as values, equal if the second Iterable
includes
equivalent values.
is(first: any, second: any): boolean
It's used throughout Immutable when checking for equality, including Map
key equality and Set
membership.
var map1 = Immutable.Map({a:1, b:1, c:1});
var map2 = Immutable.Map({a:1, b:1, c:1});
assert(map1 !== map2);
assert(Object.is(map1, map2) === false);
assert(Immutable.is(map1, map2) === true);
Note: Unlike Object.is
, Immutable.is
assumes 0
and -0
are the same
value, matching the behavior of ES6 Map key equality.