mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Bump to v3.10.0.
This commit is contained in:
@@ -3,18 +3,6 @@ define(['../internal/isIterateeCall', '../internal/root', './trim'], function(is
|
||||
/** Used to detect hexadecimal string values. */
|
||||
var reHasHexPrefix = /^0[xX]/;
|
||||
|
||||
/** Used to detect and test for whitespace. */
|
||||
var whitespace = (
|
||||
// Basic whitespace characters.
|
||||
' \t\x0b\f\xa0\ufeff' +
|
||||
|
||||
// Line terminators.
|
||||
'\n\r\u2028\u2029' +
|
||||
|
||||
// Unicode category "Zs" space separators.
|
||||
'\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
|
||||
);
|
||||
|
||||
/* Native method references for those with the same name as other `lodash` methods. */
|
||||
var nativeParseInt = root.parseInt;
|
||||
|
||||
@@ -42,25 +30,16 @@ define(['../internal/isIterateeCall', '../internal/root', './trim'], function(is
|
||||
* // => [6, 8, 10]
|
||||
*/
|
||||
function parseInt(string, radix, guard) {
|
||||
if (guard && isIterateeCall(string, radix, guard)) {
|
||||
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
|
||||
// Chrome fails to trim leading <BOM> whitespace characters.
|
||||
// See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
|
||||
if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
|
||||
radix = 0;
|
||||
} else if (radix) {
|
||||
radix = +radix;
|
||||
}
|
||||
return nativeParseInt(string, radix);
|
||||
}
|
||||
// Fallback for environments with pre-ES5 implementations.
|
||||
if (nativeParseInt(whitespace + '08') != 8) {
|
||||
parseInt = function(string, radix, guard) {
|
||||
// Firefox < 21 and Opera < 15 follow ES3 for `parseInt`.
|
||||
// Chrome fails to trim leading <BOM> whitespace characters.
|
||||
// See https://code.google.com/p/v8/issues/detail?id=3109 for more details.
|
||||
if (guard ? isIterateeCall(string, radix, guard) : radix == null) {
|
||||
radix = 0;
|
||||
} else if (radix) {
|
||||
radix = +radix;
|
||||
}
|
||||
string = trim(string);
|
||||
return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
|
||||
};
|
||||
string = trim(string);
|
||||
return nativeParseInt(string, radix || (reHasHexPrefix.test(string) ? 16 : 10));
|
||||
}
|
||||
|
||||
return parseInt;
|
||||
|
||||
Reference in New Issue
Block a user