Update builds and docs.

Former-commit-id: a09de289c420b76f68efb9471e6e630d07663733
This commit is contained in:
John-David Dalton
2013-06-30 11:03:07 -07:00
parent 9e9bd16b18
commit 9c2151dc37
7 changed files with 279 additions and 270 deletions

View File

@@ -18,6 +18,9 @@
/** Used internally to indicate various things */
var indicatorObject = {};
/** Used to avoid reference errors in `createIterator` */
var iteratorObject = {};
/** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
var keyPrefix = +new Date + '';
@@ -561,7 +564,7 @@
* _.keys({ 'one': 1, 'two': 2, 'three': 3 });
* // => ['one', 'two', 'three'] (order is not guaranteed)
*/
var keys = !nativeKeys ? shimKeys : function(object) {
var keys = iteratorObject.keys = !nativeKeys ? shimKeys : function(object) {
if (!isObject(object)) {
return [];
}
@@ -1497,7 +1500,7 @@
*/
function countBy(collection, callback, thisArg) {
var result = {};
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
forEach(collection, function(value, key, collection) {
key = String(callback(value, key, collection));
@@ -1549,7 +1552,7 @@
*/
function every(collection, callback, thisArg) {
var result = true;
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
var index = -1,
length = collection ? collection.length : 0;
@@ -1610,7 +1613,7 @@
*/
function filter(collection, callback, thisArg) {
var result = [];
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
var index = -1,
length = collection ? collection.length : 0;
@@ -1676,7 +1679,7 @@
* // => { 'name': 'banana', 'organic': true, 'type': 'fruit' }
*/
function find(collection, callback, thisArg) {
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
var index = -1,
length = collection ? collection.length : 0;
@@ -1753,7 +1756,7 @@
var index = -1,
length = collection ? collection.length : 0;
callback = callback && typeof thisArg == 'undefined' ? callback : createCallback(callback, thisArg);
callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg);
if (typeof length == 'number') {
while (++index < length) {
if (callback(collection[index], index, collection) === indicatorObject) {
@@ -1801,7 +1804,7 @@
*/
function groupBy(collection, callback, thisArg) {
var result = {};
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
forEach(collection, function(value, key, collection) {
key = String(callback(value, key, collection));
@@ -1888,7 +1891,7 @@
var index = -1,
length = collection ? collection.length : 0;
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
if (typeof length == 'number') {
var result = Array(length);
while (++index < length) {
@@ -1957,7 +1960,7 @@
}
}
} else {
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
forEach(collection, function(value, index, collection) {
var current = callback(value, index, collection);
@@ -2024,7 +2027,7 @@
}
}
} else {
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
forEach(collection, function(value, index, collection) {
var current = callback(value, index, collection);
@@ -2103,7 +2106,7 @@
function reduce(collection, callback, accumulator, thisArg) {
if (!collection) return accumulator;
var noaccum = arguments.length < 3;
callback = createCallback(callback, thisArg, 4);
callback = lodash.createCallback(callback, thisArg, 4);
var index = -1,
length = collection.length;
@@ -2153,7 +2156,7 @@
var props = keys(collection);
length = props.length;
}
callback = createCallback(callback, thisArg, 4);
callback = lodash.createCallback(callback, thisArg, 4);
forEach(collection, function(value, index, collection) {
index = props ? props[--length] : --length;
accumulator = noaccum
@@ -2203,7 +2206,7 @@
* // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }]
*/
function reject(collection, callback, thisArg) {
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
return filter(collection, function(value, index, collection) {
return !callback(value, index, collection);
});
@@ -2305,7 +2308,7 @@
*/
function some(collection, callback, thisArg) {
var result;
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
var index = -1,
length = collection ? collection.length : 0;
@@ -2364,7 +2367,7 @@
length = collection ? collection.length : 0,
result = Array(typeof length == 'number' ? length : 0);
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
forEach(collection, function(value, key, collection) {
result[++index] = {
'criteria': callback(value, key, collection),
@@ -2559,7 +2562,7 @@
if (typeof callback != 'number' && callback != null) {
var index = -1;
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
while (++index < length && callback(array[index], index, array)) {
n++;
}
@@ -2730,7 +2733,7 @@
if (typeof callback != 'number' && callback != null) {
var index = length;
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
while (index-- && callback(array[index], index, array)) {
n++;
}
@@ -2843,7 +2846,7 @@
if (typeof callback != 'number' && callback != null) {
var index = length;
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
while (index-- && callback(array[index], index, array)) {
n++;
}
@@ -3003,7 +3006,7 @@
index = -1,
length = array ? array.length : 0;
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
while (++index < length && callback(array[index], index, array)) {
n++;
}
@@ -3066,7 +3069,7 @@
high = array ? array.length : low;
// explicitly reference `identity` for better inlining in Firefox
callback = callback ? createCallback(callback, thisArg, 1) : identity;
callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity;
value = callback(value);
while (low < high) {
@@ -3157,7 +3160,7 @@
}
if (callback != null) {
seen = [];
callback = createCallback(callback, thisArg);
callback = lodash.createCallback(callback, thisArg);
}
while (++index < length) {
var value = array[index],
@@ -4445,7 +4448,6 @@
/*--------------------------------------------------------------------------*/
// expose Lo-Dash
// some AMD build optimizers, like r.js, check for specific condition patterns like the following:
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
// Expose Lo-Dash to the global object even when an AMD loader is present in