Bump to v3.10.0.

This commit is contained in:
jdalton
2015-06-14 22:21:45 -07:00
parent 10d5566cf2
commit b97a9a3da0
121 changed files with 1412 additions and 1168 deletions

View File

@@ -1,11 +1,11 @@
var baseToString = require('../internal/baseToString');
var baseToString = require('../internal/baseToString'),
escapeRegExpChar = require('../internal/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 +25,8 @@ var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g,
function escapeRegExp(string) {
string = baseToString(string);
return (string && reHasRegExpChars.test(string))
? string.replace(reRegExpChars, '\\$&')
: string;
? string.replace(reRegExpChars, escapeRegExpChar)
: (string || '(?:)');
}
module.exports = escapeRegExp;

View File

@@ -1,12 +1,10 @@
var baseToString = require('../internal/baseToString'),
createPadding = require('../internal/createPadding');
/** 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 = global.isFinite;
var nativeCeil = Math.ceil,
nativeFloor = Math.floor,
nativeIsFinite = global.isFinite;
/**
* Pads `string` on the left and right sides if it's shorter than `length`.
@@ -39,8 +37,8 @@ function pad(string, length, chars) {
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

@@ -4,18 +4,6 @@ var isIterateeCall = require('../internal/isIterateeCall'),
/** 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 = global.parseInt;
@@ -43,25 +31,16 @@ var nativeParseInt = global.parseInt;
* // => [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));
}
module.exports = parseInt;

View File

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

View File

@@ -16,7 +16,7 @@ var reEmptyStringLeading = /\b__p \+= '';/g,
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. */
@@ -127,7 +127,7 @@ function template(string, options, otherOptions) {
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

@@ -52,7 +52,7 @@ var reFlags = /\w*$/;
*/
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

@@ -29,7 +29,7 @@ var reWords = (function() {
*/
function words(string, pattern, guard) {
if (guard && isIterateeCall(string, pattern, guard)) {
pattern = null;
pattern = undefined;
}
string = baseToString(string);
return string.match(pattern || reWords) || [];