isInteger.js.flow 440 B

12345678910111213141516
  1. // @flow strict
  2. declare function isInteger(value: mixed): boolean %checks(typeof value ===
  3. 'number');
  4. /* eslint-disable no-redeclare */
  5. // $FlowFixMe[name-already-bound] 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;