mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 19:07:49 +00:00
Rebuild dist.
This commit is contained in:
112
dist/lodash.js
vendored
112
dist/lodash.js
vendored
@@ -78,7 +78,7 @@
|
||||
var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
|
||||
|
||||
/** Used to match words to create compound words */
|
||||
var reWords = /[a-zA-Z0-9][a-z0-9]*/g;
|
||||
var reWords = /[A-Z]{2,}|[a-zA-Z0-9][a-z0-9]*/g;
|
||||
|
||||
/** Used to detect and test whitespace */
|
||||
var whitespace = (
|
||||
@@ -255,7 +255,7 @@
|
||||
* @returns {number} Returns the index of the matched value, else `-1`.
|
||||
*/
|
||||
function baseIndexOf(array, value, fromIndex) {
|
||||
var index = (fromIndex || 0) - 1,
|
||||
var index = (fromIndex | 0) - 1,
|
||||
length = array ? array.length : 0;
|
||||
|
||||
while (++index < length) {
|
||||
@@ -855,8 +855,8 @@
|
||||
// avoid `arguments` object use disqualifying optimizations by
|
||||
// converting it to an array before passing it to `composeArgs`
|
||||
var index = -1,
|
||||
length = arguments.length,
|
||||
args = Array(length);
|
||||
length = arguments.length,
|
||||
args = Array(length);
|
||||
|
||||
while (++index < length) {
|
||||
args[index] = arguments[index];
|
||||
@@ -1172,6 +1172,7 @@
|
||||
length = collection ? collection.length : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
length |= 0;
|
||||
while (++index < length) {
|
||||
if (callback(iterable[index], index, collection) === false) {
|
||||
break;
|
||||
@@ -1197,6 +1198,7 @@
|
||||
length = collection ? collection.length : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
length = (length |= 0) < 0 ? 0 : length;
|
||||
while (length--) {
|
||||
if (callback(iterable[length], length, collection) === false) {
|
||||
break;
|
||||
@@ -1220,7 +1222,7 @@
|
||||
* @returns {Array} Returns the new flattened array.
|
||||
*/
|
||||
function baseFlatten(array, isShallow, isStrict, fromIndex) {
|
||||
var index = (fromIndex || 0) - 1,
|
||||
var index = (fromIndex | 0) - 1,
|
||||
length = array ? array.length : 0,
|
||||
result = [];
|
||||
|
||||
@@ -1743,9 +1745,9 @@
|
||||
callback = lodash.createCallback(callback, thisArg, 3);
|
||||
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0;
|
||||
length = collection ? collection.length | 0 : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
while (++index < length) {
|
||||
var value = collection[index];
|
||||
setter(result, value, callback(value, index, collection), collection);
|
||||
@@ -1790,7 +1792,7 @@
|
||||
*/
|
||||
function createPad(string, length, chars) {
|
||||
var strLength = string.length;
|
||||
length = +length || 0;
|
||||
length |= 0;
|
||||
|
||||
if (strLength >= length) {
|
||||
return '';
|
||||
@@ -2324,7 +2326,7 @@
|
||||
return array ? array[0] : undefined;
|
||||
}
|
||||
}
|
||||
return slice(array, 0, n > 0 ? n : 0);
|
||||
return slice(array, 0, n < 0 ? 0 : n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2421,7 +2423,7 @@
|
||||
function indexOf(array, value, fromIndex) {
|
||||
var length = array ? array.length : 0;
|
||||
if (typeof fromIndex == 'number') {
|
||||
fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : (fromIndex || 0);
|
||||
fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) | 0;
|
||||
} else if (fromIndex) {
|
||||
var index = sortedIndex(array, value);
|
||||
return (length && array[index] === value) ? index : -1;
|
||||
@@ -2457,7 +2459,7 @@
|
||||
n = (predicate == null || thisArg) ? 1 : predicate;
|
||||
}
|
||||
n = length - n;
|
||||
return slice(array, 0, n > 0 ? n : 0);
|
||||
return slice(array, 0, n < 0 ? 0 : n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2551,7 +2553,7 @@
|
||||
}
|
||||
}
|
||||
n = length - n;
|
||||
return slice(array, n > 0 ? n : 0);
|
||||
return slice(array, n < 0 ? 0 : n);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2578,6 +2580,7 @@
|
||||
function lastIndexOf(array, value, fromIndex) {
|
||||
var index = array ? array.length : 0;
|
||||
if (typeof fromIndex == 'number') {
|
||||
fromIndex |= 0;
|
||||
index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;
|
||||
}
|
||||
while (index--) {
|
||||
@@ -2753,7 +2756,7 @@
|
||||
} else if (predicate == null || thisArg) {
|
||||
n = 1;
|
||||
} else {
|
||||
n = predicate > 0 ? predicate : 0;
|
||||
n = predicate < 0 ? 0 : predicate;
|
||||
}
|
||||
return slice(array, n);
|
||||
}
|
||||
@@ -2790,7 +2793,7 @@
|
||||
} else if (end > length) {
|
||||
end = length;
|
||||
}
|
||||
length = end - start || 0;
|
||||
length = (length = (end - start) | 0) < 0 ? 0 : length;
|
||||
|
||||
var result = Array(length);
|
||||
while (++index < length) {
|
||||
@@ -3402,9 +3405,10 @@
|
||||
*/
|
||||
function contains(collection, target, fromIndex) {
|
||||
var length = collection ? collection.length : 0;
|
||||
fromIndex = typeof fromIndex == 'number' ? fromIndex : 0;
|
||||
fromIndex = typeof fromIndex == 'number' ? fromIndex | 0 : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
length = (length |= 0) < 0 ? 0 : length;
|
||||
if (fromIndex >= length) {
|
||||
return false;
|
||||
}
|
||||
@@ -3414,7 +3418,7 @@
|
||||
: collection.indexOf(target, fromIndex) > -1;
|
||||
}
|
||||
var indexOf = getIndexOf();
|
||||
fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
|
||||
fromIndex = fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex;
|
||||
return indexOf(collection, target, fromIndex) > -1;
|
||||
}
|
||||
var index = -1,
|
||||
@@ -3513,9 +3517,9 @@
|
||||
|
||||
predicate = lodash.createCallback(predicate, thisArg, 3);
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0;
|
||||
length = collection ? collection.length | 0 : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
while (++index < length) {
|
||||
if (!predicate(collection[index], index, collection)) {
|
||||
return false;
|
||||
@@ -3574,9 +3578,9 @@
|
||||
|
||||
predicate = lodash.createCallback(predicate, thisArg, 3);
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0;
|
||||
length = collection ? collection.length | 0 : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
while (++index < length) {
|
||||
var value = collection[index];
|
||||
if (predicate(value, index, collection)) {
|
||||
@@ -3639,9 +3643,9 @@
|
||||
function find(collection, predicate, thisArg) {
|
||||
predicate = lodash.createCallback(predicate, thisArg, 3);
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0;
|
||||
length = collection ? collection.length | 0 : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
while (++index < length) {
|
||||
var value = collection[index];
|
||||
if (predicate(value, index, collection)) {
|
||||
@@ -3721,10 +3725,10 @@
|
||||
*/
|
||||
function forEach(collection, callback, thisArg) {
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0;
|
||||
length = collection ? collection.length | 0 : 0;
|
||||
|
||||
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
while (++index < length) {
|
||||
if (callback(collection[index], index, collection) === false) {
|
||||
break;
|
||||
@@ -3754,10 +3758,10 @@
|
||||
* // => logs each number from right to left and returns '3,2,1'
|
||||
*/
|
||||
function forEachRight(collection, callback, thisArg) {
|
||||
var length = collection ? collection.length : 0;
|
||||
var length = collection ? collection.length | 0 : 0;
|
||||
|
||||
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
while (length--) {
|
||||
if (callback(collection[length], length, collection) === false) {
|
||||
break;
|
||||
@@ -3881,8 +3885,8 @@
|
||||
var args = slice(arguments, 2),
|
||||
index = -1,
|
||||
isFunc = typeof methodName == 'function',
|
||||
length = collection ? collection.length : 0,
|
||||
result = Array(typeof length == 'number' ? length : 0);
|
||||
length = collection ? collection.length | 0 : 0,
|
||||
result = Array(length < 0 ? 0 : length);
|
||||
|
||||
baseEach(collection, function(value) {
|
||||
result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
|
||||
@@ -3931,10 +3935,10 @@
|
||||
*/
|
||||
function map(collection, callback, thisArg) {
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0;
|
||||
length = collection ? collection.length | 0 : 0;
|
||||
|
||||
callback = lodash.createCallback(callback, thisArg, 3);
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
var result = Array(length);
|
||||
while (++index < length) {
|
||||
result[index] = callback(collection[index], index, collection);
|
||||
@@ -4203,9 +4207,9 @@
|
||||
callback = lodash.createCallback(callback, thisArg, 4);
|
||||
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0;
|
||||
length = collection ? collection.length | 0 : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
if (noaccum && length) {
|
||||
accumulator = collection[++index];
|
||||
}
|
||||
@@ -4319,7 +4323,8 @@
|
||||
collection = values(collection);
|
||||
}
|
||||
if (n == null || guard) {
|
||||
return collection ? collection[baseRandom(0, collection.length - 1)] : undefined;
|
||||
var length = collection ? collection.length | 0 : 0;
|
||||
return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
|
||||
}
|
||||
var result = shuffle(collection);
|
||||
result.length = nativeMin(nativeMax(0, n), result.length);
|
||||
@@ -4343,8 +4348,8 @@
|
||||
*/
|
||||
function shuffle(collection) {
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0,
|
||||
result = Array(typeof length == 'number' ? length : 0);
|
||||
length = collection ? collection.length | 0 : 0,
|
||||
result = Array(length < 0 ? 0 : length);
|
||||
|
||||
baseEach(collection, function(value) {
|
||||
var rand = baseRandom(0, ++index);
|
||||
@@ -4377,7 +4382,7 @@
|
||||
*/
|
||||
function size(collection) {
|
||||
var length = collection ? collection.length : 0;
|
||||
return typeof length == 'number' ? length : keys(collection).length;
|
||||
return typeof length == 'number' && length > -1 ? length : keys(collection).length;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4427,9 +4432,9 @@
|
||||
|
||||
predicate = lodash.createCallback(predicate, thisArg, 3);
|
||||
var index = -1,
|
||||
length = collection ? collection.length : 0;
|
||||
length = collection ? collection.length | 0 : 0;
|
||||
|
||||
if (typeof length == 'number') {
|
||||
if (length > 0) {
|
||||
while (++index < length) {
|
||||
if (predicate(collection[index], index, collection)) {
|
||||
return true;
|
||||
@@ -4495,8 +4500,8 @@
|
||||
function sortBy(collection, callback, thisArg) {
|
||||
var index = -1,
|
||||
multi = callback && isArray(callback),
|
||||
length = collection ? collection.length : 0,
|
||||
result = Array(typeof length == 'number' ? length : 0);
|
||||
length = collection ? collection.length | 0 : 0,
|
||||
result = Array(length < 0 ? 0 : length);
|
||||
|
||||
if (!multi) {
|
||||
callback = lodash.createCallback(callback, thisArg, 3);
|
||||
@@ -4537,7 +4542,8 @@
|
||||
* // => [2, 3, 4]
|
||||
*/
|
||||
function toArray(collection) {
|
||||
if (collection && typeof collection.length == 'number') {
|
||||
var length = collection && collection.length;
|
||||
if (typeof length == 'number' && length > -1) {
|
||||
return slice(collection);
|
||||
}
|
||||
return values(collection);
|
||||
@@ -4866,7 +4872,7 @@
|
||||
if (!isFunction(func)) {
|
||||
throw new TypeError;
|
||||
}
|
||||
wait = wait > 0 ? wait : 0;
|
||||
wait = wait < 0 ? 0 : wait;
|
||||
if (options === true) {
|
||||
var leading = true;
|
||||
trailing = false;
|
||||
@@ -6750,7 +6756,7 @@
|
||||
target = String(target);
|
||||
|
||||
var length = string.length;
|
||||
position = (typeof position == 'number' ? nativeMin(nativeMax(position, 0), length) : length) - target.length;
|
||||
position = (typeof position == 'number' ? nativeMin(nativeMax(position | 0, 0), length) : length) - target.length;
|
||||
return position >= 0 && string.indexOf(target, position) == position;
|
||||
}
|
||||
|
||||
@@ -6847,7 +6853,7 @@
|
||||
*/
|
||||
function pad(string, length, chars) {
|
||||
string = string == null ? '' : String(string);
|
||||
length = +length || 0;
|
||||
length |= 0;
|
||||
|
||||
var strLength = string.length;
|
||||
if (strLength >= length) {
|
||||
@@ -6939,7 +6945,7 @@
|
||||
*/
|
||||
function repeat(string, n) {
|
||||
var result = '';
|
||||
n = +n || 0;
|
||||
n |= 0;
|
||||
|
||||
if (n < 1 || string == null) {
|
||||
return result;
|
||||
@@ -6951,7 +6957,7 @@
|
||||
}
|
||||
n = floor(n / 2);
|
||||
string += string;
|
||||
} while (n > 0);
|
||||
} while (n);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -7003,7 +7009,7 @@
|
||||
*/
|
||||
function startsWith(string, target, position) {
|
||||
string = string == null ? '' : String(string);
|
||||
position = typeof position == 'number' ? nativeMin(nativeMax(position, 0), string.length) : 0;
|
||||
position = typeof position == 'number' ? nativeMin(nativeMax(position | 0, 0), string.length) : 0;
|
||||
return string.lastIndexOf(target, position) == position;
|
||||
}
|
||||
|
||||
@@ -7309,11 +7315,11 @@
|
||||
|
||||
if (options && isObject(options)) {
|
||||
var separator = 'separator' in options ? options.separator : separator;
|
||||
length = 'length' in options ? +options.length || 0 : length;
|
||||
length = 'length' in options ? options.length | 0 : length;
|
||||
omission = 'omission' in options ? String(options.omission) : omission;
|
||||
}
|
||||
else if (options != null) {
|
||||
length = +options || 0;
|
||||
length = options | 0;
|
||||
}
|
||||
string = string == null ? '' : String(string);
|
||||
if (length >= string.length) {
|
||||
@@ -7487,14 +7493,14 @@
|
||||
*/
|
||||
function matches(source) {
|
||||
source || (source = {});
|
||||
|
||||
var props = keys(source),
|
||||
propsLength = props.length,
|
||||
key = props[0],
|
||||
a = source[key];
|
||||
|
||||
// fast path the common case of providing an object with a single
|
||||
// property containing a primitive value
|
||||
if (props.length == 1 && a === a && !isObject(a)) {
|
||||
if (propsLength == 1 && a === a && !isObject(a)) {
|
||||
return function(object) {
|
||||
if (!hasOwnProperty.call(object, key)) {
|
||||
return false;
|
||||
@@ -7505,13 +7511,13 @@
|
||||
};
|
||||
}
|
||||
return function(object) {
|
||||
var length = props.length,
|
||||
var length = propsLength,
|
||||
result = false;
|
||||
|
||||
while (length--) {
|
||||
var key = props[length];
|
||||
if (!(result = hasOwnProperty.call(object, key) &&
|
||||
baseIsEqual(object[key], source[key], null, true))) {
|
||||
baseIsEqual(object[key], source[key], null, true))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user