25 lines
694 B
JavaScript
25 lines
694 B
JavaScript
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @flow
|
|
*/
|
|
|
|
/**
|
|
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
|
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
|
*/
|
|
function is(x: any, y: any) {
|
|
return (
|
|
(x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y) // eslint-disable-line no-self-compare
|
|
);
|
|
}
|
|
|
|
const objectIs: (x: any, y: any) => boolean =
|
|
// $FlowFixMe[method-unbinding]
|
|
typeof Object.is === 'function' ? Object.is : is;
|
|
|
|
export default objectIs;
|