Rebuild dist.

This commit is contained in:
John-David Dalton
2014-03-15 04:02:03 -07:00
parent 07434b19ae
commit e13bf164ea
6 changed files with 327 additions and 406 deletions

129
dist/lodash.js vendored
View File

@@ -595,7 +595,11 @@
/** Used to restore the original `_` reference in `noConflict` */
var oldDash = context._;
/** Used as the maximum value returned by `toLength` */
/**
* Used as the maximum length an array-like object.
* See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
* for more details.
*/
var maxSafeInteger = Math.pow(2, 53) - 1;
/** Used to resolve the internal [[Class]] of values */
@@ -1187,8 +1191,7 @@
iterable = collection,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
length = toLength(length);
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (++index < length) {
if (callback(iterable[index], index, collection) === false) {
break;
@@ -1213,8 +1216,7 @@
var iterable = collection,
length = collection ? collection.length : 0;
if (typeof length == 'number') {
length = toLength(length);
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (length--) {
if (callback(iterable[length], length, collection) === false) {
break;
@@ -1761,9 +1763,9 @@
callback = lodash.createCallback(callback, thisArg, 3);
var index = -1,
length = toLength(collection && collection.length);
length = collection ? collection.length : 0;
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (++index < length) {
var value = collection[index];
setter(result, value, callback(value, index, collection), collection);
@@ -2011,20 +2013,6 @@
return result;
}
/**
* Converts `value` to an integer suitable for use as the length of an array-like
* object. See the [ES6 spec](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength)
* for more details.
*
* @private
* @param {*} value The value to convert.
* @returns {number} Returns the converted integer.
*/
function toLength(value) {
var result = +value || 0;
return result < 0 ? 0 : (result < maxSafeInteger ? result : maxSafeInteger);
}
/*--------------------------------------------------------------------------*/
/**
@@ -3376,10 +3364,10 @@
* // => true
*/
function contains(collection, target, fromIndex) {
var length = toLength(collection && collection.length);
var length = collection ? collection.length : 0;
fromIndex = (typeof fromIndex == 'number' && +fromIndex) || 0;
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
if (typeof collection == 'string' || !isArray(collection) && isString(collection)) {
if (fromIndex >= length) {
return false;
@@ -3488,9 +3476,9 @@
predicate = lodash.createCallback(predicate, thisArg, 3);
var index = -1,
length = toLength(collection && collection.length);
length = collection ? collection.length : 0;
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (++index < length) {
if (!predicate(collection[index], index, collection)) {
return false;
@@ -3549,9 +3537,9 @@
predicate = lodash.createCallback(predicate, thisArg, 3);
var index = -1,
length = toLength(collection && collection.length);
length = collection ? collection.length : 0;
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (++index < length) {
var value = collection[index];
if (predicate(value, index, collection)) {
@@ -3612,13 +3600,27 @@
* // => { 'name': 'fred', 'age': 40, 'blocked': true }
*/
function find(collection, predicate, thisArg) {
var length = toLength(collection && collection.length);
if (length) {
var index = findIndex(collection, predicate, thisArg);
return index > -1 ? collection[index] : undefined;
predicate = lodash.createCallback(predicate, thisArg, 3);
var index = -1,
length = collection ? collection.length : 0;
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (++index < length) {
var value = collection[index];
if (predicate(value, index, collection)) {
return value;
}
}
} else {
var result;
baseEach(collection, function(value, index, collection) {
if (predicate(value, index, collection)) {
result = value;
return false;
}
});
return result;
}
var key = findKey(collection, predicate, thisArg);
return typeof key == 'string' ? collection[key] : undefined;
}
/**
@@ -3642,13 +3644,16 @@
* // => 3
*/
function findLast(collection, predicate, thisArg) {
var length = toLength(collection && collection.length);
if (length) {
var index = findLastIndex(collection, predicate, thisArg);
return index > -1 ? collection[index] : undefined;
}
var key = findLastKey(collection, predicate, thisArg);
return typeof key == 'string' ? collection[key] : undefined;
var result;
predicate = lodash.createCallback(predicate, thisArg, 3);
baseEachRight(collection, function(value, index, collection) {
if (predicate(value, index, collection)) {
result = value;
return false;
}
});
return result;
}
/**
@@ -3679,10 +3684,10 @@
*/
function forEach(collection, callback, thisArg) {
var index = -1,
length = toLength(collection && collection.length);
length = collection ? collection.length : 0;
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (++index < length) {
if (callback(collection[index], index, collection) === false) {
break;
@@ -3712,10 +3717,10 @@
* // => logs each number from right to left and returns '3,2,1'
*/
function forEachRight(collection, callback, thisArg) {
var length = toLength(collection && collection.length);
var length = collection ? collection.length : 0;
callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3);
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (length--) {
if (callback(collection[length], length, collection) === false) {
break;
@@ -3843,7 +3848,8 @@
result = Array(length < 0 ? 0 : length >>> 0);
baseEach(collection, function(value) {
result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
var func = isFunc ? methodName : (value != null && value[methodName]);
result[++index] = func ? func.apply(value, args) : undefined;
});
return result;
}
@@ -3889,10 +3895,10 @@
*/
function map(collection, callback, thisArg) {
var index = -1,
length = toLength(collection && collection.length);
length = collection ? collection.length : 0;
callback = lodash.createCallback(callback, thisArg, 3);
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
var result = Array(length);
while (++index < length) {
result[index] = callback(collection[index], index, collection);
@@ -4161,9 +4167,9 @@
callback = lodash.createCallback(callback, thisArg, 4);
var index = -1,
length = toLength(collection && collection.length);
length = collection ? collection.length : 0;
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
if (noaccum && length) {
accumulator = collection[++index];
}
@@ -4277,7 +4283,7 @@
collection = values(collection);
}
if (n == null || guard) {
var length = toLength(collection && collection.length);
var length = collection ? collection.length : 0;
return length > 0 ? collection[baseRandom(0, length - 1)] : undefined;
}
var result = shuffle(collection);
@@ -4336,7 +4342,9 @@
*/
function size(collection) {
var length = collection ? collection.length : 0;
return typeof length == 'number' && length > -1 ? length : keys(collection).length;
return (typeof length == 'number' && length > -1 && length <= maxSafeInteger)
? length
: keys(collection).length;
}
/**
@@ -4386,9 +4394,9 @@
predicate = lodash.createCallback(predicate, thisArg, 3);
var index = -1,
length = toLength(collection && collection.length);
length = collection ? collection.length : 0;
if (length) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
while (++index < length) {
if (predicate(collection[index], index, collection)) {
return true;
@@ -4497,7 +4505,7 @@
*/
function toArray(collection) {
var length = collection && collection.length;
if (typeof length == 'number' && length > -1) {
if (typeof length == 'number' && length > -1 && length <= maxSafeInteger) {
return slice(collection);
}
return values(collection);
@@ -5254,11 +5262,11 @@
* // => { 'name': 'barney', 'employer': 'slate' }
*/
function assign(object, source, guard) {
if (!object) {
var args = arguments;
if (!object || args.length < 2) {
return object;
}
var args = arguments,
argsIndex = 0,
var argsIndex = 0,
argsLength = args.length,
type = typeof guard;
@@ -5450,7 +5458,10 @@
* _.defaults({ 'name': 'barney' }, { 'name': 'fred', 'employer': 'slate' });
* // => { 'name': 'barney', 'employer': 'slate' }
*/
function defaults() {
function defaults(object) {
if (!object || arguments.length < 2) {
return object;
}
var args = slice(arguments);
args.push(assignDefaults);
return assign.apply(null, args);
@@ -7670,7 +7681,7 @@
*/
function property(key) {
return function(object) {
return object[key];
return object == null ? undefined : object[key];
};
}