You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
793 B

4 years ago
  1. var root = require('./_root');
  2. /* Built-in method references for those with the same name as other `lodash` methods. */
  3. var nativeIsFinite = root.isFinite;
  4. /**
  5. * Checks if `value` is a finite primitive number.
  6. *
  7. * **Note:** This method is based on
  8. * [`Number.isFinite`](https://mdn.io/Number/isFinite).
  9. *
  10. * @static
  11. * @memberOf _
  12. * @since 0.1.0
  13. * @category Lang
  14. * @param {*} value The value to check.
  15. * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
  16. * @example
  17. *
  18. * _.isFinite(3);
  19. * // => true
  20. *
  21. * _.isFinite(Number.MIN_VALUE);
  22. * // => true
  23. *
  24. * _.isFinite(Infinity);
  25. * // => false
  26. *
  27. * _.isFinite('3');
  28. * // => false
  29. */
  30. function isFinite(value) {
  31. return typeof value == 'number' && nativeIsFinite(value);
  32. }
  33. module.exports = isFinite;