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.

24 lines
539 B

4 years ago
  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;