1234567891011121314151617181920212223 |
- /**
- * Check if both arguments are egal.
- */
- function is(x, y){
- // implementation borrowed from harmony:egal spec
- if (x === y) {
- // 0 === -0, but they are not identical
- return x !== 0 || 1 / x === 1 / y;
- }
- // NaN !== NaN, but they are identical.
- // NaNs are the only non-reflexive value, i.e., if x !== x,
- // then x is a NaN.
- // isNaN is broken: it converts its argument to number, so
- // isNaN("foo") => true
- return x !== x && y !== y;
- }
- module.exports = is;
|