same-value-zero-x v2.1.1
same-value-zero-x
ES6-compliant shim for SameValueZero.
See: 7.2.10 SameValueZero(x, y)
module.exports(x, y)
⇒ boolean ⏏
This method determines whether two values are the same value.
SameValueZero differs from SameValue (Object.is
) only in its treatment
of +0 and -0.
Kind: Exported function
Returns: boolean - A Boolean indicating whether or not the two arguments
are the same value.
Param | Type | Description |
---|---|---|
x | * | The first value to compare. |
y | * | The second value to compare. |
Example
import sameValueZero from 'same-value-zero-x';
console.log(sameValueZero(0, 0)); // true
console.log(sameValueZero(-0, -0)); // true
console.log(sameValueZero(0, -0)); // true
console.log(sameValueZero(NaN, NaN)); //true
console.log(sameValueZero(Infinity, Infinity)); // true
console.log(sameValueZero(-Infinity, -Infinity)); // true
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago