isFinite.js.flow 406 B

12345678910111213
  1. // @flow strict
  2. declare function isFinitePolyfill(
  3. value: mixed,
  4. ): boolean %checks(typeof value === 'number');
  5. /* eslint-disable no-redeclare */
  6. // $FlowFixMe[name-already-bound] workaround for: https://github.com/facebook/flow/issues/4441
  7. const isFinitePolyfill =
  8. Number.isFinite ||
  9. function (value) {
  10. return typeof value === 'number' && isFinite(value);
  11. };
  12. export default isFinitePolyfill;