same-value-x
v2.1.1
Published
Determines whether two values are the same value.
Downloads
2,250
Maintainers
Readme
same-value-x
Determines whether two values are the same value.
module.exports(value1, value2)
⇒ boolean ⏏
This method is the comparison abstract operation SameValue(x, y), where x and y are ECMAScript language values, produces true or false.
Kind: Exported function
Returns: boolean - A Boolean indicating whether or not the two arguments are
the same value.
| Param | Type | Description | | ------ | --------------- | ---------------------------- | | value1 | * | The first value to compare. | | value2 | * | The second value to compare. |
Example
import sameValue from 'same-value-x';
console.log(sameValue(1, 1)); // true
console.log(sameValue(true, true)); // true
console.log(sameValue(NaN, NaN)); // true
console.log(sameValue(true, false)); // false
console.log(sameValue(0, -0)); // false