_objectIs.js 413 B

1234567891011121314
  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. export default typeof Object.is === 'function' ? Object.is : _objectIs;