isInteger.js.flow 420 B

1234567891011121314151617
  1. // @flow strict
  2. declare function isInteger(value: mixed): boolean %checks(typeof value ===
  3. 'number');
  4. /* eslint-disable no-redeclare */
  5. // $FlowFixMe workaround for: https://github.com/facebook/flow/issues/4441
  6. const isInteger =
  7. Number.isInteger ||
  8. function(value) {
  9. return (
  10. typeof value === 'number' &&
  11. isFinite(value) &&
  12. Math.floor(value) === value
  13. );
  14. };
  15. export default isInteger;