aswi2020vldc-gitlab/templetes/node_modules/object-is/index.js @ 4605a44b
1 |
'use strict'; |
---|---|
2 |
|
3 |
// http://www.ecma-international.org/ecma-262/6.0/#sec-object.is
|
4 |
|
5 |
var numberIsNaN = function (value) { |
6 |
return value !== value; |
7 |
};
|
8 |
|
9 |
module.exports = function is(a, b) { |
10 |
if (a === 0 && b === 0) { |
11 |
return 1 / a === 1 / b; |
12 |
}
|
13 |
if (a === b) { |
14 |
return true; |
15 |
}
|
16 |
if (numberIsNaN(a) && numberIsNaN(b)) { |
17 |
return true; |
18 |
}
|
19 |
return false; |
20 |
};
|
21 |
|