mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Avoid unnecessary coercion of radix in _.parseInt.
This commit is contained in:
@@ -9444,7 +9444,11 @@
|
||||
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt` and
|
||||
// Chrome fails to trim leading <BOM> whitespace characters.
|
||||
// See https://code.google.com/p/v8/issues/detail?id=3109.
|
||||
radix = (guard && isIterateeCall(string, radix, guard)) ? 0 : +radix;
|
||||
if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
|
||||
radix = 0;
|
||||
} else if (radix) {
|
||||
radix = +radix;
|
||||
}
|
||||
string = trim(string);
|
||||
return nativeParseInt(string, radix || (reHexPrefix.test(string) ? 16 : 10));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user