8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
isNumber
1 parent 54ae91b commit 7c5e032Copy full SHA for 7c5e032
lodash.js
@@ -10233,15 +10233,12 @@
10233
* // => 3
10234
*/
10235
function toNumber(value) {
10236
- if (!value) {
10237
- return value === 0 ? value : +value;
10238
- }
10239
if (isObject(value)) {
10240
var other = isFunction(value.valueOf) ? value.valueOf() : value;
10241
value = isObject(other) ? (other + '') : other;
10242
}
10243
- if (typeof value == 'number' || !isString(value)) {
10244
- return +value;
+ if (typeof value != 'string') {
+ return value === 0 ? value : +value;
10245
10246
value = value.replace(reTrim, '');
10247
var isBinary = reIsBinary.test(value);
0 commit comments