| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | * |
| 7 | * @flow |
| 8 | */ |
| 9 | |
| 10 | /** |
| 11 | * inlined Object.is polyfill to avoid requiring consumers ship their own |
| 12 | * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is |
| 13 | */ |
| 14 | function is(x: any, y: any) { |
| 15 | return ( |
| 16 | (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare |
| 17 | ); |
| 18 | } |
| 19 | |
| 20 | const objectIs: (x: any, y: any) => boolean = |
| 21 | // $FlowFixMe[method-unbinding] |
| 22 | typeof Object.is === 'function' ? Object.is : is; |
| 23 | |
| 24 | export default objectIs; |