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

_baseToNumber.js 539B

123456789101112131415161718192021222324
  1. var isSymbol = require('./isSymbol');
  2. /** Used as references for various `Number` constants. */
  3. var NAN = 0 / 0;
  4. /**
  5. * The base implementation of `_.toNumber` which doesn't ensure correct
  6. * conversions of binary, hexadecimal, or octal string values.
  7. *
  8. * @private
  9. * @param {*} value The value to process.
  10. * @returns {number} Returns the number.
  11. */
  12. function baseToNumber(value) {
  13. if (typeof value == 'number') {
  14. return value;
  15. }
  16. if (isSymbol(value)) {
  17. return NAN;
  18. }
  19. return +value;
  20. }
  21. module.exports = baseToNumber;