main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
415 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
---|
| 2 | function _objectIs(a, b) {
|
---|
| 3 | // SameValue algorithm
|
---|
| 4 | if (a === b) {
|
---|
| 5 | // Steps 1-5, 7-10
|
---|
| 6 | // Steps 6.b-6.e: +0 != -0
|
---|
| 7 | return a !== 0 || 1 / a === 1 / b;
|
---|
| 8 | } else {
|
---|
| 9 | // Step 6.a: NaN == NaN
|
---|
| 10 | return a !== a && b !== b;
|
---|
| 11 | }
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | module.exports = typeof Object.is === 'function' ? Object.is : _objectIs; |
---|
Note:
See
TracBrowser
for help on using the repository browser.