main
Last change
on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
539 bytes
|
Rev | Line | |
---|
[79a0317] | 1 | var isSymbol = require('./isSymbol');
|
---|
| 2 |
|
---|
| 3 | /** Used as references for various `Number` constants. */
|
---|
| 4 | var NAN = 0 / 0;
|
---|
| 5 |
|
---|
| 6 | /**
|
---|
| 7 | * The base implementation of `_.toNumber` which doesn't ensure correct
|
---|
| 8 | * conversions of binary, hexadecimal, or octal string values.
|
---|
| 9 | *
|
---|
| 10 | * @private
|
---|
| 11 | * @param {*} value The value to process.
|
---|
| 12 | * @returns {number} Returns the number.
|
---|
| 13 | */
|
---|
| 14 | function baseToNumber(value) {
|
---|
| 15 | if (typeof value == 'number') {
|
---|
| 16 | return value;
|
---|
| 17 | }
|
---|
| 18 | if (isSymbol(value)) {
|
---|
| 19 | return NAN;
|
---|
| 20 | }
|
---|
| 21 | return +value;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | module.exports = baseToNumber;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.