Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

isInteger.js 669B

123456789101112131415161718192021222324252627282930313233
  1. var toInteger = require('./toInteger');
  2. /**
  3. * Checks if `value` is an integer.
  4. *
  5. * **Note:** This method is based on
  6. * [`Number.isInteger`](https://mdn.io/Number/isInteger).
  7. *
  8. * @static
  9. * @memberOf _
  10. * @since 4.0.0
  11. * @category Lang
  12. * @param {*} value The value to check.
  13. * @returns {boolean} Returns `true` if `value` is an integer, else `false`.
  14. * @example
  15. *
  16. * _.isInteger(3);
  17. * // => true
  18. *
  19. * _.isInteger(Number.MIN_VALUE);
  20. * // => false
  21. *
  22. * _.isInteger(Infinity);
  23. * // => false
  24. *
  25. * _.isInteger('3');
  26. * // => false
  27. */
  28. function isInteger(value) {
  29. return typeof value == 'number' && value == toInteger(value);
  30. }
  31. module.exports = isInteger;