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.
25 lines
537 B
25 lines
537 B
1 month ago
|
import isSymbol from './isSymbol.js';
|
||
|
|
||
|
/** Used as references for various `Number` constants. */
|
||
|
var NAN = 0 / 0;
|
||
|
|
||
|
/**
|
||
|
* The base implementation of `_.toNumber` which doesn't ensure correct
|
||
|
* conversions of binary, hexadecimal, or octal string values.
|
||
|
*
|
||
|
* @private
|
||
|
* @param {*} value The value to process.
|
||
|
* @returns {number} Returns the number.
|
||
|
*/
|
||
|
function baseToNumber(value) {
|
||
|
if (typeof value == 'number') {
|
||
|
return value;
|
||
|
}
|
||
|
if (isSymbol(value)) {
|
||
|
return NAN;
|
||
|
}
|
||
|
return +value;
|
||
|
}
|
||
|
|
||
|
export default baseToNumber;
|