mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Move internal modules to “internal” folder.
This commit is contained in:
24
.internal/baseToNumber.js
Normal file
24
.internal/baseToNumber.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import isSymbol from './isSymbol.js';
|
||||
|
||||
/** Used as references for various `Number` constants. */
|
||||
const 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;
|
||||
Reference in New Issue
Block a user