Avoid unnecessary coercion of radix in _.parseInt.

This commit is contained in:
John-David Dalton
2015-01-02 10:57:11 -06:00
parent dff35bc9b7
commit 42eb180b6c

View File

@@ -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));
};