https://github.com/xotic750/same-value-zero-x
ES6-compliant shim for SameValueZero.
https://github.com/xotic750/same-value-zero-x
browser ecmascript6 es6 nodejs samevaluezero
Last synced: 10 months ago
JSON representation
ES6-compliant shim for SameValueZero.
- Host: GitHub
- URL: https://github.com/xotic750/same-value-zero-x
- Owner: Xotic750
- License: mit
- Created: 2016-01-22T15:13:29.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:54:30.000Z (about 3 years ago)
- Last Synced: 2025-04-30T20:08:11.741Z (10 months ago)
- Topics: browser, ecmascript6, es6, nodejs, samevaluezero
- Language: JavaScript
- Homepage:
- Size: 1.79 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## same-value-zero-x
ES6-compliant shim for SameValueZero.
**See**: [7.2.10 SameValueZero(x, y)](http://www.ecma-international.org/ecma-262/6.0/#sec-samevaluezero)
### `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**
```js
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
```