Rebuild dist.

This commit is contained in:
John-David Dalton
2014-10-24 22:01:39 -07:00
parent 84a84a1687
commit 8bb69cd6da
6 changed files with 272 additions and 6455 deletions

119
dist/lodash.compat.js vendored
View File

@@ -730,7 +730,7 @@
*/
var isHostObject = (function() {
try {
({ 'toString': 0 } + '');
String({ 'toString': 0 } + '');
} catch(e) {
return function() { return false; };
}
@@ -741,23 +741,6 @@
};
}());
/**
* 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.
@@ -1690,7 +1673,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,
@@ -1715,7 +1698,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);
@@ -2160,7 +2143,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) {
@@ -2994,7 +2977,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) {
@@ -3059,7 +3042,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;
@@ -3073,8 +3056,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)] || (!lodash.support.argsClass && isArguments(value)))) || false;
}
/**
@@ -3088,6 +3071,40 @@
return (value && cloneableClasses[toString.call(value)] && !isHostObject(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. `===`.
*
@@ -3261,8 +3278,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);
}
if (lodash.support.unindexedChars && isString(value)) {
@@ -3984,7 +4000,7 @@
* // => [10, 20]
*/
function pullAt(array) {
return basePullAt(array, baseFlatten(arguments, false, false, 1));
return basePullAt(array || [], baseFlatten(arguments, false, false, 1));
}
/**
@@ -4921,9 +4937,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));
@@ -4964,7 +4978,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;
}
@@ -5835,9 +5849,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;
}
/**
@@ -5948,7 +5960,7 @@
multi = iteratee && isArray(iteratee),
result = [];
if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) {
if (isLength(length)) {
result.length = length;
}
if (!multi) {
@@ -5991,7 +6003,7 @@
*/
function toArray(collection) {
var length = collection ? collection.length : 0;
if (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER) {
if (isLength(length)) {
return (lodash.support.unindexedChars && isString(collection))
? collection.split('')
: baseSlice(collection);
@@ -7049,15 +7061,14 @@
*/
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;
}
// fallback for environments without a `[[Class]]` for `arguments` objects
if (!support.argsClass) {
isArguments = function(value) {
var length = (value && typeof value == 'object') ? value.length : undefined;
return (typeof length == 'number' && length > -1 && length <= MAX_SAFE_INTEGER &&
hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee')) || false;
return (isLength(length) && hasOwnProperty.call(value, 'callee') &&
!propertyIsEnumerable.call(value, 'callee')) || false;
};
}
@@ -7182,9 +7193,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;
@@ -8146,7 +8156,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);
@@ -8290,11 +8300,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 = {};
}
@@ -10096,12 +10108,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);