is
is copied to clipboard
Feature request: isNegativeZero
function negativeZero(val: unknown): val is 0 {
return is.number(val) && val === 0 && 1 / val === -Infinity;
}
(Type-level typescript doesn't differentiate between +0 and -0; JS runtime does, if you look closely enough.)
Object.is(value, -0) is the easiest way to do. Not sure it's worth adding here as you should almost never have to care about -0 in practice.
Didn't think of that! Tyvm.