mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
Rebuild dist.
This commit is contained in:
113
dist/lodash.js
vendored
113
dist/lodash.js
vendored
@@ -715,23 +715,6 @@
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the provided arguments are from an iteratee call.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The potential iteratee value argument.
|
||||
* @param {*} index The potential iteratee index or key argument.
|
||||
* @param {*} object The potential iteratee object argument.
|
||||
* @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
|
||||
*/
|
||||
function isIterateeCall(value, index, object) {
|
||||
var indexType = typeof index,
|
||||
objectType = typeof object;
|
||||
|
||||
return (object && (indexType == 'number' || indexType == 'string') &&
|
||||
(objectType == 'function' || objectType == 'object') && object[index] === value) || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by `trimmedLeftIndex` and `trimmedRightIndex` to determine if a
|
||||
* character code is whitespace.
|
||||
@@ -1532,7 +1515,7 @@
|
||||
*/
|
||||
function baseEach(collection, iteratee) {
|
||||
var length = collection ? collection.length : 0;
|
||||
if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) {
|
||||
if (!isLength(length)) {
|
||||
return baseForOwn(collection, iteratee);
|
||||
}
|
||||
var index = -1,
|
||||
@@ -1557,7 +1540,7 @@
|
||||
*/
|
||||
function baseEachRight(collection, iteratee) {
|
||||
var length = collection ? collection.length : 0;
|
||||
if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) {
|
||||
if (!isLength(length)) {
|
||||
return baseForOwnRight(collection, iteratee);
|
||||
}
|
||||
var iterable = toObject(collection);
|
||||
@@ -1998,7 +1981,7 @@
|
||||
length = collection ? collection.length : 0,
|
||||
result = [];
|
||||
|
||||
if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) {
|
||||
if (isLength(length)) {
|
||||
result.length = length;
|
||||
}
|
||||
baseEach(collection, function(value) {
|
||||
@@ -2832,7 +2815,7 @@
|
||||
function initArrayClone(array, isDeep) {
|
||||
var index = -1,
|
||||
length = array.length,
|
||||
result = array.constructor(length);
|
||||
result = new array.constructor(length);
|
||||
|
||||
if (!isDeep) {
|
||||
while (++index < length) {
|
||||
@@ -2893,7 +2876,7 @@
|
||||
return new Ctor(object);
|
||||
|
||||
case regexpClass:
|
||||
result = Ctor(object.source, reFlags.exec(object));
|
||||
result = new Ctor(object.source, reFlags.exec(object));
|
||||
result.lastIndex = object.lastIndex;
|
||||
}
|
||||
return result;
|
||||
@@ -2907,8 +2890,8 @@
|
||||
* @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
|
||||
*/
|
||||
function isArrayLike(value) {
|
||||
return (value && typeof value == 'object' && typeof value.length == 'number' &&
|
||||
arrayLikeClasses[toString.call(value)]) || false;
|
||||
return (value && typeof value == 'object' && isLength(value.length) &&
|
||||
(arrayLikeClasses[toString.call(value)])) || false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2922,6 +2905,40 @@
|
||||
return (value && cloneableClasses[toString.call(value)]) || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the provided arguments are from an iteratee call.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The potential iteratee value argument.
|
||||
* @param {*} index The potential iteratee index or key argument.
|
||||
* @param {*} object The potential iteratee object argument.
|
||||
* @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`.
|
||||
*/
|
||||
function isIterateeCall(value, index, object) {
|
||||
if (!isObject(object)) {
|
||||
return false;
|
||||
}
|
||||
var type = typeof index,
|
||||
prereq = type == 'string';
|
||||
|
||||
if (type == 'number') {
|
||||
var length = object.length;
|
||||
prereq = (isLength(length) && index > -1 && index < length && index % 1 == 0);
|
||||
}
|
||||
return prereq && object[index] === value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is valid array-like length.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
||||
*/
|
||||
function isLength(value) {
|
||||
return typeof value == 'number' && value > -1 && value <= MAX_SAFE_INTEGER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
||||
*
|
||||
@@ -3086,8 +3103,7 @@
|
||||
if (value == null) {
|
||||
return [];
|
||||
}
|
||||
var length = value.length;
|
||||
if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) {
|
||||
if (!isLength(value.length)) {
|
||||
return values(value);
|
||||
}
|
||||
return isObject(value) ? value : Object(value);
|
||||
@@ -3796,7 +3812,7 @@
|
||||
* // => [10, 20]
|
||||
*/
|
||||
function pullAt(array) {
|
||||
return basePullAt(array, baseFlatten(arguments, false, false, 1));
|
||||
return basePullAt(array || [], baseFlatten(arguments, false, false, 1));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4733,9 +4749,7 @@
|
||||
* // => ['fred', 'pebbles']
|
||||
*/
|
||||
function at(collection) {
|
||||
var length = collection ? collection.length : 0;
|
||||
|
||||
if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) {
|
||||
if (!collection || isLength(collection.length)) {
|
||||
collection = toIterable(collection);
|
||||
}
|
||||
return baseAt(collection, baseFlatten(arguments, false, false, 1));
|
||||
@@ -4776,7 +4790,7 @@
|
||||
function contains(collection, target, fromIndex) {
|
||||
var length = collection ? collection.length : 0;
|
||||
|
||||
if (!(typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)) {
|
||||
if (!isLength(length)) {
|
||||
collection = values(collection);
|
||||
length = collection.length;
|
||||
}
|
||||
@@ -5647,9 +5661,7 @@
|
||||
*/
|
||||
function size(collection) {
|
||||
var length = collection ? collection.length : 0;
|
||||
return (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER)
|
||||
? length
|
||||
: keys(collection).length;
|
||||
return isLength(length) ? length : keys(collection).length;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5760,7 +5772,7 @@
|
||||
multi = iteratee && isArray(iteratee),
|
||||
result = [];
|
||||
|
||||
if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) {
|
||||
if (isLength(length)) {
|
||||
result.length = length;
|
||||
}
|
||||
if (!multi) {
|
||||
@@ -5803,7 +5815,7 @@
|
||||
*/
|
||||
function toArray(collection) {
|
||||
var length = collection ? collection.length : 0;
|
||||
if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) {
|
||||
if (isLength(length)) {
|
||||
return baseSlice(collection);
|
||||
}
|
||||
return values(collection);
|
||||
@@ -6859,8 +6871,7 @@
|
||||
*/
|
||||
function isArguments(value) {
|
||||
var length = (value && typeof value == 'object') ? value.length : undefined;
|
||||
return (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER &&
|
||||
toString.call(value) == argsClass) || false;
|
||||
return (isLength(length) && toString.call(value) == argsClass) || false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6984,9 +6995,8 @@
|
||||
return true;
|
||||
}
|
||||
var length = value.length;
|
||||
if ((typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) &&
|
||||
(isArray(value) || isString(value) || isArguments(value) ||
|
||||
(typeof value == 'object' && isFunction(value.splice)))) {
|
||||
if (isLength(length) && (isArray(value) || isString(value) || isArguments(value) ||
|
||||
(typeof value == 'object' && isFunction(value.splice)))) {
|
||||
return !length;
|
||||
}
|
||||
return !keys(value).length;
|
||||
@@ -7915,7 +7925,7 @@
|
||||
* _.merge(food, otherFood, function(a, b) {
|
||||
* return _.isArray(a) ? a.concat(b) : undefined;
|
||||
* });
|
||||
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }
|
||||
* // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] }
|
||||
*/
|
||||
var merge = createAssigner(baseMerge);
|
||||
|
||||
@@ -8059,11 +8069,13 @@
|
||||
|
||||
var isArr = isArrayLike(object);
|
||||
if (accumulator == null) {
|
||||
if (isArr) {
|
||||
accumulator = [];
|
||||
} else if (isObject(object)) {
|
||||
if (isArr || isObject(object)) {
|
||||
var Ctor = object.constructor;
|
||||
accumulator = baseCreate(typeof Ctor == 'function' && Ctor.prototype);
|
||||
if (isArr) {
|
||||
accumulator = isArray(object) ? new Ctor : [];
|
||||
} else {
|
||||
accumulator = baseCreate(typeof Ctor == 'function' && Ctor.prototype);
|
||||
}
|
||||
} else {
|
||||
accumulator = {};
|
||||
}
|
||||
@@ -9865,12 +9877,9 @@
|
||||
isLazy = value instanceof LazyWrapper;
|
||||
|
||||
if (retUnwrapped && !chainAll) {
|
||||
if (isLazy) {
|
||||
return func.apply(value, args);
|
||||
}
|
||||
var otherArgs = [this.value()];
|
||||
push.apply(otherArgs, args);
|
||||
return lodash[methodName].apply(lodash, otherArgs);
|
||||
return isLazy
|
||||
? func.call(value)
|
||||
: lodash[methodName](this.value());
|
||||
}
|
||||
if (isLazy || isArray(value)) {
|
||||
var result = func.apply(isLazy ? value : new LazyWrapper(this), args);
|
||||
|
||||
Reference in New Issue
Block a user