Bump to v3.10.0.

This commit is contained in:
John-David Dalton
2015-12-16 17:52:15 -08:00
parent 32393ae520
commit 75c633becb
121 changed files with 1504 additions and 1168 deletions

View File

@@ -1,11 +1,10 @@
define(['../internal/baseToString'], function(baseToString) {
define(['../internal/baseToString', '../internal/escapeRegExpChar'], function(baseToString, escapeRegExpChar) {
/**
* Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special).
* In addition to special characters the forward slash is escaped to allow for
* easier `eval` use and `Function` compilation.
* Used to match `RegExp` [syntax characters](http://ecma-international.org/ecma-262/6.0/#sec-patterns)
* and those outlined by [`EscapeRegExpPattern`](http://ecma-international.org/ecma-262/6.0/#sec-escaperegexppattern).
*/
var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
var reRegExpChars = /^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,
reHasRegExpChars = RegExp(reRegExpChars.source);
/**
@@ -25,8 +24,8 @@ define(['../internal/baseToString'], function(baseToString) {
function escapeRegExp(string) {
string = baseToString(string);
return (string && reHasRegExpChars.test(string))
? string.replace(reRegExpChars, '\\$&')
: string;
? string.replace(reRegExpChars, escapeRegExpChar)
: (string || '(?:)');
}
return escapeRegExp;

View File

@@ -1,11 +1,9 @@
define(['../internal/baseToString', '../internal/createPadding', '../internal/root'], function(baseToString, createPadding, root) {
/** Native method references. */
var ceil = Math.ceil,
floor = Math.floor;
/* Native method references for those with the same name as other `lodash` methods. */
var nativeIsFinite = root.isFinite;
var nativeCeil = Math.ceil,
nativeFloor = Math.floor,
nativeIsFinite = root.isFinite;
/**
* Pads `string` on the left and right sides if it's shorter than `length`.
@@ -38,8 +36,8 @@ define(['../internal/baseToString', '../internal/createPadding', '../internal/ro
return string;
}
var mid = (length - strLength) / 2,
leftLength = floor(mid),
rightLength = ceil(mid);
leftLength = nativeFloor(mid),
rightLength = nativeCeil(mid);
chars = createPadding('', rightLength, chars);
return chars.slice(0, leftLength) + string + chars;

View File

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

View File

@@ -1,10 +1,8 @@
define(['../internal/baseToString', '../internal/root'], function(baseToString, root) {
/** Native method references. */
var floor = Math.floor;
/* Native method references for those with the same name as other `lodash` methods. */
var nativeIsFinite = root.isFinite;
var nativeFloor = Math.floor,
nativeIsFinite = root.isFinite;
/**
* Repeats the given string `n` times.
@@ -39,7 +37,7 @@ define(['../internal/baseToString', '../internal/root'], function(baseToString,
if (n % 2) {
result += string;
}
n = floor(n / 2);
n = nativeFloor(n / 2);
string += string;
} while (n);

View File

@@ -8,7 +8,7 @@ define(['../internal/assignOwnDefaults', '../internal/assignWith', '../utility/a
reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
/** Used to match [ES template delimiters](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components). */
/** Used to match [ES template delimiters](http://ecma-international.org/ecma-262/6.0/#sec-template-literal-lexical-components). */
var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
/** Used to ensure capturing order of template delimiters. */
@@ -119,7 +119,7 @@ define(['../internal/assignOwnDefaults', '../internal/assignWith', '../utility/a
var settings = templateSettings.imports._.templateSettings || templateSettings;
if (otherOptions && isIterateeCall(string, options, otherOptions)) {
options = otherOptions = null;
options = otherOptions = undefined;
}
string = baseToString(string);
options = assignWith(baseAssign({}, otherOptions || options), settings, assignOwnDefaults);

View File

@@ -1,5 +1,8 @@
define(['../internal/baseToString', '../internal/isIterateeCall', '../lang/isObject', '../lang/isRegExp'], function(baseToString, isIterateeCall, isObject, isRegExp) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** Used as default options for `_.trunc`. */
var DEFAULT_TRUNC_LENGTH = 30,
DEFAULT_TRUNC_OMISSION = '...';
@@ -49,7 +52,7 @@ define(['../internal/baseToString', '../internal/isIterateeCall', '../lang/isObj
*/
function trunc(string, options, guard) {
if (guard && isIterateeCall(string, options, guard)) {
options = null;
options = undefined;
}
var length = DEFAULT_TRUNC_LENGTH,
omission = DEFAULT_TRUNC_OMISSION;

View File

@@ -1,5 +1,8 @@
define(['../internal/baseToString', '../internal/isIterateeCall'], function(baseToString, isIterateeCall) {
/** Used as a safe reference for `undefined` in pre-ES5 environments. */
var undefined;
/** Used to match words to create compound words. */
var reWords = (function() {
var upper = '[A-Z\\xc0-\\xd6\\xd8-\\xde]',
@@ -28,7 +31,7 @@ define(['../internal/baseToString', '../internal/isIterateeCall'], function(base
*/
function words(string, pattern, guard) {
if (guard && isIterateeCall(string, pattern, guard)) {
pattern = null;
pattern = undefined;
}
string = baseToString(string);
return string.match(pattern || reWords) || [];