From d24d83d52abe7893edeae733547ddb0e1a774189 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 30 Apr 2013 09:12:57 -0700 Subject: [PATCH 001/117] Ensure remove of the "exit early" feature is handled properly when mixing `lodash` methods into the `underscore` build. Former-commit-id: 973c3e188076ca4403f59684b82bee3049370d5a --- build.js | 78 ++++++++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/build.js b/build.js index 5f7fd42a5e..097ae0f3ea 100755 --- a/build.js +++ b/build.js @@ -2074,7 +2074,7 @@ ' result = indexOf(collection, target) > -1;', ' } else {', ' each(collection, function(value) {', - ' return (result = value === target) && indicatorObject;', + ' return !(result = value === target);', ' });', ' }', ' return result;', @@ -2298,14 +2298,14 @@ ' forIn(b, function(value, key, b) {', ' if (hasOwnProperty.call(b, key)) {', ' size++;', - ' return !(result = hasOwnProperty.call(a, key) && isEqual(a[key], value, stackA, stackB)) && indicatorObject;', + ' return (result = hasOwnProperty.call(a, key) && isEqual(a[key], value, stackA, stackB));', ' }', ' });', '', ' if (result) {', ' forIn(a, function(value, key, a) {', ' if (hasOwnProperty.call(a, key)) {', - ' return !(result = --size > -1) && indicatorObject;', + ' return (result = --size > -1);', ' }', ' });', ' }', @@ -2545,48 +2545,34 @@ source = removeFunction(source, 'slice'); source = source.replace(/([^.])\bslice\(/g, '$1nativeSlice.call('); - // remove `_.isEqual` use from `createCallback` - source = source.replace(matchFunction(source, 'createCallback'), function(match) { - return match.replace(/\bisEqual\(([^,]+), *([^,]+)[^)]+\)/, '$1 === $2'); - }); - // remove conditional `charCodeCallback` use from `_.max` and `_.min` _.each(['max', 'min'], function(methodName) { - source = source.replace(matchFunction(source, methodName), function(match) { - return match.replace(/=.+?callback *&& *isString[^:]+:\s*/g, '= '); - }); + if (!useLodashMethod(methodName)) { + source = source.replace(matchFunction(source, methodName), function(match) { + return match.replace(/=.+?callback *&& *isString[^:]+:\s*/g, '= '); + }); + } }); - // modify `_.every`, `_.find`, `_.isEqual`, and `_.some` to use the private `indicatorObject` - _.each(['every', 'isEqual'], function(methodName) { - source = source.replace(matchFunction(source, methodName), function(match) { + // modify `_.isEqual` and `shimIsPlainObject` to use the private `indicatorObject` + if (!useLodashMethod('forIn')) { + source = source.replace(matchFunction(source, 'isEqual'), function(match) { return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); }); - }); - - source = source.replace(matchFunction(source, 'find'), function(match) { - return match.replace(/return false/, 'return indicatorObject'); - }); - - source = source.replace(matchFunction(source, 'some'), function(match) { - return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;'); - }); - - + source = source.replace(matchFunction(source, 'shimIsPlainObject'), function(match) { + return match.replace(/return false/, 'return indicatorObject'); + }); + } // remove unneeded variables if (!useLodashMethod('clone') && !useLodashMethod('cloneDeep')) { source = removeVar(source, 'cloneableClasses'); source = removeVar(source, 'ctorByClass'); } - // remove chainability from `each` and `_.forEach` - if (!useLodashMethod('forEach')) { - _.each(['each', 'forEach'], function(methodName) { - source = source.replace(matchFunction(source, methodName), function(match) { - return match - .replace(/\n *return .+?([};\s]+)$/, '$1') - .replace(/\b(return) +result\b/, '$1') - }); + // remove `_.isEqual` use from `createCallback` + if (!useLodashMethod('where')) { + source = source.replace(matchFunction(source, 'createCallback'), function(match) { + return match.replace(/\bisEqual\(([^,]+), *([^,]+)[^)]+\)/, '$1 === $2'); }); } // remove unused features from `createBound` @@ -2667,6 +2653,22 @@ .replace(/\beach(?=\(collection)/g, 'forOwn') .replace(/\beach(?=\(\[)/g, 'forEach'); } + // modify `_.contains`, `_.every`, `_.find`, and `_.some` to use the private `indicatorObject` + if (isUnderscore && (/\beach\(/.test(source) || !useLodashMethod('forOwn'))) { + source = source.replace(matchFunction(source, 'every'), function(match) { + return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); + }); + + source = source.replace(matchFunction(source, 'find'), function(match) { + return match.replace(/return false/, 'return indicatorObject'); + }); + + _.each(['contains', 'some'], function(methodName) { + source = source.replace(matchFunction(source, methodName), function(match) { + return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;'); + }); + }); + } var context = vm.createContext({ 'clearTimeout': clearTimeout, @@ -2739,6 +2741,16 @@ if (!useLodashMethod('createCallback')) { source = source.replace(/\blodash\.(createCallback\()\b/g, '$1'); } + // remove chainability from `each` and `_.forEach` + if (!useLodashMethod('forEach')) { + _.each(['each', 'forEach'], function(methodName) { + source = source.replace(matchFunction(source, methodName), function(match) { + return match + .replace(/\n *return .+?([};\s]+)$/, '$1') + .replace(/\b(return) +result\b/, '$1') + }); + }); + } // remove `_.assign`, `_.forIn`, `_.forOwn`, `_.isPlainObject`, and `_.zipObject` assignments (function() { var snippet = getMethodAssignments(source), From 8f94bd1fbdf23e03326c1197c0bd029f3c1af1a2 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 30 Apr 2013 09:18:26 -0700 Subject: [PATCH 002/117] Reduce `_.unzip` and `_.zip`. Former-commit-id: f388c50817910eee510f33b22fd4904fd648a6f0 --- build.js | 2 +- lodash.js | 21 ++++----------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/build.js b/build.js index 097ae0f3ea..eca0164cb0 100755 --- a/build.js +++ b/build.js @@ -176,7 +176,7 @@ 'where': ['filter'], 'without': ['difference'], 'wrap': [], - 'zip': ['max', 'pluck'], + 'zip': ['unzip'], 'zipObject': [], // method used by the `backbone` and `underscore` builds diff --git a/lodash.js b/lodash.js index 65069f0f38..3a22ac98be 100644 --- a/lodash.js +++ b/lodash.js @@ -4106,17 +4106,11 @@ */ function unzip(array) { var index = -1, - length = array ? array.length : 0, - tupleLength = length ? max(pluck(array, 'length')) : 0, - result = Array(tupleLength); + length = array ? max(pluck(array, 'length')) : 0, + result = Array(length < 0 ? 0 : length); while (++index < length) { - var tupleIndex = -1, - tuple = array[index]; - - while (++tupleIndex < tupleLength) { - (result[tupleIndex] || (result[tupleIndex] = Array(length)))[index] = tuple[tupleIndex]; - } + result[index] = pluck(array, index); } return result; } @@ -4157,14 +4151,7 @@ * // => [['moe', 30, true], ['larry', 40, false]] */ function zip(array) { - var index = -1, - length = array ? max(pluck(arguments, 'length')) : 0, - result = Array(length); - - while (++index < length) { - result[index] = pluck(arguments, index); - } - return result; + return array ? unzip(arguments) : []; } /** From e773efdc59c830e904375eec43ac23d95e17d9e7 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 1 May 2013 09:03:52 -0700 Subject: [PATCH 003/117] Ensure `_.debounce` with `leading` and `trailing` will call the `func` on the leading edge after a trailing call is performed. [closes #257] Former-commit-id: 97afe842b2b4c3eb20c9557298e01ec268386ea2 --- lodash.js | 9 ++++++--- test/test.js | 15 ++++++++++++--- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lodash.js b/lodash.js index 3a22ac98be..99435a94b1 100644 --- a/lodash.js +++ b/lodash.js @@ -4482,6 +4482,7 @@ */ function debounce(func, wait, options) { var args, + calledTwice, inited, result, thisArg, @@ -4489,8 +4490,9 @@ trailing = true; function delayed() { - inited = timeoutId = null; - if (trailing) { + var callTrailing = trailing && ((leading && calledTwice) || !leading); + calledTwice = inited = timeoutId = null; + if (callTrailing) { result = func.apply(thisArg, args); } } @@ -4510,8 +4512,9 @@ inited = true; result = func.apply(thisArg, args); } else { - timeoutId = setTimeout(delayed, wait); + calledTwice = true; } + timeoutId = setTimeout(delayed, wait); return result; }; } diff --git a/test/test.js b/test/test.js index 11b23cb1b9..4ba65ce10d 100644 --- a/test/test.js +++ b/test/test.js @@ -558,14 +558,19 @@ }); asyncTest('should work with `leading` option', function() { - var counts = [0, 0, 0]; + var withLeadingAndTrailing, + counts = [0, 0, 0]; + _.each([true, { 'leading': true }], function(options, index) { - var withLeading = _.debounce(function(value) { + var debounced = _.debounce(function(value) { counts[index]++; return value; }, 32, options); - equal(withLeading('x'), 'x'); + if (index == 1) { + withLeadingAndTrailing = debounced; + } + equal(debounced('x'), 'x'); }); _.times(2, _.debounce(function() { counts[2]++; }, 32, { 'leading': true })); @@ -578,6 +583,10 @@ setTimeout(function() { deepEqual(counts, [1, 1, 2]); + + withLeadingAndTrailing('x'); + equal(counts[1], 2); + QUnit.start(); }, 64); }); From 9ae24141a3e166b2c4ad1f179a13293c2acff707 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 2 May 2013 00:06:55 -0700 Subject: [PATCH 004/117] Cleanup `_.debounce`. Former-commit-id: 0212c6b31222a8e215d6f60e906fbad074f424a9 --- lodash.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lodash.js b/lodash.js index 99435a94b1..a111b5c41f 100644 --- a/lodash.js +++ b/lodash.js @@ -4482,17 +4482,16 @@ */ function debounce(func, wait, options) { var args, - calledTwice, - inited, result, thisArg, timeoutId, + callCount = 0, trailing = true; function delayed() { - var callTrailing = trailing && ((leading && calledTwice) || !leading); - calledTwice = inited = timeoutId = null; - if (callTrailing) { + var isCalled = trailing && (!leading || callCount > 1); + callCount = timeoutId = 0; + if (isCalled) { result = func.apply(thisArg, args); } } @@ -4508,11 +4507,8 @@ thisArg = this; clearTimeout(timeoutId); - if (!inited && leading) { - inited = true; + if (leading && ++callCount < 2) { result = func.apply(thisArg, args); - } else { - calledTwice = true; } timeoutId = setTimeout(delayed, wait); return result; From bdac8974d8f43acb6ef6935a9092344ffc0b603d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 3 May 2013 08:33:51 -0700 Subject: [PATCH 005/117] Realign `_.assign` and `_.defaults` with ES6 `Object.assign`. [closes #259] Former-commit-id: e8c89e4a130ed286ce07e1a2e848f50b182effae --- lodash.js | 1 + test/test.js | 22 ++++++++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/lodash.js b/lodash.js index a111b5c41f..8e51b8255e 100644 --- a/lodash.js +++ b/lodash.js @@ -585,6 +585,7 @@ 'while (++argsIndex < argsLength) {\n' + ' iterable = args[argsIndex];\n' + ' if (iterable && objectTypes[typeof iterable]) {', + 'arrays': false, 'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]", 'bottom': ' }\n}' }; diff --git a/test/test.js b/test/test.js index 4ba65ce10d..f260ca8502 100644 --- a/test/test.js +++ b/test/test.js @@ -706,19 +706,21 @@ deepEqual(func({}, new Foo), {}); }); - test('lodash.' + methodName + ' should treat sparse arrays as dense', function() { - var array = Array(3); - array[0] = 1; - array[2] = 3; + if (methodName == 'merge') { + test('lodash.' + methodName + ' should treat sparse arrays as dense', function() { + var array = Array(3); + array[0] = 1; + array[2] = 3; - var actual = func([], array), - expected = array.slice(); + var actual = func([], array), + expected = array.slice(); - expected[1] = undefined; + expected[1] = undefined; - ok(1 in actual); - deepEqual(actual, expected); - }); + ok(1 in actual); + deepEqual(actual, expected); + }); + } }); /*--------------------------------------------------------------------------*/ From 8781053dbeddb97ee0099f28978b55bf46ae6040 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 3 May 2013 08:51:10 -0700 Subject: [PATCH 006/117] Simplify `arrays` iterator options. Former-commit-id: 7ea81c03f791615bcfec24d8574162c190d49c7d --- lodash.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lodash.js b/lodash.js index 8e51b8255e..fc78ea8fab 100644 --- a/lodash.js +++ b/lodash.js @@ -585,7 +585,6 @@ 'while (++argsIndex < argsLength) {\n' + ' iterable = args[argsIndex];\n' + ' if (iterable && objectTypes[typeof iterable]) {', - 'arrays': false, 'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]", 'bottom': ' }\n}' }; @@ -759,7 +758,7 @@ 'support': support, // iterator options - 'arrays': 'isArray(iterable)', + 'arrays': '', 'bottom': '', 'init': 'iterable', 'loop': '', @@ -989,8 +988,7 @@ 'args': 'object', 'init': '[]', 'top': 'if (!(objectTypes[typeof object])) return result', - 'loop': 'result.push(index)', - 'arrays': false + 'loop': 'result.push(index)' }); /** From 4cc3fcb6e87a2835e48fae0d59e68fb326a8aa4b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 5 May 2013 23:49:37 -0700 Subject: [PATCH 007/117] Ensure unknown `objectTypes` return `false`. Former-commit-id: a60236ecd8908a91c0268d71d5710665986f1ceb --- lodash.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lodash.js b/lodash.js index fc78ea8fab..20ca1042ce 100644 --- a/lodash.js +++ b/lodash.js @@ -1810,7 +1810,7 @@ // http://es5.github.com/#x8 // and avoid a V8 bug // http://code.google.com/p/v8/issues/detail?id=2291 - return value ? objectTypes[typeof value] : false; + return !!(value && objectTypes[typeof value]); } /** @@ -1931,7 +1931,7 @@ * // => true */ function isRegExp(value) { - return value ? (objectTypes[typeof value] && toString.call(value) == regexpClass) : false; + return !!(value && objectTypes[typeof value]) && toString.call(value) == regexpClass); } /** From 086669fbe07cac3bdafdbe56787e08bb9afadda3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 5 May 2013 23:58:33 -0700 Subject: [PATCH 008/117] Ensure `_.forIn` works over objects with longer inheritance chains in IE < 9. Former-commit-id: 226223454e71dd8cb6c38a543f1accd915eef3cb --- build/pre-compile.js | 7 +++++++ lodash.js | 45 +++++++++++++++++++++++++++++++++++--------- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index 4b4d8e3bc5..071c8f31cc 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -11,6 +11,7 @@ 'argsIndex', 'argsLength', 'callback', + 'className', 'collection', 'ctor', 'guard', @@ -18,15 +19,21 @@ 'index', 'isArguments', 'isArray', + 'isProto', 'isString', 'iterable', + 'iterated', 'length', 'keys', 'lodash', + 'nonEnum', + 'nonEnumProps', 'object', + 'objectRef', 'objectTypes', 'ownIndex', 'ownProps', + 'proto', 'result', 'skipProto', 'source', diff --git a/lodash.js b/lodash.js index 20ca1042ce..b9f0379116 100644 --- a/lodash.js +++ b/lodash.js @@ -217,6 +217,25 @@ ctorByClass[regexpClass] = RegExp; ctorByClass[stringClass] = String; + /** Used to avoid iterating non-enumerable properties in IE < 9 */ + var nonEnumProps = {}; + nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': 1, 'toLocaleString': 1, 'toString': 1, 'valueOf': 1 }; + nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': 1, 'toString': 1, 'valueOf': 1 }; + nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': 1, 'toString': 1 }; + nonEnumProps[objectClass] = { 'constructor': 1 }; + + (function() { + var length = shadowedProps.length; + while (length--) { + var prop = shadowedProps[length]; + for (var className in nonEnumProps) { + if (hasOwnProperty.call(nonEnumProps, className) && nonEnumProps[className][prop] !== 1) { + nonEnumProps[className][prop] = 0; + } + } + } + }()); + /*--------------------------------------------------------------------------*/ /** @@ -555,13 +574,21 @@ // defaults to non-enumerable, Lo-Dash skips the `constructor` // property when it infers it's iterating over a `prototype` object. ' <% if (support.nonEnumShadows) { %>\n\n' + - ' var ctor = iterable.constructor;\n' + + ' var iterated = {' + ' <% for (var k = 0; k < 7; k++) { %>\n' + + " '<%= shadowedProps[k] %>': 0<%= (k < 6 ? ',' : '') %>" + + ' <% } %>\n' + + ' };\n\n' + + ' var className = toString.call(iterable),\n' + + ' ctor = iterable.constructor,\n' + + ' proto = ctor && ctor.prototype,\n' + + ' isProto = iterable === proto,\n' + + ' nonEnum = nonEnumProps[className];\n\n' + + ' <% for (k = 0; k < 7; k++) { %>\n' + " index = '<%= shadowedProps[k] %>';\n" + - ' if (<%' + - " if (shadowedProps[k] == 'constructor') {" + - ' %>!(ctor && ctor.prototype === iterable) && <%' + - ' } %>hasOwnProperty.call(iterable, index)) {\n' + + ' if (!iterated[index] && (iterated[index] = (!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))<%' + + ' if (!useHas) { %> || (!nonEnum[index] && iterable[index] !== objectRef[index])<% }' + + ' %>)) {\n' + ' <%= loop %>\n' + ' }' + ' <% } %>' + @@ -778,14 +805,14 @@ // create the function factory var factory = Function( - 'hasOwnProperty, isArguments, isArray, isString, keys, ' + - 'lodash, objectTypes', + 'hasOwnProperty, isArguments, isArray, isString, keys, lodash, ' + + 'objectRef, objectTypes, nonEnumProps, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( - hasOwnProperty, isArguments, isArray, isString, keys, - lodash, objectTypes + hasOwnProperty, isArguments, isArray, isString, keys, lodash, + objectRef, objectTypes, nonEnumProps, toString ); } From ba2b459220fa821bcb8e625fe11d6b7ebae3e404 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 5 May 2013 23:59:13 -0700 Subject: [PATCH 009/117] Tweak wiki wording in README.md. Former-commit-id: 86b1377b1e0eb09bf9e50ac66b988548b022cf96 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f8dbc0fe4..93e0fc1715 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ Lo-Dash has been tested in at least Chrome 5~26, Firefox 2~20, IE 6-10, Opera 9. Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need. To top it off, we handle all method dependency and alias mapping for you. -For a more detailed summary over the differences between various builds, check out our [wiki entry](https://github.com/bestiejs/lodash/wiki/build-differences). +For a more detailed summary over the differences between various builds, check out the [wiki page](https://github.com/bestiejs/lodash/wiki/build-differences). * Backbone builds, with only methods required by Backbone, may be created using the `backbone` modifier argument. ```bash From aad55fc3dbaddeafb7b35d5b89c36070782c586b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 6 May 2013 07:02:53 -0700 Subject: [PATCH 010/117] Fix trailing parenthesis typo. Former-commit-id: a9b4fe7408aa9faa7079656c3cb31a4c655544e6 --- lodash.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lodash.js b/lodash.js index b9f0379116..419cb1a091 100644 --- a/lodash.js +++ b/lodash.js @@ -1958,7 +1958,7 @@ * // => true */ function isRegExp(value) { - return !!(value && objectTypes[typeof value]) && toString.call(value) == regexpClass); + return !!(value && objectTypes[typeof value]) && toString.call(value) == regexpClass; } /** From e0cf4e644b268351d688776caa7ec1428cce077e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 7 May 2013 01:38:13 -0700 Subject: [PATCH 011/117] Add more `_.forIn` iteration tests and prep support for Error object iteration. Former-commit-id: 3676681717d0648c9f96570a4952f7c35e6a9bec --- build/pre-compile.js | 11 +++-- lodash.js | 106 +++++++++++++++++++++++-------------------- test/test.js | 41 +++++++++++++++-- 3 files changed, 102 insertions(+), 56 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index 071c8f31cc..f583edde9b 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -14,6 +14,9 @@ 'className', 'collection', 'ctor', + 'ctorByClass', + 'errorClass', + 'errorProto', 'guard', 'hasOwnProperty', 'index', @@ -22,14 +25,13 @@ 'isProto', 'isString', 'iterable', - 'iterated', 'length', 'keys', 'lodash', 'nonEnum', 'nonEnumProps', 'object', - 'objectRef', + 'objectProto', 'objectTypes', 'ownIndex', 'ownProps', @@ -37,7 +39,10 @@ 'result', 'skipProto', 'source', - 'thisArg' + 'stringClass', + 'stringProto', + 'thisArg', + 'toString' ]; /** Used to minify `iteratorTemplate` data properties */ diff --git a/lodash.js b/lodash.js index 419cb1a091..241693e9f6 100644 --- a/lodash.js +++ b/lodash.js @@ -81,9 +81,9 @@ /** Used to assign default `context` object properties */ var contextProps = [ - 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', 'RegExp', - 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', 'parseInt', - 'setImmediate', 'setTimeout' + 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', + 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', + 'parseInt', 'setImmediate', 'setTimeout' ]; /** Used to fix the JScript [[DontEnum]] bug */ @@ -100,6 +100,7 @@ arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', + errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', @@ -157,6 +158,7 @@ var Array = context.Array, Boolean = context.Boolean, Date = context.Date, + Error = context.Error, Function = context.Function, Math = context.Math, Number = context.Number, @@ -166,15 +168,17 @@ TypeError = context.TypeError; /** Used for `Array` and `Object` method references */ - var arrayRef = Array(), - objectRef = Object(); + var arrayProto = Array.prototype, + errorProto = Error.prototype, + objectProto = Object.prototype, + stringProto = String.prototype; /** Used to restore the original `_` reference in `noConflict` */ var oldDash = context._; /** Used to detect if a method is native */ var reNative = RegExp('^' + - String(objectRef.valueOf) + String(objectProto.valueOf) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/valueOf|for [^\]]+/g, '.+?') + '$' ); @@ -182,14 +186,14 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, - concat = arrayRef.concat, + concat = arrayProto.concat, floor = Math.floor, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - hasOwnProperty = objectRef.hasOwnProperty, - push = arrayRef.push, + hasOwnProperty = objectProto.hasOwnProperty, + push = arrayProto.push, setImmediate = context.setImmediate, setTimeout = context.setTimeout, - toString = objectRef.toString; + toString = objectProto.toString; /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, @@ -201,7 +205,7 @@ nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, - nativeSlice = arrayRef.slice; + nativeSlice = arrayProto.slice; /** Detect various environments */ var isIeOpera = reNative.test(context.attachEvent), @@ -212,6 +216,8 @@ ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; ctorByClass[dateClass] = Date; + ctorByClass[errorClass] = Error; + ctorByClass[funcClass] = Function; ctorByClass[objectClass] = Object; ctorByClass[numberClass] = Number; ctorByClass[regexpClass] = RegExp; @@ -219,18 +225,18 @@ /** Used to avoid iterating non-enumerable properties in IE < 9 */ var nonEnumProps = {}; - nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': 1, 'toLocaleString': 1, 'toString': 1, 'valueOf': 1 }; - nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': 1, 'toString': 1, 'valueOf': 1 }; - nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': 1, 'toString': 1 }; - nonEnumProps[objectClass] = { 'constructor': 1 }; + nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; + nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; + nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; + nonEnumProps[objectClass] = { 'constructor': true }; (function() { var length = shadowedProps.length; while (length--) { var prop = shadowedProps[length]; for (var className in nonEnumProps) { - if (hasOwnProperty.call(nonEnumProps, className) && nonEnumProps[className][prop] !== 1) { - nonEnumProps[className][prop] = 0; + if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], prop)) { + nonEnumProps[className][prop] = false; } } } @@ -400,7 +406,7 @@ * @memberOf _.support * @type Boolean */ - support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); + support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]); /** * Detect lack of support for accessing string characters by index. @@ -574,24 +580,24 @@ // defaults to non-enumerable, Lo-Dash skips the `constructor` // property when it infers it's iterating over a `prototype` object. ' <% if (support.nonEnumShadows) { %>\n\n' + - ' var iterated = {' + - ' <% for (var k = 0; k < 7; k++) { %>\n' + - " '<%= shadowedProps[k] %>': 0<%= (k < 6 ? ',' : '') %>" + - ' <% } %>\n' + - ' };\n\n' + - ' var className = toString.call(iterable),\n' + - ' ctor = iterable.constructor,\n' + - ' proto = ctor && ctor.prototype,\n' + - ' isProto = iterable === proto,\n' + - ' nonEnum = nonEnumProps[className];\n\n' + + ' if (iterable !== objectProto) {\n' + + " var ctor = iterable.constructor,\n" + + ' proto = ctor && ctor.prototype,\n' + + ' isProto = iterable === proto,\n' + + ' nonEnum = nonEnumProps[objectClass];\n\n' + + ' if (isProto) {\n' + + " var className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n" + + ' nonEnum = nonEnumProps[iterable === (ctorByClass[className] && ctorByClass[className].prototype) ? className : objectClass];\n' + + ' }\n' + ' <% for (k = 0; k < 7; k++) { %>\n' + - " index = '<%= shadowedProps[k] %>';\n" + - ' if (!iterated[index] && (iterated[index] = (!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))<%' + - ' if (!useHas) { %> || (!nonEnum[index] && iterable[index] !== objectRef[index])<% }' + - ' %>)) {\n' + - ' <%= loop %>\n' + + " index = '<%= shadowedProps[k] %>';\n" + + ' if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))<%' + + ' if (!useHas) { %> || (!nonEnum[index] && iterable[index] !== objectProto[index])<% }' + + ' %>) {\n' + + ' <%= loop %>\n' + + ' }' + + ' <% } %>\n' + ' }' + - ' <% } %>' + ' <% } %>' + ' <% } %>' + ' <% if (arrays || support.nonEnumArgs) { %>\n}<% } %>\n' + @@ -805,14 +811,16 @@ // create the function factory var factory = Function( - 'hasOwnProperty, isArguments, isArray, isString, keys, lodash, ' + - 'objectRef, objectTypes, nonEnumProps, toString', + 'ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, ' + + 'isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, ' + + 'nonEnumProps, stringClass, stringProto, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( - hasOwnProperty, isArguments, isArray, isString, keys, lodash, - objectRef, objectTypes, nonEnumProps, toString + ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, + isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, + nonEnumProps, stringClass, stringProto, toString ); } @@ -2166,7 +2174,7 @@ if (isFunc) { callback = lodash.createCallback(callback, thisArg); } else { - var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)); + var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)); } forIn(object, function(value, key, object) { if (isFunc @@ -2235,7 +2243,7 @@ var result = {}; if (typeof callback != 'function') { var index = -1, - props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), length = isObject(object) ? props.length : 0; while (++index < length) { @@ -2305,7 +2313,7 @@ */ function at(collection) { var index = -1, - props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), length = props.length, result = Array(length); @@ -3347,7 +3355,7 @@ function difference(array) { var index = -1, length = array ? array.length : 0, - flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), contains = cachedContains(flattened), result = []; @@ -4024,9 +4032,9 @@ */ function union(array) { if (!isArray(array)) { - arguments[0] = array ? nativeSlice.call(array) : arrayRef; + arguments[0] = array ? nativeSlice.call(array) : arrayProto; } - return uniq(concat.apply(arrayRef, arguments)); + return uniq(concat.apply(arrayProto, arguments)); } /** @@ -4303,7 +4311,7 @@ * // => alerts 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), + var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; @@ -5482,7 +5490,7 @@ // add `Array` functions that return unwrapped values each(['join', 'pop', 'shift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return func.apply(this.__wrapped__, arguments); }; @@ -5490,7 +5498,7 @@ // add `Array` functions that return the wrapped value each(['push', 'reverse', 'sort', 'unshift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; @@ -5499,7 +5507,7 @@ // add `Array` functions that return new wrapped values each(['concat', 'slice', 'splice'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments)); }; @@ -5509,7 +5517,7 @@ // in Firefox < 10 and IE < 9 if (!support.spliceObjects) { each(['pop', 'shift', 'splice'], function(methodName) { - var func = arrayRef[methodName], + var func = arrayProto[methodName], isSplice = methodName == 'splice'; lodash.prototype[methodName] = function() { diff --git a/test/test.js b/test/test.js index f260ca8502..5ff378c08d 100644 --- a/test/test.js +++ b/test/test.js @@ -999,12 +999,25 @@ (function() { test('iterates over inherited properties', function() { - function Dog(name) { this.name = name; } - Dog.prototype.bark = function() { /* Woof, woof! */ }; + function Foo() { this.a = 1; } + Foo.prototype.b = 2; var keys = []; - _.forIn(new Dog('Dagny'), function(value, key) { keys.push(key); }); - deepEqual(keys.sort(), ['bark', 'name']); + _.forIn(new Foo, function(value, key) { keys.push(key); }); + deepEqual(keys.sort(), ['a', 'b']); + }); + + test('fixes the JScript [[DontEnum]] bug with inherited properties (test in IE < 9)', function() { + function Foo() {} + Foo.prototype = shadowedObject; + + function Bar() {} + Bar.prototype = new Foo; + Bar.prototype.constructor = Bar; + + var keys = []; + _.forIn(shadowedObject, function(value, key) { keys.push(key); }); + deepEqual(keys.sort(), shadowedProps); }); }()); @@ -1035,6 +1048,26 @@ deepEqual(keys.sort(), shadowedProps); }); + test('lodash.' + methodName + ' does not iterate over non-enumerable properties (test in IE < 9)', function() { + _.forOwn({ + 'Array': Array.prototype, + 'Boolean': Boolean.prototype, + 'Date': Date.prototype, + 'Error': Error.prototype, + 'Function': Function.prototype, + 'Object': Object.prototype, + 'Number': Number.prototype, + 'TypeError': TypeError.prototype, + 'RegExp': RegExp.prototype, + 'String': String.prototype + }, + function(object, builtin) { + var keys = []; + func(object, function(value, key) { keys.push(key); }); + deepEqual(keys, [], 'non-enumerable properties on ' + builtin + '.prototype'); + }); + }); + test('lodash.' + methodName + ' skips the prototype property of functions (test in Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1)', function() { function Foo() {} Foo.prototype.a = 1; From cc14c34dc2a234926028d9ef2fe0cd1ff69cc3a6 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 7 May 2013 09:22:31 -0700 Subject: [PATCH 012/117] Allow the `underscore` build to opt-in to more `lodash` build methods. Former-commit-id: 3f685fe1ced25ba37ea9d09e2ed8fa59acb5b8b7 --- build.js | 1071 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 558 insertions(+), 513 deletions(-) diff --git a/build.js b/build.js index eca0164cb0..b1b470d9fc 100755 --- a/build.js +++ b/build.js @@ -1764,41 +1764,64 @@ } } if (isUnderscore) { - dependencyMap.contains = _.without(dependencyMap.contains, 'isString'); - dependencyMap.createCallback = _.without(dependencyMap.createCallback, 'isEqual'); - dependencyMap.findWhere = ['where']; - dependencyMap.flatten = _.without(dependencyMap.flatten, 'createCallback'); - dependencyMap.isEmpty = ['isArray', 'isString']; - dependencyMap.isEqual = _.without(dependencyMap.isEqual, 'forIn', 'isArguments'); - dependencyMap.max = _.without(dependencyMap.max, 'isArray', 'isString'); - dependencyMap.min = _.without(dependencyMap.min, 'isArray', 'isString'); - dependencyMap.pick = _.without(dependencyMap.pick, 'forIn', 'isObject'); - dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); - dependencyMap.template = _.without(dependencyMap.template, 'keys', 'values'); - dependencyMap.toArray.push('isArray', 'map'); - dependencyMap.value = _.without(dependencyMap.value, 'isArray'); - dependencyMap.where.push('find', 'isEmpty'); - if (!useLodashMethod('clone') && !useLodashMethod('cloneDeep')) { dependencyMap.clone = _.without(dependencyMap.clone, 'forEach', 'forOwn'); } + if (!useLodashMethod('contains')) { + dependencyMap.contains = _.without(dependencyMap.contains, 'isString'); + } + if (!useLodashMethod('flatten')) { + dependencyMap.flatten = _.without(dependencyMap.flatten, 'createCallback'); + } + if (!useLodashMethod('isEmpty')) { + dependencyMap.isEmpty = ['isArray', 'isString']; + } + if (!useLodashMethod('isEqual')) { + dependencyMap.isEqual = _.without(dependencyMap.isEqual, 'forIn', 'isArguments'); + } + if (!useLodashMethod('pick')){ + dependencyMap.pick = _.without(dependencyMap.pick, 'forIn', 'isObject'); + } + if (!useLodashMethod('where')) { + dependencyMap.createCallback = _.without(dependencyMap.createCallback, 'isEqual'); + dependencyMap.where.push('find', 'isEmpty'); + } + if (!useLodashMethod('template')) { + dependencyMap.template = _.without(dependencyMap.template, 'keys', 'values'); + } + if (!useLodashMethod('toArray')) { + dependencyMap.toArray.push('isArray', 'map'); + } + + _.each(['max', 'min'], function(methodName) { + if (!useLodashMethod(methodName)) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isArray', 'isString'); + } + }); + + dependencyMap.findWhere = ['where']; + dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); + dependencyMap.value = _.without(dependencyMap.value, 'isArray'); } if (isModern || isUnderscore) { - dependencyMap.at = _.without(dependencyMap.at, 'isString'); - dependencyMap.forEach = _.without(dependencyMap.forEach, 'isString'); - dependencyMap.toArray = _.without(dependencyMap.toArray, 'isString'); + _.each(['at', 'forEach', 'toArray'], function(methodName) { + if (!(isUnderscore && useLodashMethod(methodName))) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isString'); + } + }); if (!isMobile) { - dependencyMap.every = _.without(dependencyMap.every, 'isArray'); - dependencyMap.find = _.without(dependencyMap.find, 'isArray'); - dependencyMap.filter = _.without(dependencyMap.filter, 'isArray'); - dependencyMap.forEach = _.without(dependencyMap.forEach, 'isArguments', 'isArray'); - dependencyMap.forIn = _.without(dependencyMap.forIn, 'isArguments'); - dependencyMap.forOwn = _.without(dependencyMap.forOwn, 'isArguments'); - dependencyMap.map = _.without(dependencyMap.map, 'isArray'); - dependencyMap.max.push('forEach'); - dependencyMap.min.push('forEach'); - dependencyMap.reduce = _.without(dependencyMap.reduce, 'isArray'); + _.each(['every', 'find', 'filter', 'forEach', 'forIn', 'forOwn', 'map', 'reduce'], function(methodName) { + if (!(isUnderscore && useLodashMethod(methodName))) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isArguments', 'isArray'); + } + }); + + _.each(['max', 'min'], function(methodName) { + if (!(isUnderscore && useLodashMethod(methodName))) { + dependencyMap[methodName].push('forEach'); + } + }); } } // add method names explicitly @@ -2036,24 +2059,34 @@ } } if (isUnderscore) { - // replace `_.assign` - source = replaceFunction(source, 'assign', [ - 'function assign(object) {', - ' if (!object) {', - ' return object;', - ' }', - ' for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {', - ' var iterable = arguments[argsIndex];', - ' if (iterable) {', - ' for (var key in iterable) {', - ' object[key] = iterable[key];', - ' }', - ' }', - ' }', - ' return object;', + // replace `lodash` + source = replaceFunction(source, 'lodash', [ + 'function lodash(value) {', + ' return (value instanceof lodash)', + ' ? value', + ' : new lodashWrapper(value);', '}' ].join('\n')); + // replace `_.assign` + if (!useLodashMethod('assign')) { + source = replaceFunction(source, 'assign', [ + 'function assign(object) {', + ' if (!object) {', + ' return object;', + ' }', + ' for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {', + ' var iterable = arguments[argsIndex];', + ' if (iterable) {', + ' for (var key in iterable) {', + ' object[key] = iterable[key];', + ' }', + ' }', + ' }', + ' return object;', + '}' + ].join('\n')); + } // replace `_.clone` if (!useLodashMethod('clone') && !useLodashMethod('cloneDeep')) { source = replaceFunction(source, 'clone', [ @@ -2064,480 +2097,504 @@ '}' ].join('\n')); } - // replace `_.contains` - source = replaceFunction(source, 'contains', [ - 'function contains(collection, target) {', - ' var length = collection ? collection.length : 0,', - ' result = false;', - " if (typeof length == 'number') {", - ' result = indexOf(collection, target) > -1;', - ' } else {', - ' each(collection, function(value) {', - ' return !(result = value === target);', - ' });', - ' }', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('contains')) { + source = replaceFunction(source, 'contains', [ + 'function contains(collection, target) {', + ' var length = collection ? collection.length : 0,', + ' result = false;', + " if (typeof length == 'number') {", + ' result = indexOf(collection, target) > -1;', + ' } else {', + ' each(collection, function(value) {', + ' return !(result = value === target);', + ' });', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.debounce` - source = replaceFunction(source, 'debounce', [ - 'function debounce(func, wait, immediate) {', - ' var args,', - ' result,', - ' thisArg,', - ' timeoutId;', - '', - ' function delayed() {', - ' timeoutId = null;', - ' if (!immediate) {', - ' result = func.apply(thisArg, args);', - ' }', - ' }', - ' return function() {', - ' var isImmediate = immediate && !timeoutId;', - ' args = arguments;', - ' thisArg = this;', - '', - ' clearTimeout(timeoutId);', - ' timeoutId = setTimeout(delayed, wait);', - '', - ' if (isImmediate) {', - ' result = func.apply(thisArg, args);', - ' }', - ' return result;', - ' };', - '}' - ].join('\n')); - + if (!useLodashMethod('debounce')) { + source = replaceFunction(source, 'debounce', [ + 'function debounce(func, wait, immediate) {', + ' var args,', + ' result,', + ' thisArg,', + ' timeoutId;', + '', + ' function delayed() {', + ' timeoutId = null;', + ' if (!immediate) {', + ' result = func.apply(thisArg, args);', + ' }', + ' }', + ' return function() {', + ' var isImmediate = immediate && !timeoutId;', + ' args = arguments;', + ' thisArg = this;', + '', + ' clearTimeout(timeoutId);', + ' timeoutId = setTimeout(delayed, wait);', + '', + ' if (isImmediate) {', + ' result = func.apply(thisArg, args);', + ' }', + ' return result;', + ' };', + '}' + ].join('\n')); + } // replace `_.defaults` - source = replaceFunction(source, 'defaults', [ - 'function defaults(object) {', - ' if (!object) {', - ' return object;', - ' }', - ' for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {', - ' var iterable = arguments[argsIndex];', - ' if (iterable) {', - ' for (var key in iterable) {', - ' if (object[key] == null) {', - ' object[key] = iterable[key];', - ' }', - ' }', - ' }', - ' }', - ' return object;', - '}' - ].join('\n')); - + if (!useLodashMethod('defaults')) { + source = replaceFunction(source, 'defaults', [ + 'function defaults(object) {', + ' if (!object) {', + ' return object;', + ' }', + ' for (var argsIndex = 1, argsLength = arguments.length; argsIndex < argsLength; argsIndex++) {', + ' var iterable = arguments[argsIndex];', + ' if (iterable) {', + ' for (var key in iterable) {', + ' if (object[key] == null) {', + ' object[key] = iterable[key];', + ' }', + ' }', + ' }', + ' }', + ' return object;', + '}' + ].join('\n')); + } // replace `_.difference` - source = replaceFunction(source, 'difference', [ - 'function difference(array) {', - ' var index = -1,', - ' length = array.length,', - ' flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', - ' result = [];', - '', - ' while (++index < length) {', - ' var value = array[index];', - ' if (indexOf(flattened, value) < 0) {', - ' result.push(value);', - ' }', - ' }', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('difference')) { + source = replaceFunction(source, 'difference', [ + 'function difference(array) {', + ' var index = -1,', + ' length = array.length,', + ' flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', + ' result = [];', + '', + ' while (++index < length) {', + ' var value = array[index];', + ' if (indexOf(flattened, value) < 0) {', + ' result.push(value);', + ' }', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.flatten` - source = replaceFunction(source, 'flatten', [ - 'function flatten(array, isShallow) {', - ' var index = -1,', - ' length = array ? array.length : 0,', - ' result = [];', - '' , - ' while (++index < length) {', - ' var value = array[index];', - ' if (isArray(value)) {', - ' push.apply(result, isShallow ? value : flatten(value));', - ' } else {', - ' result.push(value);', - ' }', - ' }', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('flatten')) { + source = replaceFunction(source, 'flatten', [ + 'function flatten(array, isShallow) {', + ' var index = -1,', + ' length = array ? array.length : 0,', + ' result = [];', + '' , + ' while (++index < length) {', + ' var value = array[index];', + ' if (isArray(value)) {', + ' push.apply(result, isShallow ? value : flatten(value));', + ' } else {', + ' result.push(value);', + ' }', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.intersection` - source = replaceFunction(source, 'intersection', [ - 'function intersection(array) {', - ' var args = arguments,', - ' argsLength = args.length,', - ' index = -1,', - ' length = array ? array.length : 0,', - ' result = [];', - '', - ' outer:', - ' while (++index < length) {', - ' var value = array[index];', - ' if (indexOf(result, value) < 0) {', - ' var argsIndex = argsLength;', - ' while (--argsIndex) {', - ' if (indexOf(args[argsIndex], value) < 0) {', - ' continue outer;', - ' }', - ' }', - ' result.push(value);', - ' }', - ' }', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('intersection')) { + source = replaceFunction(source, 'intersection', [ + 'function intersection(array) {', + ' var args = arguments,', + ' argsLength = args.length,', + ' index = -1,', + ' length = array ? array.length : 0,', + ' result = [];', + '', + ' outer:', + ' while (++index < length) {', + ' var value = array[index];', + ' if (indexOf(result, value) < 0) {', + ' var argsIndex = argsLength;', + ' while (--argsIndex) {', + ' if (indexOf(args[argsIndex], value) < 0) {', + ' continue outer;', + ' }', + ' }', + ' result.push(value);', + ' }', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.isEmpty` - source = replaceFunction(source, 'isEmpty', [ - 'function isEmpty(value) {', - ' if (!value) {', - ' return true;', - ' }', - ' if (isArray(value) || isString(value)) {', - ' return !value.length;', - ' }', - ' for (var key in value) {', - ' if (hasOwnProperty.call(value, key)) {', - ' return false;', - ' }', - ' }', - ' return true;', - '}' - ].join('\n')); - + if (!useLodashMethod('isEmpty')) { + source = replaceFunction(source, 'isEmpty', [ + 'function isEmpty(value) {', + ' if (!value) {', + ' return true;', + ' }', + ' if (isArray(value) || isString(value)) {', + ' return !value.length;', + ' }', + ' for (var key in value) {', + ' if (hasOwnProperty.call(value, key)) {', + ' return false;', + ' }', + ' }', + ' return true;', + '}' + ].join('\n')); + } // replace `_.isEqual` - source = replaceFunction(source, 'isEqual', [ - 'function isEqual(a, b, stackA, stackB) {', - ' if (a === b) {', - ' return a !== 0 || (1 / a == 1 / b);', - ' }', - ' var type = typeof a,', - ' otherType = typeof b;', - '', - ' if (a === a &&', - " (!a || (type != 'function' && type != 'object')) &&", - " (!b || (otherType != 'function' && otherType != 'object'))) {", - ' return false;', - ' }', - ' if (a == null || b == null) {', - ' return a === b;', - ' }', - ' var className = toString.call(a),', - ' otherClass = toString.call(b);', - '', - ' if (className != otherClass) {', - ' return false;', - ' }', - ' switch (className) {', - ' case boolClass:', - ' case dateClass:', - ' return +a == +b;', - '', - ' case numberClass:', - ' return a != +a', - ' ? b != +b', - ' : (a == 0 ? (1 / a == 1 / b) : a == +b);', - '', - ' case regexpClass:', - ' case stringClass:', - ' return a == String(b);', - ' }', - ' var isArr = className == arrayClass;', - ' if (!isArr) {', - ' if (a instanceof lodash || b instanceof lodash) {', - ' return isEqual(a.__wrapped__ || a, b.__wrapped__ || b, stackA, stackB);', - ' }', - ' if (className != objectClass) {', - ' return false;', - ' }', - ' var ctorA = a.constructor,', - ' ctorB = b.constructor;', - '', - ' if (ctorA != ctorB && !(', - ' isFunction(ctorA) && ctorA instanceof ctorA &&', - ' isFunction(ctorB) && ctorB instanceof ctorB', - ' )) {', - ' return false;', - ' }', - ' }', - ' stackA || (stackA = []);', - ' stackB || (stackB = []);', - '', - ' var length = stackA.length;', - ' while (length--) {', - ' if (stackA[length] == a) {', - ' return stackB[length] == b;', - ' }', - ' }', - ' var result = true,', - ' size = 0;', - '', - ' stackA.push(a);', - ' stackB.push(b);', - '', - ' if (isArr) {', - ' size = b.length;', - ' result = size == a.length;', - '', - ' if (result) {', - ' while (size--) {', - ' if (!(result = isEqual(a[size], b[size], stackA, stackB))) {', - ' break;', - ' }', - ' }', - ' }', - ' return result;', - ' }', - ' forIn(b, function(value, key, b) {', - ' if (hasOwnProperty.call(b, key)) {', - ' size++;', - ' return (result = hasOwnProperty.call(a, key) && isEqual(a[key], value, stackA, stackB));', - ' }', - ' });', - '', - ' if (result) {', - ' forIn(a, function(value, key, a) {', - ' if (hasOwnProperty.call(a, key)) {', - ' return (result = --size > -1);', - ' }', - ' });', - ' }', - ' return result;', - '}' - ].join('\n')); - - // replace `lodash` - source = replaceFunction(source, 'lodash', [ - 'function lodash(value) {', - ' return (value instanceof lodash)', - ' ? value', - ' : new lodashWrapper(value);', - '}' - ].join('\n')); - + if (!useLodashMethod('isEqual')) { + source = replaceFunction(source, 'isEqual', [ + 'function isEqual(a, b, stackA, stackB) {', + ' if (a === b) {', + ' return a !== 0 || (1 / a == 1 / b);', + ' }', + ' var type = typeof a,', + ' otherType = typeof b;', + '', + ' if (a === a &&', + " (!a || (type != 'function' && type != 'object')) &&", + " (!b || (otherType != 'function' && otherType != 'object'))) {", + ' return false;', + ' }', + ' if (a == null || b == null) {', + ' return a === b;', + ' }', + ' var className = toString.call(a),', + ' otherClass = toString.call(b);', + '', + ' if (className != otherClass) {', + ' return false;', + ' }', + ' switch (className) {', + ' case boolClass:', + ' case dateClass:', + ' return +a == +b;', + '', + ' case numberClass:', + ' return a != +a', + ' ? b != +b', + ' : (a == 0 ? (1 / a == 1 / b) : a == +b);', + '', + ' case regexpClass:', + ' case stringClass:', + ' return a == String(b);', + ' }', + ' var isArr = className == arrayClass;', + ' if (!isArr) {', + ' if (a instanceof lodash || b instanceof lodash) {', + ' return isEqual(a.__wrapped__ || a, b.__wrapped__ || b, stackA, stackB);', + ' }', + ' if (className != objectClass) {', + ' return false;', + ' }', + ' var ctorA = a.constructor,', + ' ctorB = b.constructor;', + '', + ' if (ctorA != ctorB && !(', + ' isFunction(ctorA) && ctorA instanceof ctorA &&', + ' isFunction(ctorB) && ctorB instanceof ctorB', + ' )) {', + ' return false;', + ' }', + ' }', + ' stackA || (stackA = []);', + ' stackB || (stackB = []);', + '', + ' var length = stackA.length;', + ' while (length--) {', + ' if (stackA[length] == a) {', + ' return stackB[length] == b;', + ' }', + ' }', + ' var result = true,', + ' size = 0;', + '', + ' stackA.push(a);', + ' stackB.push(b);', + '', + ' if (isArr) {', + ' size = b.length;', + ' result = size == a.length;', + '', + ' if (result) {', + ' while (size--) {', + ' if (!(result = isEqual(a[size], b[size], stackA, stackB))) {', + ' break;', + ' }', + ' }', + ' }', + ' return result;', + ' }', + ' forIn(b, function(value, key, b) {', + ' if (hasOwnProperty.call(b, key)) {', + ' size++;', + ' return (result = hasOwnProperty.call(a, key) && isEqual(a[key], value, stackA, stackB));', + ' }', + ' });', + '', + ' if (result) {', + ' forIn(a, function(value, key, a) {', + ' if (hasOwnProperty.call(a, key)) {', + ' return (result = --size > -1);', + ' }', + ' });', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.omit` - source = replaceFunction(source, 'omit', [ - 'function omit(object) {', - ' var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', - ' result = {};', - '', - ' forIn(object, function(value, key) {', - ' if (indexOf(props, key) < 0) {', - ' result[key] = value;', - ' }', - ' });', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('omit')) { + source = replaceFunction(source, 'omit', [ + 'function omit(object) {', + ' var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', + ' result = {};', + '', + ' forIn(object, function(value, key) {', + ' if (indexOf(props, key) < 0) {', + ' result[key] = value;', + ' }', + ' });', + ' return result;', + '}' + ].join('\n')); + } // replace `_.pick` - source = replaceFunction(source, 'pick', [ - 'function pick(object) {', - ' var index = -1,', - ' props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', - ' length = props.length,', - ' result = {};', - '', - ' while (++index < length) {', - ' var prop = props[index];', - ' if (prop in object) {', - ' result[prop] = object[prop];', - ' }', - ' }', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('pick')) { + source = replaceFunction(source, 'pick', [ + 'function pick(object) {', + ' var index = -1,', + ' props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', + ' length = props.length,', + ' result = {};', + '', + ' while (++index < length) {', + ' var prop = props[index];', + ' if (prop in object) {', + ' result[prop] = object[prop];', + ' }', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.result` - source = replaceFunction(source, 'result', [ - 'function result(object, property) {', - ' var value = object ? object[property] : null;', - ' return isFunction(value) ? object[property]() : value;', - '}' - ].join('\n')); - + if (!useLodashMethod('result')) { + source = replaceFunction(source, 'result', [ + 'function result(object, property) {', + ' var value = object ? object[property] : null;', + ' return isFunction(value) ? object[property]() : value;', + '}' + ].join('\n')); + } // replace `_.template` - source = replaceFunction(source, 'template', [ - 'function template(text, data, options) {', - " text || (text = '');", - ' options = defaults({}, options, lodash.templateSettings);', - '', - ' var index = 0,', - ' source = "__p += \'",', - ' variable = options.variable;', - '', - ' var reDelimiters = RegExp(', - " (options.escape || reNoMatch).source + '|' +", - " (options.interpolate || reNoMatch).source + '|' +", - " (options.evaluate || reNoMatch).source + '|$'", - " , 'g');", - '', - ' text.replace(reDelimiters, function(match, escapeValue, interpolateValue, evaluateValue, offset) {', - ' source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);', - ' if (escapeValue) {', - ' source += "\' +\\n_.escape(" + escapeValue + ") +\\n\'";', - ' }', - ' if (evaluateValue) {', - ' source += "\';\\n" + evaluateValue + ";\\n__p += \'";', - ' }', - ' if (interpolateValue) {', - ' source += "\' +\\n((__t = (" + interpolateValue + ")) == null ? \'\' : __t) +\\n\'";', - ' }', - ' index = offset + match.length;', - ' return match;', - ' });', - '', - ' source += "\';\\n";', - ' if (!variable) {', - " variable = 'obj';", - " source = 'with (' + variable + ' || {}) {\\n' + source + '\\n}\\n';", - ' }', - " source = 'function(' + variable + ') {\\n' +", - ' "var __t, __p = \'\', __j = Array.prototype.join;\\n" +', - ' "function print() { __p += __j.call(arguments, \'\') }\\n" +', - ' source +', - " 'return __p\\n}';", - '', - ' try {', - " var result = Function('_', 'return ' + source)(lodash);", - ' } catch(e) {', - ' e.source = source;', - ' throw e;', - ' }', - ' if (data) {', - ' return result(data);', - ' }', - ' result.source = source;', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('template')) { + // remove `_.templateSettings.imports assignment + source = source.replace(/,[^']*'imports':[^}]+}/, ''); + + source = replaceFunction(source, 'template', [ + 'function template(text, data, options) {', + " text || (text = '');", + ' options = defaults({}, options, lodash.templateSettings);', + '', + ' var index = 0,', + ' source = "__p += \'",', + ' variable = options.variable;', + '', + ' var reDelimiters = RegExp(', + " (options.escape || reNoMatch).source + '|' +", + " (options.interpolate || reNoMatch).source + '|' +", + " (options.evaluate || reNoMatch).source + '|$'", + " , 'g');", + '', + ' text.replace(reDelimiters, function(match, escapeValue, interpolateValue, evaluateValue, offset) {', + ' source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);', + ' if (escapeValue) {', + ' source += "\' +\\n_.escape(" + escapeValue + ") +\\n\'";', + ' }', + ' if (evaluateValue) {', + ' source += "\';\\n" + evaluateValue + ";\\n__p += \'";', + ' }', + ' if (interpolateValue) {', + ' source += "\' +\\n((__t = (" + interpolateValue + ")) == null ? \'\' : __t) +\\n\'";', + ' }', + ' index = offset + match.length;', + ' return match;', + ' });', + '', + ' source += "\';\\n";', + ' if (!variable) {', + " variable = 'obj';", + " source = 'with (' + variable + ' || {}) {\\n' + source + '\\n}\\n';", + ' }', + " source = 'function(' + variable + ') {\\n' +", + ' "var __t, __p = \'\', __j = Array.prototype.join;\\n" +', + ' "function print() { __p += __j.call(arguments, \'\') }\\n" +', + ' source +', + " 'return __p\\n}';", + '', + ' try {', + " var result = Function('_', 'return ' + source)(lodash);", + ' } catch(e) {', + ' e.source = source;', + ' throw e;', + ' }', + ' if (data) {', + ' return result(data);', + ' }', + ' result.source = source;', + ' return result;', + '}' + ].join('\n')); + } // replace `_.throttle` - source = replaceFunction(source, 'throttle', [ - 'function throttle(func, wait) {', - ' var args,', - ' result,', - ' thisArg,', - ' timeoutId,', - ' lastCalled = 0;', - '', - ' function trailingCall() {', - ' lastCalled = new Date;', - ' timeoutId = null;', - ' result = func.apply(thisArg, args);', - ' }', - ' return function() {', - ' var now = new Date,', - ' remaining = wait - (now - lastCalled);', - '', - ' args = arguments;', - ' thisArg = this;', - '', - ' if (remaining <= 0) {', - ' clearTimeout(timeoutId);', - ' timeoutId = null;', - ' lastCalled = now;', - ' result = func.apply(thisArg, args);', - ' }', - ' else if (!timeoutId) {', - ' timeoutId = setTimeout(trailingCall, remaining);', - ' }', - ' return result;', - ' };', - '}' - ].join('\n')); - + if (!useLodashMethod('throttle')) { + source = replaceFunction(source, 'throttle', [ + 'function throttle(func, wait) {', + ' var args,', + ' result,', + ' thisArg,', + ' timeoutId,', + ' lastCalled = 0;', + '', + ' function trailingCall() {', + ' lastCalled = new Date;', + ' timeoutId = null;', + ' result = func.apply(thisArg, args);', + ' }', + ' return function() {', + ' var now = new Date,', + ' remaining = wait - (now - lastCalled);', + '', + ' args = arguments;', + ' thisArg = this;', + '', + ' if (remaining <= 0) {', + ' clearTimeout(timeoutId);', + ' timeoutId = null;', + ' lastCalled = now;', + ' result = func.apply(thisArg, args);', + ' }', + ' else if (!timeoutId) {', + ' timeoutId = setTimeout(trailingCall, remaining);', + ' }', + ' return result;', + ' };', + '}' + ].join('\n')); + } // replace `_.times` - source = replaceFunction(source, 'times', [ - 'function times(n, callback, thisArg) {', - ' var index = -1,', - ' result = Array(n > -1 ? n : 0);', - '', - ' while (++index < n) {', - ' result[index] = callback.call(thisArg, index);', - ' }', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('times')) { + source = replaceFunction(source, 'times', [ + 'function times(n, callback, thisArg) {', + ' var index = -1,', + ' result = Array(n > -1 ? n : 0);', + '', + ' while (++index < n) {', + ' result[index] = callback.call(thisArg, index);', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.toArray` - source = replaceFunction(source, 'toArray', [ - 'function toArray(collection) {', - ' if (isArray(collection)) {', - ' return slice(collection);', - ' }', - " if (collection && typeof collection.length == 'number') {", - ' return map(collection);', - ' }', - ' return values(collection);', - '}' - ].join('\n')); - + if (!useLodashMethod('toArray')) { + source = replaceFunction(source, 'toArray', [ + 'function toArray(collection) {', + ' if (isArray(collection)) {', + ' return slice(collection);', + ' }', + " if (collection && typeof collection.length == 'number') {", + ' return map(collection);', + ' }', + ' return values(collection);', + '}' + ].join('\n')); + } // replace `_.uniq` - source = replaceFunction(source, 'uniq', [ - 'function uniq(array, isSorted, callback, thisArg) {', - ' var index = -1,', - ' length = array ? array.length : 0,', - ' result = [],', - ' seen = result;', - '', - " if (typeof isSorted != 'boolean' && isSorted != null) {", - ' thisArg = callback;', - ' callback = isSorted;', - ' isSorted = false;', - ' }', - ' if (callback != null) {', - ' seen = [];', - ' callback = lodash.createCallback(callback, thisArg);', - ' }', - ' while (++index < length) {', - ' var value = array[index],', - ' computed = callback ? callback(value, index, array) : value;', - '', - ' if (isSorted', - ' ? !index || seen[seen.length - 1] !== computed', - ' : indexOf(seen, computed) < 0', - ' ) {', - ' if (callback) {', - ' seen.push(computed);', - ' }', - ' result.push(value);', - ' }', - ' }', - ' return result;', - '}' - ].join('\n')); - + if (!useLodashMethod('uniq')) { + source = replaceFunction(source, 'uniq', [ + 'function uniq(array, isSorted, callback, thisArg) {', + ' var index = -1,', + ' length = array ? array.length : 0,', + ' result = [],', + ' seen = result;', + '', + " if (typeof isSorted != 'boolean' && isSorted != null) {", + ' thisArg = callback;', + ' callback = isSorted;', + ' isSorted = false;', + ' }', + ' if (callback != null) {', + ' seen = [];', + ' callback = lodash.createCallback(callback, thisArg);', + ' }', + ' while (++index < length) {', + ' var value = array[index],', + ' computed = callback ? callback(value, index, array) : value;', + '', + ' if (isSorted', + ' ? !index || seen[seen.length - 1] !== computed', + ' : indexOf(seen, computed) < 0', + ' ) {', + ' if (callback) {', + ' seen.push(computed);', + ' }', + ' result.push(value);', + ' }', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.uniqueId` - source = replaceFunction(source, 'uniqueId', [ - 'function uniqueId(prefix) {', - " var id = ++idCounter + '';", - ' return prefix ? prefix + id : id;', - '}' - ].join('\n')); - + if (!useLodashMethod('uniqueId')) { + source = replaceFunction(source, 'uniqueId', [ + 'function uniqueId(prefix) {', + " var id = ++idCounter + '';", + ' return prefix ? prefix + id : id;', + '}' + ].join('\n')); + } // replace `_.where` - source = replaceFunction(source, 'where', [ - 'function where(collection, properties, first) {', - ' return (first && isEmpty(properties))', - ' ? null', - ' : (first ? find : filter)(collection, properties);', - '}' - ].join('\n')); + if (!useLodashMethod('where')) { + source = replaceFunction(source, 'where', [ + 'function where(collection, properties, first) {', + ' return (first && isEmpty(properties))', + ' ? null', + ' : (first ? find : filter)(collection, properties);', + '}' + ].join('\n')); + } + // replace `_.zip` + if (!useLodashMethod('unzip')) { + source = replaceFunction(source, 'zip', [ + 'function zip(array) {', + ' var index = -1,', + " length = array ? max(pluck(arguments, 'length')) : 0,", + ' result = Array(length < 0 ? 0 : length);', + '', + ' while (++index < length) {', + ' result[index] = pluck(arguments, index);', + ' }', + ' return result;', + '}' + ].join('\n')); + } // unexpose `lodash.support` source = source.replace(/lodash\.support *= */, ''); - // remove `_.templateSettings.imports assignment - source = source.replace(/,[^']*'imports':[^}]+}/, ''); - // remove large array optimizations source = removeFunction(source, 'cachedContains'); @@ -2756,24 +2813,12 @@ var snippet = getMethodAssignments(source), modified = snippet; - if (!useLodashMethod('assign')) { - modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.assign *=.+\n/m, ''); - } - if (!useLodashMethod('createCallback')) { - modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.createCallback *=.+\n/m, ''); - } - if (!useLodashMethod('forIn')) { - modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.forIn *=.+\n/m, ''); - } - if (!useLodashMethod('forOwn')) { - modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.forOwn *=.+\n/m, ''); - } - if (!useLodashMethod('isPlainObject')) { - modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.isPlainObject *=.+\n/m, ''); - } - if (!useLodashMethod('zipObject')) { - modified = modified.replace(/^(?: *\/\/.*\s*)* *lodash\.zipObject *=.+\n/m, ''); - } + _.each(['assign', 'createCallback', 'forIn', 'forOwn', 'isPlainObject', 'zipObject'], function(methodName) { + if (!useLodashMethod(methodName)) { + modified = modified.replace(RegExp('^(?: *//.*\\s*)* *lodash\\.' + methodName + ' *=.+\\n', 'm'), ''); + } + }); + source = source.replace(snippet, function() { return modified; }); From 37ffe63d13d33c0a955ec8cfb8e99c07642be69a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 7 May 2013 09:24:12 -0700 Subject: [PATCH 013/117] Rename `arrayRef` to `arrayProto` in build.js. Former-commit-id: fec054f96a4972173cb638ee77a7a0d1813c9ad4 --- build.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/build.js b/build.js index b1b470d9fc..6a4751cf15 100755 --- a/build.js +++ b/build.js @@ -18,16 +18,16 @@ var cwd = process.cwd(); /** Used for array method references */ - var arrayRef = []; + var arrayProto = Array.prototype; /** Shortcut used to push arrays of values to an array */ - var push = arrayRef.push; + var push = arrayProto.push; /** Used to detect the Node.js executable in command-line arguments */ var reNode = RegExp('(?:^|' + path.sepEscaped + ')node(?:\\.exe)?$'); /** Shortcut used to convert array-like objects to arrays */ - var slice = arrayRef.slice; + var slice = arrayProto.slice; /** Shortcut to the `stdout` object */ var stdout = process.stdout; @@ -406,7 +406,7 @@ return indent + [ '// add `Array` mutator functions to the wrapper', funcName + "(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {", - ' var func = arrayRef[methodName];', + ' var func = arrayProto[methodName];', ' lodash.prototype[methodName] = function() {', ' var value = this.__wrapped__;', ' func.apply(value, arguments);', @@ -422,7 +422,7 @@ '', '// add `Array` accessor functions to the wrapper', funcName + "(['concat', 'join', 'slice'], function(methodName) {", - ' var func = arrayRef[methodName];', + ' var func = arrayProto[methodName];', ' lodash.prototype[methodName] = function() {', ' var value = this.__wrapped__,', ' result = func.apply(value, arguments);', @@ -2172,7 +2172,7 @@ 'function difference(array) {', ' var index = -1,', ' length = array.length,', - ' flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', + ' flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', ' result = [];', '', ' while (++index < length) {', @@ -2357,7 +2357,7 @@ if (!useLodashMethod('omit')) { source = replaceFunction(source, 'omit', [ 'function omit(object) {', - ' var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', + ' var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', ' result = {};', '', ' forIn(object, function(value, key) {', @@ -2374,7 +2374,7 @@ source = replaceFunction(source, 'pick', [ 'function pick(object) {', ' var index = -1,', - ' props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', + ' props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', ' length = props.length,', ' result = {};', '', From 1dfebad790d9e4b9ad938bd8824cabd231f56f7d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 7 May 2013 22:14:47 -0700 Subject: [PATCH 014/117] Add a space before `define` in the minified files so Dojo builder will detect it properly. Former-commit-id: 3c656ba3b2dd4771eab97c259840c2f426e2454c --- build/post-compile.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/post-compile.js b/build/post-compile.js index 2d1da80be6..0ee398d7f9 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -44,6 +44,11 @@ return (other ? other + ' ' : '') + expression + equality + type; }); + // add a space so `define` is detected by the Dojo builder + source = source.replace(/.define\(/, function(match) { + return (/^\S/.test(match) ? ' ' : '') + match; + }); + // add trailing semicolon if (source) { source = source.replace(/[\s;]*?(\s*\/\/.*\s*|\s*\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/\s*)*$/, ';$1'); From e1c8e95e11e1acddccc1505503b0196a0ef01a72 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 7 May 2013 23:31:29 -0700 Subject: [PATCH 015/117] Tweak whitespace in `iteratorTemplate`. Former-commit-id: 2f9fdbd72d316a1668d34fa95a3f1ecb325d625b --- lodash.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lodash.js b/lodash.js index 241693e9f6..42973fce79 100644 --- a/lodash.js +++ b/lodash.js @@ -512,10 +512,10 @@ // exit early if the first argument is falsey 'if (!iterable) return result;\n' + // add code before the iteration branches - '<%= top %>;\n' + + '<%= top %>;' + // array-like iteration: - '<% if (arrays) { %>' + + '<% if (arrays) { %>\n' + 'var length = iterable.length; index = -1;\n' + 'if (<%= arrays %>) {' + @@ -535,7 +535,7 @@ // object iteration: // add support for iterating over `arguments` objects if needed - ' <% } else if (support.nonEnumArgs) { %>\n' + + ' <% } else if (support.nonEnumArgs) { %>\n' + ' var length = iterable.length; index = -1;\n' + ' if (length && isArguments(iterable)) {\n' + ' while (++index < length) {\n' + From 4fada52e045a2ad5e2a23cd452194e796c486e71 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 7 May 2013 23:34:17 -0700 Subject: [PATCH 016/117] Remove `nonEnumProps` from the modernish builds. Former-commit-id: 38592e1ee24524b223b801ede8033d7b4ccb8a36 --- build.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build.js b/build.js index 6a4751cf15..7ea8d9468f 100755 --- a/build.js +++ b/build.js @@ -1228,9 +1228,13 @@ */ function removeSupportNonEnumShadows(source) { source = removeSupportProp(source, 'nonEnumShadows'); + source = removeVar(source, 'nonEnumProps'); source = removeVar(source, 'shadowedProps'); source = removeFromCreateIterator(source, 'shadowedProps'); + // remove nested `nonEnumProps` assignments + source = source.replace(/^ *\(function[\s\S]+?\n *var length\b[\s\S]+?shadowedProps[\s\S]+?}\(\)\);\n/m, ''); + // remove `support.nonEnumShadows` from `iteratorTemplate` source = source.replace(getIteratorTemplate(source), function(match) { return match.replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.nonEnumShadows[\s\S]+?["']\1<% *} *%>.+/, ''); @@ -1382,7 +1386,7 @@ */ function removeVar(source, varName) { // simplify complex variable assignments - if (/^(?:cloneableClasses|contextProps|ctorByClass|shadowedProps|whitespace)$/.test(varName)) { + if (/^(?:cloneableClasses|contextProps|ctorByClass|nonEnumProps|shadowedProps|whitespace)$/.test(varName)) { source = source.replace(RegExp('(var ' + varName + ' *=)[\\s\\S]+?;\\n\\n'), '$1=null;\n\n'); } From 5acfa2bf3a2ef51c78f5423c2202451726bc08f5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 7 May 2013 23:49:30 -0700 Subject: [PATCH 017/117] Remove `_.unzip` from the `underscore` build. Former-commit-id: 6d0accb64f39b08b72e3165c49a8c844a7a99cd3 --- build.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.js b/build.js index 7ea8d9468f..fba4d6c24e 100755 --- a/build.js +++ b/build.js @@ -2812,12 +2812,12 @@ }); }); } - // remove `_.assign`, `_.forIn`, `_.forOwn`, `_.isPlainObject`, and `_.zipObject` assignments + // remove `_.assign`, `_.forIn`, `_.forOwn`, `_.isPlainObject`, `_.unzip`, and `_.zipObject` assignments (function() { var snippet = getMethodAssignments(source), modified = snippet; - _.each(['assign', 'createCallback', 'forIn', 'forOwn', 'isPlainObject', 'zipObject'], function(methodName) { + _.each(['assign', 'createCallback', 'forIn', 'forOwn', 'isPlainObject', 'unzip', 'zipObject'], function(methodName) { if (!useLodashMethod(methodName)) { modified = modified.replace(RegExp('^(?: *//.*\\s*)* *lodash\\.' + methodName + ' *=.+\\n', 'm'), ''); } From 80934ea23253227d37d7e9b978c79733508258a8 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 8 May 2013 00:59:37 -0700 Subject: [PATCH 018/117] Fix build. Former-commit-id: 114ddcfec3e9bd4bccf481e8ec943ffdead2bb24 --- build/post-compile.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/post-compile.js b/build/post-compile.js index 0ee398d7f9..2d37963932 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -45,8 +45,8 @@ }); // add a space so `define` is detected by the Dojo builder - source = source.replace(/.define\(/, function(match) { - return (/^\S/.test(match) ? ' ' : '') + match; + source = source.replace(/(.)(define\()/, function(match, prelude, define) { + return prelude + (/^\S/.test(prelude) ? ' ' : '') + define; }); // add trailing semicolon From 5ff9b02c897587dfafd9553ebbbc2d7cc7705597 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 8 May 2013 01:05:03 -0700 Subject: [PATCH 019/117] Rebuild files and docs. Former-commit-id: 697fc5842bb6099f48e3731940c9e329452850d2 --- build/pre-compile.js | 1 + dist/lodash.compat.js | 150 +++++++++++---------- dist/lodash.compat.min.js | 82 ++++++------ dist/lodash.js | 113 ++++++---------- dist/lodash.min.js | 76 +++++------ dist/lodash.underscore.js | 71 ++++++---- dist/lodash.underscore.min.js | 42 +++--- doc/README.md | 246 +++++++++++++++++----------------- 8 files changed, 396 insertions(+), 385 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index f583edde9b..107b281b3e 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -31,6 +31,7 @@ 'nonEnum', 'nonEnumProps', 'object', + 'objectClass', 'objectProto', 'objectTypes', 'ownIndex', diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index a9db586aec..19d8499cea 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -82,9 +82,9 @@ /** Used to assign default `context` object properties */ var contextProps = [ - 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', 'RegExp', - 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', 'parseInt', - 'setImmediate', 'setTimeout' + 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', + 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', + 'parseInt', 'setImmediate', 'setTimeout' ]; /** Used to fix the JScript [[DontEnum]] bug */ @@ -101,6 +101,7 @@ arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', + errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', @@ -158,6 +159,7 @@ var Array = context.Array, Boolean = context.Boolean, Date = context.Date, + Error = context.Error, Function = context.Function, Math = context.Math, Number = context.Number, @@ -167,15 +169,17 @@ TypeError = context.TypeError; /** Used for `Array` and `Object` method references */ - var arrayRef = Array(), - objectRef = Object(); + var arrayProto = Array.prototype, + errorProto = Error.prototype, + objectProto = Object.prototype, + stringProto = String.prototype; /** Used to restore the original `_` reference in `noConflict` */ var oldDash = context._; /** Used to detect if a method is native */ var reNative = RegExp('^' + - String(objectRef.valueOf) + String(objectProto.valueOf) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/valueOf|for [^\]]+/g, '.+?') + '$' ); @@ -183,14 +187,14 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, - concat = arrayRef.concat, + concat = arrayProto.concat, floor = Math.floor, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - hasOwnProperty = objectRef.hasOwnProperty, - push = arrayRef.push, + hasOwnProperty = objectProto.hasOwnProperty, + push = arrayProto.push, setImmediate = context.setImmediate, setTimeout = context.setTimeout, - toString = objectRef.toString; + toString = objectProto.toString; /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, @@ -202,7 +206,7 @@ nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, - nativeSlice = arrayRef.slice; + nativeSlice = arrayProto.slice; /** Detect various environments */ var isIeOpera = reNative.test(context.attachEvent), @@ -213,11 +217,32 @@ ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; ctorByClass[dateClass] = Date; + ctorByClass[errorClass] = Error; + ctorByClass[funcClass] = Function; ctorByClass[objectClass] = Object; ctorByClass[numberClass] = Number; ctorByClass[regexpClass] = RegExp; ctorByClass[stringClass] = String; + /** Used to avoid iterating non-enumerable properties in IE < 9 */ + var nonEnumProps = {}; + nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; + nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; + nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; + nonEnumProps[objectClass] = { 'constructor': true }; + + (function() { + var length = shadowedProps.length; + while (length--) { + var prop = shadowedProps[length]; + for (var className in nonEnumProps) { + if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], prop)) { + nonEnumProps[className][prop] = false; + } + } + } + }()); + /*--------------------------------------------------------------------------*/ /** @@ -382,7 +407,7 @@ * @memberOf _.support * @type Boolean */ - support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); + support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]); /** * Detect lack of support for accessing string characters by index. @@ -488,9 +513,9 @@ (obj.init) + ';\nif (!iterable) return result;\n' + (obj.top) + - ';\n'; + ';'; if (obj.arrays) { - __p += 'var length = iterable.length; index = -1;\nif (' + + __p += '\nvar length = iterable.length; index = -1;\nif (' + (obj.arrays) + ') { '; if (support.unindexedChars) { @@ -499,7 +524,7 @@ __p += '\n while (++index < length) {\n ' + (obj.loop) + '\n }\n}\nelse { '; - } else if (support.nonEnumArgs) { + } else if (support.nonEnumArgs) { __p += '\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += \'\';\n ' + (obj.loop) + '\n }\n } else { '; @@ -541,19 +566,19 @@ } __p += '\n } '; if (support.nonEnumShadows) { - __p += '\n\n var ctor = iterable.constructor;\n '; - for (var k = 0; k < 7; k++) { - __p += '\n index = \'' + + __p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n proto = ctor && ctor.prototype,\n isProto = iterable === proto,\n nonEnum = nonEnumProps[objectClass];\n\n if (isProto) {\n var className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[iterable === (ctorByClass[className] && ctorByClass[className].prototype) ? className : objectClass];\n }\n '; + for (k = 0; k < 7; k++) { + __p += '\n index = \'' + (obj.shadowedProps[k]) + - '\';\n if ('; - if (obj.shadowedProps[k] == 'constructor') { - __p += '!(ctor && ctor.prototype === iterable) && '; - } - __p += 'hasOwnProperty.call(iterable, index)) {\n ' + + '\';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))'; + if (!obj.useHas) { + __p += ' || (!nonEnum[index] && iterable[index] !== objectProto[index])'; + } + __p += ') {\n ' + (obj.loop) + - '\n } '; + '\n } '; } - + __p += '\n } '; } } @@ -749,7 +774,7 @@ // data properties 'shadowedProps': shadowedProps, // iterator options - 'arrays': 'isArray(iterable)', + 'arrays': '', 'bottom': '', 'init': 'iterable', 'loop': '', @@ -769,14 +794,16 @@ // create the function factory var factory = Function( - 'hasOwnProperty, isArguments, isArray, isString, keys, ' + - 'lodash, objectTypes', + 'ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, ' + + 'isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, ' + + 'nonEnumProps, stringClass, stringProto, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( - hasOwnProperty, isArguments, isArray, isString, keys, - lodash, objectTypes + ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, + isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, + nonEnumProps, stringClass, stringProto, toString ); } @@ -979,8 +1006,7 @@ 'args': 'object', 'init': '[]', 'top': 'if (!(objectTypes[typeof object])) return result', - 'loop': 'result.push(index)', - 'arrays': false + 'loop': 'result.push(index)' }); /** @@ -1802,7 +1828,7 @@ // http://es5.github.com/#x8 // and avoid a V8 bug // http://code.google.com/p/v8/issues/detail?id=2291 - return value ? objectTypes[typeof value] : false; + return !!(value && objectTypes[typeof value]); } /** @@ -1923,7 +1949,7 @@ * // => true */ function isRegExp(value) { - return value ? (objectTypes[typeof value] && toString.call(value) == regexpClass) : false; + return !!(value && objectTypes[typeof value]) && toString.call(value) == regexpClass; } /** @@ -2131,7 +2157,7 @@ if (isFunc) { callback = lodash.createCallback(callback, thisArg); } else { - var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)); + var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)); } forIn(object, function(value, key, object) { if (isFunc @@ -2200,7 +2226,7 @@ var result = {}; if (typeof callback != 'function') { var index = -1, - props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), length = isObject(object) ? props.length : 0; while (++index < length) { @@ -2270,7 +2296,7 @@ */ function at(collection) { var index = -1, - props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), length = props.length, result = Array(length); @@ -3312,7 +3338,7 @@ function difference(array) { var index = -1, length = array ? array.length : 0, - flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), contains = cachedContains(flattened), result = []; @@ -3989,9 +4015,9 @@ */ function union(array) { if (!isArray(array)) { - arguments[0] = array ? nativeSlice.call(array) : arrayRef; + arguments[0] = array ? nativeSlice.call(array) : arrayProto; } - return uniq(concat.apply(arrayRef, arguments)); + return uniq(concat.apply(arrayProto, arguments)); } /** @@ -4097,17 +4123,11 @@ */ function unzip(array) { var index = -1, - length = array ? array.length : 0, - tupleLength = length ? max(pluck(array, 'length')) : 0, - result = Array(tupleLength); + length = array ? max(pluck(array, 'length')) : 0, + result = Array(length < 0 ? 0 : length); while (++index < length) { - var tupleIndex = -1, - tuple = array[index]; - - while (++tupleIndex < tupleLength) { - (result[tupleIndex] || (result[tupleIndex] = Array(length)))[index] = tuple[tupleIndex]; - } + result[index] = pluck(array, index); } return result; } @@ -4148,14 +4168,7 @@ * // => [['moe', 30, true], ['larry', 40, false]] */ function zip(array) { - var index = -1, - length = array ? max(pluck(arguments, 'length')) : 0, - result = Array(length); - - while (++index < length) { - result[index] = pluck(arguments, index); - } - return result; + return array ? unzip(arguments) : []; } /** @@ -4281,7 +4294,7 @@ * // => alerts 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), + var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; @@ -4486,15 +4499,16 @@ */ function debounce(func, wait, options) { var args, - inited, result, thisArg, timeoutId, + callCount = 0, trailing = true; function delayed() { - inited = timeoutId = null; - if (trailing) { + var isCalled = trailing && (!leading || callCount > 1); + callCount = timeoutId = 0; + if (isCalled) { result = func.apply(thisArg, args); } } @@ -4510,12 +4524,10 @@ thisArg = this; clearTimeout(timeoutId); - if (!inited && leading) { - inited = true; + if (leading && ++callCount < 2) { result = func.apply(thisArg, args); - } else { - timeoutId = setTimeout(delayed, wait); } + timeoutId = setTimeout(delayed, wait); return result; }; } @@ -5461,7 +5473,7 @@ // add `Array` functions that return unwrapped values each(['join', 'pop', 'shift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return func.apply(this.__wrapped__, arguments); }; @@ -5469,7 +5481,7 @@ // add `Array` functions that return the wrapped value each(['push', 'reverse', 'sort', 'unshift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; @@ -5478,7 +5490,7 @@ // add `Array` functions that return new wrapped values each(['concat', 'slice', 'splice'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments)); }; @@ -5488,7 +5500,7 @@ // in Firefox < 10 and IE < 9 if (!support.spliceObjects) { each(['pop', 'shift', 'splice'], function(methodName) { - var func = arrayRef[methodName], + var func = arrayProto[methodName], isSplice = methodName == 'splice'; lodash.prototype[methodName] = function() { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 1dba81c94a..8c3f134157 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,44 +4,44 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!me(n)&&Qt.call(n,"__wrapped__")?n:new V(n)}function R(n){var t=n.length,e=t>=l;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(nu;u++)r+="i='"+t.g[u]+"';if(","constructor"==t.g[u]&&(r+="!(f&&f.prototype===m)&&"),r+="h.call(m,i)){"+t.f+"}"}return(t.b||ve.nonEnumArgs)&&(r+="}"),r+=t.c+";return u",e("h,j,k,l,o,p,r","return function("+n+"){"+r+"}")(Qt,W,me,ut,be,a,q) -}function K(n){return"\\"+B[n]}function M(n){return we[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function G(){}function H(n){var t=!1;if(!n||Zt.call(n)!=I||!ve.argsClass&&W(n))return t;var e=n.constructor;return(tt(e)?e instanceof e:ve.nodeClass||!U(n))?ve.ownLast?(xe(n,function(n,e,r){return t=Qt.call(r,e),!1}),!0===t):(xe(n,function(n,e){t=e}),!1===t||Qt.call(n,t)):t}function J(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0); -var r=-1;e=e-t||0;for(var u=It(0>e?0:e);++re?ae(0,u+e):e)||0,typeof u=="number"?a=-1<(ut(n)?n.indexOf(t,e):_t(n,t,e)):_e(n,function(n){return++ru&&(u=i)}}else t=!t&&ut(n)?T:a.createCallback(t,e),_e(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n) -});return u}function gt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),me(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++oarguments.length;if(typeof o!="number")var f=be(n),o=f.length;else ve.unindexedChars&&ut(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),pt(n,function(n,r,a){r=f?f[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function ht(n,t,e){var r; -if(t=a.createCallback(t,e),me(n)){e=-1;for(var u=n.length;++ee?ae(0,u+e):e||0)-1;else if(e)return r=Ct(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=l;if(p)var s={};for(null!=e&&(c=[],e=a.createCallback(e,r));++u_t(c,v))&&((e||p)&&c.push(v),i.push(r))}return i}function kt(n,t){for(var e=-1,r=n?n.length:0,u={};++e/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:h,variable:"",imports:{_:a}};var ge={a:"q,w,g",h:"var a=arguments,b=0,c=typeof g=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Ce=Z(we),je=L(ge,{h:ge.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=p.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"u[i]=d?d(u[i],m[i]):m[i]"}),ke=L(ge),xe=L(ye,he,{i:!1}),Oe=L(ye,he); -tt(/x/)&&(tt=function(n){return typeof n=="function"&&Zt.call(n)==S});var Ee=Jt?function(n){if(!n||Zt.call(n)!=I||!ve.argsClass&&W(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=Jt(t))&&Jt(e);return e?n==e||Jt(n)==e:H(n)}:H;pe&&u&&typeof Xt=="function"&&(Ot=xt(Xt,r));var Se=8==ie(m+"08")?ie:function(n,t){return ie(ut(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=je,a.at=function(n){var t=-1,e=Gt.apply(zt,le.call(arguments,1)),r=e.length,u=It(r); -for(ve.unindexedChars&&ut(n)&&(n=n.split(""));++t=l,i=[],c=i;n:for(;++u_t(c,p)){o&&c.push(p); -for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=Z,a.invoke=function(n,t){var e=le.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=It(typeof a=="number"?a:0);return pt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=be,a.map=st,a.max=vt,a.memoize=function(n,t){var e={};return function(){var r=f+(t?t.apply(this,arguments):arguments[0]);return Qt.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},a.merge=at,a.min=function(n,t,e){var r=1/0,u=r; -if(!t&&me(n)){e=-1;for(var o=n.length;++e_t(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=be(n),r=e.length,u=It(r);++te?ae(0,r+e):oe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=St,a.noConflict=function(){return r._=Kt,this},a.parseInt=Se,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Ht(fe()*((+t||0)-n+1))},a.reduce=gt,a.reduceRight=yt,a.result=function(n,t){var r=n?n[t]:e;return tt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:be(n).length},a.some=ht,a.sortedIndex=Ct,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=ke({},r,u);var o,i=ke({},r.imports,u.imports),u=be(i),i=ot(i),f=0,l=r.interpolate||b,v="__p+='",l=Rt((r.escape||b).source+"|"+l.source+"|"+(l===h?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(l,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(f,i).replace(w,K),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),f=i+t.length,t -}),v+="';\n",l=r=r.variable,l||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(c,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var y=$t(u,"return "+v).apply(e,i)}catch(m){throw m.source=v,m}return t?y(t):(y.source=v,y)},a.unescape=function(n){return null==n?"":Tt(n).replace(v,Q)},a.uniqueId=function(n){var t=++o;return Tt(null==n?"":n)+t -},a.all=ft,a.any=ht,a.detect=ct,a.foldl=gt,a.foldr=yt,a.include=it,a.inject=gt,Oe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return Wt.apply(t,arguments),n.apply(a,t)})}),a.first=dt,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return J(n,ae(0,u-r))}},a.take=dt,a.head=dt,Oe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return null==t||e&&typeof t!="function"?r:new V(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Tt(this.__wrapped__)},a.prototype.value=At,a.prototype.valueOf=At,_e(["join","pop","shift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),_e(["push","reverse","sort","unshift"],function(n){var t=zt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),_e(["concat","slice","splice"],function(n){var t=zt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments)) -}}),ve.spliceObjects||_e(["pop","shift","splice"],function(n){var t=zt[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new V(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},f=+new Date+"",l=200,c=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,y=/\w*$/,h=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),k="[object Arguments]",x="[object Array]",O="[object Boolean]",E="[object Date]",S="[object Function]",A="[object Number]",I="[object Object]",P="[object RegExp]",N="[object String]",$={}; -$[S]=!1,$[k]=$[x]=$[O]=$[E]=$[A]=$[I]=$[P]=$[N]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},B={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},F=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=F,define(function(){return F})):r&&!r.nodeType?u?(u.exports=F)._=F:r._=F:n._=F})(this); \ No newline at end of file +;(function(n){function t(e){function a(n){return n&&typeof n=="object"&&!kr(n)&&tr.call(n,"__wrapped__")?n:new U(n)}function R(n){var t=n.length,r=t>=c;if(r)for(var e={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==z[m])"),e+="){"+t.f+"}"; +e+="}"}return(t.b||_r.nonEnumArgs)&&(e+="}"),e+=t.c+";return E",r("h,i,j,l,n,o,q,t,u,y,z,A,w,H,I,K","return function("+n+"){"+e+"}")(dr,A,Mt,tr,Y,kr,ot,Er,a,B,Gt,q,br,F,Ut,ar)}function H(n){return"\\"+z[n]}function M(n){return Sr[n]}function G(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function U(n){this.__wrapped__=n}function V(){}function Q(n){var t=!1;if(!n||ar.call(n)!=B||!_r.argsClass&&Y(n))return t;var r=n.constructor;return(et(r)?r instanceof r:_r.nodeClass||!G(n))?_r.ownLast?(Br(n,function(n,r,e){return t=tr.call(e,r),!1 +}),!0===t):(Br(n,function(n,r){t=r}),!1===t||tr.call(n,t)):t}function W(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Nt(0>r?0:r);++er?pr(0,u+r):r)||0,typeof u=="number"?a=-1<(ot(n)?n.indexOf(t,r):Ct(n,t,r)):Or(n,function(n){return++eu&&(u=i)}}else t=!t&&ot(n)?T:a.createCallback(t,r),Or(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n) +});return u}function ht(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),kr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var f=Er(n),o=f.length;else _r.unindexedChars&&ot(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),vt(n,function(n,e,a){e=f?f[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function dt(n,t,r){var e; +if(t=a.createCallback(t,r),kr(n)){r=-1;for(var u=n.length;++rr?pr(0,u+r):r||0)-1;else if(r)return e=kt(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])=c;if(p)var s={};for(null!=r&&(l=[],r=a.createCallback(r,e));++uCt(l,v))&&((r||p)&&l.push(v),i.push(e))}return i}function Et(n){for(var t=-1,r=n?yt($r(n,"length")):0,e=Nt(0>r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:h,variable:"",imports:{_:a}}; +var wr={a:"x,G,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Ar=tt(Sr),Ir=J(wr,{h:wr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"E[m]=d?d(E[m],r[m]):r[m]"}),Pr=J(wr),Br=J(Cr,jr,{i:!1}),Nr=J(Cr,jr);et(/x/)&&(et=function(n){return typeof n=="function"&&ar.call(n)==I});var Fr=nr?function(n){if(!n||ar.call(n)!=B||!_r.argsClass&&Y(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=nr(t))&&nr(r); +return r?n==r||nr(n)==r:Q(n)}:Q,$r=gt;mr&&u&&typeof er=="function"&&(At=St(er,e));var qr=8==vr(m+"08")?vr:function(n,t){return vr(ot(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ir,a.at=function(n){var t=-1,r=Yt.apply(Ht,yr.call(arguments,1)),e=r.length,u=Nt(e);for(_r.unindexedChars&&ot(n)&&(n=n.split(""));++t++f&&(a=n.apply(o,u)),i=ur(e,t),a}},a.defaults=Pr,a.defer=At,a.delay=function(n,t){var e=yr.call(arguments,2);return ur(function(){n.apply(r,e)},t)},a.difference=bt,a.filter=pt,a.flatten=wt,a.forEach=vt,a.forIn=Br,a.forOwn=Nr,a.functions=nt,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),vt(n,function(n,r,u){r=Lt(t(n,r,u)),(tr.call(e,r)?e[r]:e[r]=[]).push(n)}),e +},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return W(n,0,sr(pr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e={0:{}},u=-1,a=n?n.length:0,o=a>=c,i=[],l=i;n:for(;++uCt(l,p)){o&&l.push(p);for(var v=r;--v;)if(!(e[v]||(e[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=tt,a.invoke=function(n,t){var r=yr.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Nt(typeof a=="number"?a:0); +return vt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},a.keys=Er,a.map=gt,a.max=yt,a.memoize=function(n,t){var r={};return function(){var e=f+(t?t.apply(this,arguments):arguments[0]);return tr.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},a.merge=it,a.min=function(n,t,r){var e=1/0,u=e;if(!t&&kr(n)){r=-1;for(var o=n.length;++rCt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Er(n),e=r.length,u=Nt(e);++tr?pr(0,e+r):sr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Pt,a.noConflict=function(){return e._=Vt,this},a.parseInt=qr,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Zt(gr()*((+t||0)-n+1)) +},a.reduce=ht,a.reduceRight=mt,a.result=function(n,t){var e=n?n[t]:r;return et(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Er(n).length},a.some=dt,a.sortedIndex=kt,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Pr({},e,u);var o,i=Pr({},e.imports,u.imports),u=Er(i),i=ft(i),f=0,c=e.interpolate||b,v="__p+='",c=Kt((e.escape||b).source+"|"+c.source+"|"+(c===h?g:b).source+"|"+(e.evaluate||b).source+"|$","g");n.replace(c,function(t,r,e,u,a,i){return e||(e=u),v+=n.slice(f,i).replace(w,H),r&&(v+="'+__e("+r+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),e&&(v+="'+((__t=("+e+"))==null?'':__t)+'"),f=i+t.length,t +}),v+="';\n",c=e=e.variable,c||(e="obj",v="with("+e+"){"+v+"}"),v=(o?v.replace(l,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+e+"){"+(c?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var y=zt(u,"return "+v).apply(r,i)}catch(m){throw m.source=v,m}return t?y(t):(y.source=v,y)},a.unescape=function(n){return null==n?"":Lt(n).replace(v,X)},a.uniqueId=function(n){var t=++o;return Lt(null==n?"":n)+t +},a.all=lt,a.any=dt,a.detect=st,a.foldl=ht,a.foldr=mt,a.include=ct,a.inject=ht,Nr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return rr.apply(t,arguments),n.apply(a,t)})}),a.first=_t,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return W(n,pr(0,u-e))}},a.take=_t,a.head=_t,Nr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); +return null==t||r&&typeof t!="function"?e:new U(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Lt(this.__wrapped__)},a.prototype.value=Bt,a.prototype.valueOf=Bt,Or(["join","pop","shift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Or(["push","reverse","sort","unshift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Or(["concat","slice","splice"],function(n){var t=Ht[n];a.prototype[n]=function(){return new U(t.apply(this.__wrapped__,arguments)) +}}),_r.spliceObjects||Or(["pop","shift","splice"],function(n){var t=Ht[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new U(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},f=+new Date+"",c=200,l=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,y=/\w*$/,h=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",I="[object Function]",P="[object Number]",B="[object Object]",N="[object RegExp]",F="[object String]",$={}; +$[I]=!1,$[x]=$[E]=$[O]=$[S]=$[P]=$[B]=$[N]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=D, define(function(){return D})):e&&!e.nodeType?u?(u.exports=D)._=D:e._=D:n._=D})(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index c20653549e..dd308ddb38 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -82,9 +82,9 @@ /** Used to assign default `context` object properties */ var contextProps = [ - 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', 'RegExp', - 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', 'parseInt', - 'setImmediate', 'setTimeout' + 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', + 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', + 'parseInt', 'setImmediate', 'setTimeout' ]; /** Used to make template sourceURLs easier to identify */ @@ -95,6 +95,7 @@ arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', + errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', @@ -152,6 +153,7 @@ var Array = context.Array, Boolean = context.Boolean, Date = context.Date, + Error = context.Error, Function = context.Function, Math = context.Math, Number = context.Number, @@ -161,15 +163,17 @@ TypeError = context.TypeError; /** Used for `Array` and `Object` method references */ - var arrayRef = Array(), - objectRef = Object(); + var arrayProto = Array.prototype, + errorProto = Error.prototype, + objectProto = Object.prototype, + stringProto = String.prototype; /** Used to restore the original `_` reference in `noConflict` */ var oldDash = context._; /** Used to detect if a method is native */ var reNative = RegExp('^' + - String(objectRef.valueOf) + String(objectProto.valueOf) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/valueOf|for [^\]]+/g, '.+?') + '$' ); @@ -177,14 +181,14 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, - concat = arrayRef.concat, + concat = arrayProto.concat, floor = Math.floor, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - hasOwnProperty = objectRef.hasOwnProperty, - push = arrayRef.push, + hasOwnProperty = objectProto.hasOwnProperty, + push = arrayProto.push, setImmediate = context.setImmediate, setTimeout = context.setTimeout, - toString = objectRef.toString; + toString = objectProto.toString; /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, @@ -196,7 +200,7 @@ nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, - nativeSlice = arrayRef.slice; + nativeSlice = arrayProto.slice; /** Detect various environments */ var isIeOpera = reNative.test(context.attachEvent), @@ -207,6 +211,8 @@ ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; ctorByClass[dateClass] = Date; + ctorByClass[errorClass] = Error; + ctorByClass[funcClass] = Function; ctorByClass[objectClass] = Object; ctorByClass[numberClass] = Number; ctorByClass[regexpClass] = RegExp; @@ -660,8 +666,7 @@ var shimKeys = function (object) { var index, iterable = object, result = []; if (!iterable) return result; - if (!(objectTypes[typeof object])) return result; - + if (!(objectTypes[typeof object])) return result; for (index in iterable) { if (hasOwnProperty.call(iterable, index)) { result.push(index); @@ -754,14 +759,7 @@ } while (++argsIndex < argsLength) { iterable = args[argsIndex]; - if (iterable && objectTypes[typeof iterable]) {; - var length = iterable.length; index = -1; - if (isArray(iterable)) { - while (++index < length) { - result[index] = callback ? callback(result[index], iterable[index]) : iterable[index] - } - } - else { + if (iterable && objectTypes[typeof iterable]) {; var ownIndex = -1, ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], length = ownProps.length; @@ -770,7 +768,6 @@ index = ownProps[ownIndex]; result[index] = callback ? callback(result[index], iterable[index]) : iterable[index] } - } } }; return result @@ -975,14 +972,7 @@ argsLength = typeof guard == 'number' ? 2 : args.length; while (++argsIndex < argsLength) { iterable = args[argsIndex]; - if (iterable && objectTypes[typeof iterable]) {; - var length = iterable.length; index = -1; - if (isArray(iterable)) { - while (++index < length) { - if (typeof result[index] == 'undefined') result[index] = iterable[index] - } - } - else { + if (iterable && objectTypes[typeof iterable]) {; var ownIndex = -1, ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], length = ownProps.length; @@ -991,7 +981,6 @@ index = ownProps[ownIndex]; if (typeof result[index] == 'undefined') result[index] = iterable[index] } - } } }; return result @@ -1062,8 +1051,7 @@ var index, iterable = collection, result = iterable; if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; - callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); - + callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); for (index in iterable) { if (callback(iterable[index], index, collection) === false) return result; } @@ -1095,8 +1083,7 @@ var index, iterable = collection, result = iterable; if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; - callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); - + callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); var ownIndex = -1, ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], length = ownProps.length; @@ -1535,7 +1522,7 @@ // http://es5.github.com/#x8 // and avoid a V8 bug // http://code.google.com/p/v8/issues/detail?id=2291 - return value ? objectTypes[typeof value] : false; + return !!(value && objectTypes[typeof value]); } /** @@ -1864,7 +1851,7 @@ if (isFunc) { callback = lodash.createCallback(callback, thisArg); } else { - var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)); + var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)); } forIn(object, function(value, key, object) { if (isFunc @@ -1933,7 +1920,7 @@ var result = {}; if (typeof callback != 'function') { var index = -1, - props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), length = isObject(object) ? props.length : 0; while (++index < length) { @@ -2003,7 +1990,7 @@ */ function at(collection) { var index = -1, - props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), length = props.length, result = Array(length); @@ -3052,7 +3039,7 @@ function difference(array) { var index = -1, length = array ? array.length : 0, - flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), contains = cachedContains(flattened), result = []; @@ -3729,9 +3716,9 @@ */ function union(array) { if (!isArray(array)) { - arguments[0] = array ? nativeSlice.call(array) : arrayRef; + arguments[0] = array ? nativeSlice.call(array) : arrayProto; } - return uniq(concat.apply(arrayRef, arguments)); + return uniq(concat.apply(arrayProto, arguments)); } /** @@ -3837,17 +3824,11 @@ */ function unzip(array) { var index = -1, - length = array ? array.length : 0, - tupleLength = length ? max(pluck(array, 'length')) : 0, - result = Array(tupleLength); + length = array ? max(pluck(array, 'length')) : 0, + result = Array(length < 0 ? 0 : length); while (++index < length) { - var tupleIndex = -1, - tuple = array[index]; - - while (++tupleIndex < tupleLength) { - (result[tupleIndex] || (result[tupleIndex] = Array(length)))[index] = tuple[tupleIndex]; - } + result[index] = pluck(array, index); } return result; } @@ -3888,14 +3869,7 @@ * // => [['moe', 30, true], ['larry', 40, false]] */ function zip(array) { - var index = -1, - length = array ? max(pluck(arguments, 'length')) : 0, - result = Array(length); - - while (++index < length) { - result[index] = pluck(arguments, index); - } - return result; + return array ? unzip(arguments) : []; } /** @@ -4021,7 +3995,7 @@ * // => alerts 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), + var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; @@ -4226,15 +4200,16 @@ */ function debounce(func, wait, options) { var args, - inited, result, thisArg, timeoutId, + callCount = 0, trailing = true; function delayed() { - inited = timeoutId = null; - if (trailing) { + var isCalled = trailing && (!leading || callCount > 1); + callCount = timeoutId = 0; + if (isCalled) { result = func.apply(thisArg, args); } } @@ -4250,12 +4225,10 @@ thisArg = this; clearTimeout(timeoutId); - if (!inited && leading) { - inited = true; + if (leading && ++callCount < 2) { result = func.apply(thisArg, args); - } else { - timeoutId = setTimeout(delayed, wait); } + timeoutId = setTimeout(delayed, wait); return result; }; } @@ -5201,7 +5174,7 @@ // add `Array` functions that return unwrapped values forEach(['join', 'pop', 'shift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return func.apply(this.__wrapped__, arguments); }; @@ -5209,7 +5182,7 @@ // add `Array` functions that return the wrapped value forEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; @@ -5218,7 +5191,7 @@ // add `Array` functions that return new wrapped values forEach(['concat', 'slice', 'splice'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments)); }; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 3c4f07240c..c62cc0d35b 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,41 +4,41 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(o){function f(n){if(!n||ue.call(n)!=A)return a;var t=n.valueOf,e=typeof t=="function"&&(e=Zt(t))&&Zt(e);return e?n==e||Zt(n)==e:Y(n)}function D(n,t,e){if(!n||!R[typeof n])return n;t=t&&typeof e=="undefined"?t:U.createCallback(t,e);for(var r=-1,u=R[typeof n]?be(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(ne?0:e);++re?le(0,u+e):e)||0,typeof u=="number"?o=-1<(ft(n)?n.indexOf(t,e):xt(n,t,e)):D(n,function(n){return++ru&&(u=o) -}}else t=!t&&ft(n)?G:U.createCallback(t,e),yt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function bt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Rt(r);++earguments.length;t=U.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -if(typeof u!="number")var i=be(n),u=i.length;return t=U.createCallback(t,r,4),yt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function kt(n,t,e){var r;t=U.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?le(0,u+e):e||0)-1;else if(e)return r=Et(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(l)var v={};for(e!=u&&(c=[],e=U.createCallback(e,r));++oxt(c,g))&&((e||l)&&c.push(g),f.push(r))}return f}function Nt(n,t){for(var e=-1,r=n?n.length:0,u={};++e/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:U}},W.prototype=U.prototype;var me=oe,be=ce?function(n){return ot(n)?ce(n):[]}:M,de={"&":"&","<":"<",">":">",'"':""","'":"'"},_e=rt(de);return zt&&i&&typeof ee=="function"&&(At=St(ee,o)),Tt=8==se(_+"08")?se:function(n,t){return se(ft(n)?n.replace(k,""):n,t||0)},U.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},U.assign=K,U.at=function(n){for(var t=-1,e=Xt.apply(Gt,ge.call(arguments,1)),r=e.length,u=Rt(r);++t=s,i=[],f=i;n:for(;++uxt(f,c)){o&&f.push(c); -for(var v=e;--v;)if(!(r[v]||(r[v]=V(t[v])))(c))continue n;i.push(c)}}return i},U.invert=rt,U.invoke=function(n,t){var e=ge.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Rt(typeof a=="number"?a:0);return yt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},U.keys=be,U.map=ht,U.max=mt,U.memoize=function(n,t){var e={};return function(){var r=p+(t?t.apply(this,arguments):arguments[0]);return ne.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},U.merge=ct,U.min=function(n,t,e){var r=1/0,u=r; -if(!t&&me(n)){e=-1;for(var a=n.length;++ext(a,e))&&(u[e]=n)}),u},U.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},U.pairs=function(n){for(var t=-1,e=be(n),r=e.length,u=Rt(r);++te?le(0,r+e):pe(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},U.mixin=Bt,U.noConflict=function(){return o._=Jt,this},U.parseInt=Tt,U.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+Yt(ve()*((+t||0)-n+1))},U.reduce=dt,U.reduceRight=_t,U.result=function(n,t){var r=n?n[t]:e;return at(r)?n[t]():r},U.runInContext=t,U.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:be(n).length},U.some=kt,U.sortedIndex=Et,U.template=function(n,t,u){var a=U.templateSettings;n||(n=""),u=P({},u,a);var o,i=P({},u.imports,a.imports),a=be(i),i=lt(i),f=0,c=u.interpolate||w,l="__p+='",c=Mt((u.escape||w).source+"|"+c.source+"|"+(c===d?m:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,L),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t -}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Dt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},U.unescape=function(n){return n==u?"":Ut(n).replace(h,nt)},U.uniqueId=function(n){var t=++c;return Ut(n==u?"":n)+t -},U.all=st,U.any=kt,U.detect=gt,U.foldl=dt,U.foldr=_t,U.include=pt,U.inject=dt,D(U,function(n,t){U.prototype[t]||(U.prototype[t]=function(){var t=[this.__wrapped__];return te.apply(t,arguments),n.apply(U,t)})}),U.first=jt,U.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=U.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Z(n,le(0,a-r))}},U.take=jt,U.head=jt,D(U,function(n,t){U.prototype[t]||(U.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return t==u||e&&typeof t!="function"?r:new W(r)})}),U.VERSION="1.2.1",U.prototype.toString=function(){return Ut(this.__wrapped__)},U.prototype.value=Ft,U.prototype.valueOf=Ft,yt(["join","pop","shift"],function(n){var t=Gt[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),yt(["push","reverse","sort","unshift"],function(n){var t=Gt[n];U.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),yt(["concat","slice","splice"],function(n){var t=Gt[n];U.prototype[n]=function(){return new W(t.apply(this.__wrapped__,arguments)) -}}),U}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,m=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,b=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,j=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Number]",A="[object Object]",$="[object RegExp]",B="[object String]",F={"[object Function]":a}; -F[O]=F[E]=F[I]=F[N]=F[S]=F[A]=F[$]=F[B]=r;var R={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},T={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},q=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=q,define(function(){return q})):o&&!o.nodeType?i?(i.exports=q)._=q:o._=q:n._=q})(this); \ No newline at end of file +;(function(n){function t(o){function f(n){if(!n||fe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=re(t))&&re(e);return e?n==e||re(n)==e:nt(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?we(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; +if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(lt(n)?n.indexOf(t,e):Et(n,t,e)):P(n,function(n){return++ru&&(u=o) +}}else t=!t&<(n)?J:G.createCallback(t,e),bt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function _t(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=we(n),u=i.length;return t=G.createCallback(t,r,4),bt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=Nt(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(l)var v={};for(e!=u&&(c=[],e=G.createCallback(e,r));++oEt(c,g))&&((e||l)&&c.push(g),f.push(r))}return f}function At(n){for(var t=-1,e=n?dt(_t(n,"length")):0,r=Dt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,we=ve?function(n){return ft(n)?ve(n):[]}:V,je={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=at(je);return Ut&&i&&typeof oe=="function"&&(Ft=Bt(oe,o)),zt=8==he(_+"08")?he:function(n,t){return he(lt(n)?n.replace(k,""):n,t||0) +},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=te.apply(Qt,me.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(i=n.apply(f,o)),c=ie(u,t),i}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=me.call(arguments,2); +return ie(function(){n.apply(e,r)},t)},G.difference=Ct,G.filter=yt,G.flatten=Ot,G.forEach=bt,G.forIn=K,G.forOwn=P,G.functions=ut,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),bt(n,function(n,e,u){e=Jt(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return tt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; +n:for(;++uEt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=H(t[v])))(c))continue n;i.push(c)}}return i},G.invert=at,G.invoke=function(n,t){var e=me.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Dt(typeof a=="number"?a:0);return bt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},G.keys=we,G.map=mt,G.max=dt,G.memoize=function(n,t){var e={};return function(){var r=p+(t?t.apply(this,arguments):arguments[0]); +return ue.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},G.merge=pt,G.min=function(n,t,e){var r=1/0,u=r;if(!t&&ke(n)){e=-1;for(var a=n.length;++eEt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e) +}},G.pairs=function(n){for(var t=-1,e=we(n),r=e.length,u=Dt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+ee(be()*((+t||0)-n+1))},G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e;return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0; +return typeof t=="number"?t:we(n).length},G.some=jt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=we(i),i=st(i),f=0,c=u.interpolate||w,l="__p+='",c=Ht((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t +}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Mt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Jt(n).replace(h,et)},G.uniqueId=function(n){var t=++c;return Jt(n==u?"":n)+t +},G.all=gt,G.any=jt,G.detect=ht,G.foldl=kt,G.foldr=wt,G.include=vt,G.inject=kt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(G,t)})}),G.first=xt,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return tt(n,ge(0,a-r))}},G.take=xt,G.head=xt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); +return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Jt(this.__wrapped__)},G.prototype.value=qt,G.prototype.valueOf=qt,bt(["join","pop","shift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),bt(["push","reverse","sort","unshift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),bt(["concat","slice","splice"],function(n){var t=Qt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments)) +}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,j=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Error]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; +T[A]=a,T[O]=T[E]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z})(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 8f0b17d5b6..c02b05a29d 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -73,6 +73,7 @@ arrayClass = '[object Array]', boolClass = '[object Boolean]', dateClass = '[object Date]', + errorClass = '[object Error]', funcClass = '[object Function]', numberClass = '[object Number]', objectClass = '[object Object]', @@ -103,15 +104,17 @@ /*--------------------------------------------------------------------------*/ /** Used for `Array` and `Object` method references */ - var arrayRef = Array(), - objectRef = Object(); + var arrayProto = Array.prototype, + errorProto = Error.prototype, + objectProto = Object.prototype, + stringProto = String.prototype; /** Used to restore the original `_` reference in `noConflict` */ var oldDash = window._; /** Used to detect if a method is native */ var reNative = RegExp('^' + - String(objectRef.valueOf) + String(objectProto.valueOf) .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') .replace(/valueOf|for [^\]]+/g, '.+?') + '$' ); @@ -119,12 +122,12 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = window.clearTimeout, - concat = arrayRef.concat, + concat = arrayProto.concat, floor = Math.floor, - hasOwnProperty = objectRef.hasOwnProperty, - push = arrayRef.push, + hasOwnProperty = objectProto.hasOwnProperty, + push = arrayProto.push, setTimeout = window.setTimeout, - toString = objectRef.toString; + toString = objectProto.toString; /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, @@ -135,7 +138,7 @@ nativeMax = Math.max, nativeMin = Math.min, nativeRandom = Math.random, - nativeSlice = arrayRef.slice; + nativeSlice = arrayProto.slice; /** Detect various environments */ var isIeOpera = reNative.test(window.attachEvent), @@ -241,7 +244,7 @@ * @memberOf _.support * @type Boolean */ - support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); + support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]); }(1)); /** @@ -508,7 +511,6 @@ var index, iterable = object, result = []; if (!iterable) return result; if (!(objectTypes[typeof object])) return result; - for (index in iterable) { if (hasOwnProperty.call(iterable, index)) { result.push(index); @@ -721,7 +723,6 @@ var index, iterable = collection, result = iterable; if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; - for (index in iterable) { if (callback(iterable[index], index, collection) === indicatorObject) return result; } @@ -753,7 +754,6 @@ var index, iterable = collection, result = iterable; if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; - for (index in iterable) { if (hasOwnProperty.call(iterable, index)) { if (callback(iterable[index], index, collection) === indicatorObject) return result; @@ -1137,7 +1137,7 @@ // http://es5.github.com/#x8 // and avoid a V8 bug // http://code.google.com/p/v8/issues/detail?id=2291 - return value ? objectTypes[typeof value] : false; + return !!(value && objectTypes[typeof value]); } /** @@ -1222,7 +1222,7 @@ * // => true */ function isRegExp(value) { - return value ? (objectTypes[typeof value] && toString.call(value) == regexpClass) : false; + return !!(value && objectTypes[typeof value]) && toString.call(value) == regexpClass; } /** @@ -1286,7 +1286,7 @@ * // => { 'name': 'moe' } */ function omit(object) { - var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), result = {}; forIn(object, function(value, key) { @@ -1351,7 +1351,7 @@ */ function pick(object) { var index = -1, - props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), length = props.length, result = {}; @@ -2451,7 +2451,7 @@ function difference(array) { var index = -1, length = array.length, - flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), + flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), result = []; while (++index < length) { @@ -3069,9 +3069,9 @@ */ function union(array) { if (!isArray(array)) { - arguments[0] = array ? nativeSlice.call(array) : arrayRef; + arguments[0] = array ? nativeSlice.call(array) : arrayProto; } - return uniq(concat.apply(arrayRef, arguments)); + return uniq(concat.apply(arrayProto, arguments)); } /** @@ -3149,6 +3149,31 @@ return result; } + /** + * The inverse of `_.zip`, this method splits groups of elements into arrays + * composed of elements from each group at their corresponding indexes. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to process. + * @returns {Array} Returns a new array of the composed arrays. + * @example + * + * _.unzip([['moe', 30, true], ['larry', 40, false]]); + * // => [['moe', 'larry'], [30, 40], [true, false]]; + */ + function unzip(array) { + var index = -1, + length = array ? max(pluck(array, 'length')) : 0, + result = Array(length < 0 ? 0 : length); + + while (++index < length) { + result[index] = pluck(array, index); + } + return result; + } + /** * Creates an array with all occurrences of the passed values removed using * strict equality for comparisons, i.e. `===`. @@ -3187,7 +3212,7 @@ function zip(array) { var index = -1, length = array ? max(pluck(arguments, 'length')) : 0, - result = Array(length); + result = Array(length < 0 ? 0 : length); while (++index < length) { result[index] = pluck(arguments, index); @@ -3318,7 +3343,7 @@ * // => alerts 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), + var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; @@ -4343,7 +4368,7 @@ // add `Array` mutator functions to the wrapper forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { var value = this.__wrapped__; func.apply(value, arguments); @@ -4359,7 +4384,7 @@ // add `Array` accessor functions to the wrapper forEach(['concat', 'join', 'slice'], function(methodName) { - var func = arrayRef[methodName]; + var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { var value = this.__wrapped__, result = func.apply(value, arguments); diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 57eaeee95b..458a1eb1c7 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -8,28 +8,28 @@ t=n}return u}function u(n){return"\\"+lt[n]}function o(n){return Dt[n]}function i(n){this.__wrapped__=n}function a(){}function f(n){return Mt[n]}function l(n){return dt.call(n)==nt}function c(n){if(!n)return n;for(var t=1,r=arguments.length;te&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; -if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=P(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Rt(n),u=i.length;return t=P(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; -t=P(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rT(e,o)&&u.push(o)}return u}function D(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=P(t,r);++or?Ot(0,u+r):r||0)-1;else if(r)return e=I(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])e&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; +if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=P(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Rt(n),u=i.length;return t=P(t,e,4),O(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; +t=P(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rT(e,o)&&u.push(o)}return u}function D(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=P(t,r);++or?Et(0,u+r):r||0)-1;else if(r)return e=I(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])T(a,f))&&(r&&a.push(f),i.push(e))}return i}function C(n,t){return qt.fastBind||jt&&2"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",ft={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ct=[],H={},pt=n._,st=RegExp("^"+(H.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),vt=Math.ceil,gt=n.clearTimeout,ht=ct.concat,yt=Math.floor,mt=H.hasOwnProperty,_t=ct.push,bt=n.setTimeout,dt=H.toString,jt=st.test(jt=dt.bind)&&jt,wt=st.test(wt=Array.isArray)&&wt,At=n.isFinite,xt=n.isNaN,Et=st.test(Et=Object.keys)&&Et,Ot=Math.max,St=Math.min,Nt=Math.random,Bt=ct.slice,H=st.test(n.attachEvent),kt=jt&&!/\n|true/.test(jt+H),qt={}; -(function(){var n={0:1,length:1};qt.fastBind=jt&&!kt,qt.spliceObjects=(ct.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},i.prototype=t.prototype,l(arguments)||(l=function(n){return n?mt.call(n,"callee"):!1});var Ft=wt||function(n){return n?typeof n=="object"&&dt.call(n)==tt:!1},wt=function(n){var t,r=[];if(!n||!ft[typeof n])return r;for(t in n)mt.call(n,t)&&r.push(t);return r},Rt=Et?function(n){return m(n)?Et(n):[] +}}return typeof t!="undefined"?1===r?function(r){return n.call(t,r)}:2===r?function(r,e){return n.call(t,r,e)}:4===r?function(r,e,u,o){return n.call(t,r,e,u,o)}:function(r,e,u){return n.call(t,r,e,u)}:n}function U(n){return n}function V(n){O(s(n),function(r){var e=t[r]=n[r];t.prototype[r]=function(){var n=[this.__wrapped__];return _t.apply(n,arguments),n=e.apply(t,n),this.__chain__&&(n=new i(n),n.__chain__=!0),n}})}var W=typeof exports=="object"&&exports,G=typeof module=="object"&&module&&module.exports==W&&module,H=typeof global=="object"&&global; +(H.global===H||H.window===H)&&(n=H);var J=0,K={},L=+new Date+"",Q=/&(?:amp|lt|gt|quot|#39);/g,X=/($^)/,Y=/[&<>"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",ft={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ct=Array.prototype,H=Object.prototype,pt=n._,st=RegExp("^"+(H.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),vt=Math.ceil,gt=n.clearTimeout,ht=ct.concat,yt=Math.floor,mt=H.hasOwnProperty,_t=ct.push,bt=n.setTimeout,dt=H.toString,jt=st.test(jt=dt.bind)&&jt,wt=st.test(wt=Array.isArray)&&wt,At=n.isFinite,xt=n.isNaN,Ot=st.test(Ot=Object.keys)&&Ot,Et=Math.max,St=Math.min,Nt=Math.random,Bt=ct.slice,H=st.test(n.attachEvent),kt=jt&&!/\n|true/.test(jt+H),qt={}; +(function(){var n={0:1,length:1};qt.fastBind=jt&&!kt,qt.spliceObjects=(ct.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},i.prototype=t.prototype,l(arguments)||(l=function(n){return n?mt.call(n,"callee"):!1});var Ft=wt||function(n){return n?typeof n=="object"&&dt.call(n)==tt:!1},wt=function(n){var t,r=[];if(!n||!ft[typeof n])return r;for(t in n)mt.call(n,t)&&r.push(t);return r},Rt=Ot?function(n){return m(n)?Ot(n):[] }:wt,Dt={"&":"&","<":"<",">":">",'"':""","'":"'"},Mt=v(Dt),Tt=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(t(n[r],r,n)===K)break;return n},$t=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(mt.call(n,r)&&t(n[r],r,n)===K)break;return n};y(/x/)&&(y=function(n){return typeof n=="function"&&"[object Function]"==dt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},t.bind=C,t.bindAll=function(n){for(var t=1T(o,i)){for(var a=r;--a;)if(0>T(t[a],i))continue n;o.push(i)}}return o},t.invert=v,t.invoke=function(n,t){var r=Bt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Rt,t.map=O,t.max=S,t.memoize=function(n,t){var r={};return function(){var e=L+(t?t.apply(this,arguments):arguments[0]); -return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=P(t,r),E(n,function(n,r,o){r=t(n,r,o),rT(t,e)&&(r[e]=n)}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++tr?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+yt(Nt()*((+t||0)-n+1))},t.reduce=B,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=q,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); +n[u]=C(n[u],n)}return n},t.compact=function(n){for(var t=-1,r=n?n.length:0,e=[];++tT(o,i)){for(var a=r;--a;)if(0>T(t[a],i))continue n;o.push(i)}}return o},t.invert=v,t.invoke=function(n,t){var r=Bt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return O(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Rt,t.map=E,t.max=S,t.memoize=function(n,t){var r={};return function(){var e=L+(t?t.apply(this,arguments):arguments[0]); +return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=P(t,r),O(n,function(n,r,o){r=t(n,r,o),rT(t,e)&&(r[e]=n)}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Et(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+yt(Nt()*((+t||0)-n+1))},t.reduce=B,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=q,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t) -}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=q,t.detect=x,t.foldl=B,t.foldr=k,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.chain=function(n){return n=new i(n),n.__chain__=!0,n -},t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!qt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n -}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t,define(function(){return t})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file +}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=q,t.detect=x,t.foldl=B,t.foldr=k,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Et(0,u-e))}},t.take=D,t.head=D,t.chain=function(n){return n=new i(n),n.__chain__=!0,n +},t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},O("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!qt.spliceObjects&&0===n.length&&delete n[0],this}}),O(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n +}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 5d27aac76b..22b040285c 100644 --- a/doc/README.md +++ b/doc/README.md @@ -214,7 +214,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3291 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3325 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -238,7 +238,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3321 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3355 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -263,7 +263,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3357 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3391 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -291,7 +291,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3427 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3461 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -351,7 +351,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3489 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3523 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -394,7 +394,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3542 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3576 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -426,7 +426,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3616 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3650 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -483,7 +483,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3650 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3684 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -507,7 +507,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3742 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3776 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -564,7 +564,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3783 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3817 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -593,7 +593,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3824 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3858 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -631,7 +631,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3903 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3937 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -691,7 +691,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3967 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4001 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -740,7 +740,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3999 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4033 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -764,7 +764,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4049 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4083 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -811,7 +811,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4107 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4141 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -835,7 +835,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4139 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4167 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -860,7 +860,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4159 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4187 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -884,7 +884,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4188 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4209 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -919,7 +919,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L282 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L307 "View in source") [Ⓣ][1] Creates a `lodash` object, which wraps the given `value`, to enable method chaining. @@ -972,7 +972,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5255 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5275 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1002,7 +1002,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5272 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5292 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1023,7 +1023,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5289 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5309 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1054,7 +1054,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2280 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2314 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1082,7 +1082,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2322 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2356 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1120,7 +1120,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2376 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2410 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1156,7 +1156,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2428 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2462 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1202,7 +1202,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2489 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2523 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1248,7 +1248,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2556 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2590 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1297,7 +1297,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2603 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2637 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1329,7 +1329,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2653 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2687 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1366,7 +1366,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2686 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2720 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1395,7 +1395,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2738 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1440,7 +1440,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2795 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2829 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1482,7 +1482,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2864 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2898 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1524,7 +1524,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2914 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2948 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1554,7 +1554,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2946 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2980 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1592,7 +1592,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2989 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3023 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1623,7 +1623,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3049 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1666,7 +1666,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3070 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3104 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1690,7 +1690,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3103 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3137 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1720,7 +1720,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3150 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3184 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1766,7 +1766,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3206 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3240 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1803,7 +1803,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3241 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3275 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1827,7 +1827,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3273 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3307 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1864,7 +1864,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4228 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4249 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1892,7 +1892,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4261 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4282 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1923,7 +1923,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4292 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4313 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1954,7 +1954,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4338 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4359 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -1995,7 +1995,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4361 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4382 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2022,7 +2022,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4420 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4441 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2076,7 +2076,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4496 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4517 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2109,7 +2109,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4547 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4567 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2134,7 +2134,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4573 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4593 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2161,7 +2161,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4597 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4617 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2187,7 +2187,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4624 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4644 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2213,7 +2213,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4659 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4679 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2240,7 +2240,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4690 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4710 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2277,7 +2277,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4723 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4743 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2309,7 +2309,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4788 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4808 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2345,7 +2345,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1086 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1120 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2383,7 +2383,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1141 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1175 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2430,7 +2430,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1266 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1300 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2476,7 +2476,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1290 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1324 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2502,7 +2502,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1312 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1346 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2530,7 +2530,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1353 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1387 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2566,7 +2566,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1378 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1412 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2594,7 +2594,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1395 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1429 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2621,7 +2621,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1420 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1454 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2646,7 +2646,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1437 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1471 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2670,7 +2670,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L948 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L983 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2697,7 +2697,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L974 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1009 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2724,7 +2724,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1463 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1497 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2748,7 +2748,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1480 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1514 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2772,7 +2772,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1497 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1531 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2796,7 +2796,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1522 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2826,7 +2826,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1581 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1615 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2871,7 +2871,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1762 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1796 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2909,7 +2909,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1779 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1813 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2933,7 +2933,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1842 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1876 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2968,7 +2968,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1864 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1898 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -2995,7 +2995,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1881 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1915 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3019,7 +3019,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1809 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1843 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3049,7 +3049,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1909 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1943 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3084,7 +3084,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1934 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1968 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3108,7 +3108,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1951 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1985 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3132,7 +3132,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1968 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2002 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3156,7 +3156,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1008 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1042 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3180,7 +3180,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2027 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2061 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3236,7 +3236,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2136 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2170 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3267,7 +3267,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2170 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2204 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3291,7 +3291,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2208 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2242 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3322,7 +3322,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2245 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2279 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3353,7 +3353,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4812 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4832 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3377,7 +3377,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4830 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4850 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3402,7 +3402,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4856 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4876 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3432,7 +3432,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4885 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4905 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3452,7 +3452,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4909 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4929 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3479,7 +3479,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4932 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4952 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3507,7 +3507,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4971 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4991 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3542,7 +3542,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L149 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L150 "View in source") [Ⓣ][1] Create a new `lodash` function using the given `context` object. @@ -3560,7 +3560,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5055 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5075 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3642,7 +3642,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5180 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5200 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3674,7 +3674,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5207 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5227 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3698,7 +3698,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5227 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5247 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3732,7 +3732,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L469 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L494 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3751,7 +3751,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5464 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5484 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3763,7 +3763,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L296 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L321 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3775,7 +3775,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L321 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L346 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3787,7 +3787,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L313 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L338 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3799,7 +3799,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L334 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L359 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3813,7 +3813,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L342 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L367 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3825,7 +3825,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L359 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L384 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3837,7 +3837,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L370 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L395 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3851,7 +3851,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L350 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L375 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3863,7 +3863,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L384 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L409 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3877,7 +3877,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L395 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L420 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3891,7 +3891,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L421 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L446 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3903,7 +3903,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L429 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L454 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3915,7 +3915,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L437 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L462 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3927,7 +3927,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L445 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L470 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3939,7 +3939,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L453 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L478 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -3951,7 +3951,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L461 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L486 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. From 6d86b3a95015fed80a9a0a49f6df266fe293b057 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 10 May 2013 22:57:08 -0700 Subject: [PATCH 020/117] Add `_.has` unit test. Former-commit-id: 3334651f8d29e6aa006184846b128acd006157ef --- test/test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test.js b/test/test.js index 5ff378c08d..7155a425d9 100644 --- a/test/test.js +++ b/test/test.js @@ -1282,6 +1282,18 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.has'); + + (function() { + test('should return `false` for primitives', function() { + _.each(falsey.concat(1, 'a'), function(value) { + strictEqual(_.has(value, 'valueOf'), false); + }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.indexOf'); (function() { From 9bd0c01702ea8619f030f3490f86b45ab9abc94d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 10 May 2013 23:20:10 -0700 Subject: [PATCH 021/117] Expose memoized function's `cache`. [closes #265] Former-commit-id: fc44676386854ec9d5fd7a4fac8583508d63949f --- build/pre-compile.js | 1 + lodash.js | 11 +++++++---- test/test.js | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index 107b281b3e..ffe53a78e3 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -93,6 +93,7 @@ 'bind', 'bindAll', 'bindKey', + 'cache', 'clearTimeout', 'clone', 'cloneDeep', diff --git a/lodash.js b/lodash.js index 42973fce79..ad117f5c55 100644 --- a/lodash.js +++ b/lodash.js @@ -4615,13 +4615,16 @@ * }); */ function memoize(func, resolver) { - var cache = {}; - return function() { - var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]); + function memoized() { + var cache = memoized.cache, + key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]); + return hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = func.apply(this, arguments)); - }; + } + memoized.cache = {}; + return memoized; } /** diff --git a/test/test.js b/test/test.js index 7155a425d9..3f4518106f 100644 --- a/test/test.js +++ b/test/test.js @@ -1900,6 +1900,22 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.memoize'); + + (function() { + test('should expose a `cache` object on the `memoized` function', function() { + var memoized = _.memoize(_.identity); + memoized('x'); + + var cache = memoized.cache, + key = _.keys(cache)[0]; + + equal(cache[key], 'x'); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.merge'); (function() { From 5841e62c664a3f51b01e44ddc56f9f59bbd51d64 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 11 May 2013 00:59:48 -0700 Subject: [PATCH 022/117] Add `_.chain` alias of `_`. [closes #267] Former-commit-id: 580e4346444096c7fa77cfc5cf2c68b6cf891fcf --- build.js | 26 +++++++++++++++++++++----- dist/lodash.compat.js | 13 +++++++++---- dist/lodash.compat.min.js | 4 ++-- dist/lodash.js | 13 +++++++++---- dist/lodash.min.js | 12 ++++++------ dist/lodash.underscore.js | 4 ++-- dist/lodash.underscore.min.js | 8 ++++---- lodash.js | 2 ++ test/test-build.js | 2 +- 9 files changed, 56 insertions(+), 28 deletions(-) diff --git a/build.js b/build.js index fba4d6c24e..4a7670f850 100755 --- a/build.js +++ b/build.js @@ -180,7 +180,6 @@ 'zipObject': [], // method used by the `backbone` and `underscore` builds - 'chain': ['value'], 'findWhere': ['find'] }; @@ -202,7 +201,7 @@ var allMethods = _.without(_.keys(dependencyMap)); /** List of Lo-Dash methods */ - var lodashMethods = _.without(allMethods, 'chain', 'findWhere'); + var lodashMethods = _.without(allMethods, 'findWhere'); /** List of Backbone's Lo-Dash dependencies */ var backboneDependencies = [ @@ -280,7 +279,9 @@ ]; /** List of Underscore methods */ - var underscoreMethods = _.without.apply(_, [allMethods].concat(lodashOnlyMethods)); + var underscoreMethods = _.without + .apply(_, [allMethods].concat(lodashOnlyMethods)) + .concat('chain'); /** List of ways to export the `lodash` function */ var exportsAll = [ @@ -366,9 +367,9 @@ ].join('\n' + indent)); }); - // add `lodash.chain` assignment + // replace `lodash.chain` assignment source = source.replace(getMethodAssignments(source), function(match) { - return match.replace(/^(?: *\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/\n)?( *)lodash\.VERSION *=/m, '$1lodash.chain = chain;\n\n$&'); + return match.replace(/^( *lodash\.chain *= *).+/m, '$1chain;'); }); // add `lodash.prototype.chain` assignment @@ -1803,6 +1804,7 @@ } }); + dependencyMap.chain = ['value']; dependencyMap.findWhere = ['where']; dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); dependencyMap.value = _.without(dependencyMap.value, 'isArray'); @@ -2357,6 +2359,20 @@ '}' ].join('\n')); } + // replace `_.memoize` + if (!useLodashMethod('memoize')) { + source = replaceFunction(source, 'memoize', [ + 'function memoize(func, resolver) {', + ' var cache = {};', + ' return function() {', + ' var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);', + ' return hasOwnProperty.call(cache, key)', + ' ? cache[key]', + ' : (cache[key] = func.apply(this, arguments));', + ' };', + '}' + ].join('\n')); + } // replace `_.omit` if (!useLodashMethod('omit')) { source = replaceFunction(source, 'omit', [ diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 19d8499cea..e69857bde3 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -281,6 +281,7 @@ * * @name _ * @constructor + * @alias chain * @category Chaining * @param {Mixed} value The value to wrap in a `lodash` instance. * @returns {Object} Returns a `lodash` instance. @@ -4598,13 +4599,16 @@ * }); */ function memoize(func, resolver) { - var cache = {}; - return function() { - var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]); + function memoized() { + var cache = memoized.cache, + key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]); + return hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = func.apply(this, arguments)); - }; + } + memoized.cache = {}; + return memoized; } /** @@ -5355,6 +5359,7 @@ lodash.zipObject = zipObject; // add aliases + lodash.chain = lodash; lodash.collect = map; lodash.drop = rest; lodash.each = forEach; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 8c3f134157..b0f684efe7 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -31,12 +31,12 @@ n[u]=St(n[u],n)}return n},a.bindKey=function(n,t){return L(n,t,yr.call(arguments var e=typeof n;if("function"!=e){if("object"!=e)return function(t){return t[n]};var u=Er(n);return function(t){for(var r=u.length,e=!1;r--&&(e=rt(t[u[r]],n[u[r]],i)););return e}}return typeof t!="undefined"?1===r?function(r){return n.call(t,r)}:2===r?function(r,e){return n.call(t,r,e)}:4===r?function(r,e,u,a){return n.call(t,r,e,u,a)}:function(r,e,u){return n.call(t,r,e,u)}:n},a.debounce=function(n,t,r){function e(){var t=c&&(!l||1++f&&(a=n.apply(o,u)),i=ur(e,t),a}},a.defaults=Pr,a.defer=At,a.delay=function(n,t){var e=yr.call(arguments,2);return ur(function(){n.apply(r,e)},t)},a.difference=bt,a.filter=pt,a.flatten=wt,a.forEach=vt,a.forIn=Br,a.forOwn=Nr,a.functions=nt,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),vt(n,function(n,r,u){r=Lt(t(n,r,u)),(tr.call(e,r)?e[r]:e[r]=[]).push(n)}),e },a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return W(n,0,sr(pr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e={0:{}},u=-1,a=n?n.length:0,o=a>=c,i=[],l=i;n:for(;++uCt(l,p)){o&&l.push(p);for(var v=r;--v;)if(!(e[v]||(e[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=tt,a.invoke=function(n,t){var r=yr.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Nt(typeof a=="number"?a:0); -return vt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},a.keys=Er,a.map=gt,a.max=yt,a.memoize=function(n,t){var r={};return function(){var e=f+(t?t.apply(this,arguments):arguments[0]);return tr.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},a.merge=it,a.min=function(n,t,r){var e=1/0,u=e;if(!t&&kr(n)){r=-1;for(var o=n.length;++rCt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Er(n),e=r.length,u=Nt(e);++tr?pr(0,e+r):sr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Pt,a.noConflict=function(){return e._=Vt,this},a.parseInt=qr,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Zt(gr()*((+t||0)-n+1)) },a.reduce=ht,a.reduceRight=mt,a.result=function(n,t){var e=n?n[t]:r;return et(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Er(n).length},a.some=dt,a.sortedIndex=kt,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Pr({},e,u);var o,i=Pr({},e.imports,u.imports),u=Er(i),i=ft(i),f=0,c=e.interpolate||b,v="__p+='",c=Kt((e.escape||b).source+"|"+c.source+"|"+(c===h?g:b).source+"|"+(e.evaluate||b).source+"|$","g");n.replace(c,function(t,r,e,u,a,i){return e||(e=u),v+=n.slice(f,i).replace(w,H),r&&(v+="'+__e("+r+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),e&&(v+="'+((__t=("+e+"))==null?'':__t)+'"),f=i+t.length,t diff --git a/dist/lodash.js b/dist/lodash.js index dd308ddb38..7e7cf20f55 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -256,6 +256,7 @@ * * @name _ * @constructor + * @alias chain * @category Chaining * @param {Mixed} value The value to wrap in a `lodash` instance. * @returns {Object} Returns a `lodash` instance. @@ -4299,13 +4300,16 @@ * }); */ function memoize(func, resolver) { - var cache = {}; - return function() { - var key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]); + function memoized() { + var cache = memoized.cache, + key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]); + return hasOwnProperty.call(cache, key) ? cache[key] : (cache[key] = func.apply(this, arguments)); - }; + } + memoized.cache = {}; + return memoized; } /** @@ -5056,6 +5060,7 @@ lodash.zipObject = zipObject; // add aliases + lodash.chain = lodash; lodash.collect = map; lodash.drop = rest; lodash.each = forEach; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index c62cc0d35b..15236eca00 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -27,12 +27,12 @@ de[E]=Dt,de[I]=zt,de[N]=Pt,de[S]=Kt,de[A]=Mt,de[B]=Gt,de[$]=Vt,de[F]=Ht,de[R]=Jt u&&r.push(u)}return r},G.compose=function(){var n=arguments;return function(){for(var t=arguments,e=n.length;e--;)t=[n[e].apply(this,t)];return t[0]}},G.countBy=function(n,t,e){var r={};return t=G.createCallback(t,e),bt(n,function(n,e,u){e=Jt(t(n,e,u)),ue.call(r,e)?r[e]++:r[e]=1}),r},G.createCallback=function(n,t,e){if(n==u)return Rt;var r=typeof n;if("function"!=r){if("object"!=r)return function(t){return t[n]};var o=we(n);return function(t){for(var e=o.length,r=a;e--&&(r=ot(t[o[e]],n[o[e]],l)););return r }}return typeof t!="undefined"?1===e?function(e){return n.call(t,e)}:2===e?function(e,r){return n.call(t,e,r)}:4===e?function(e,r,u,a){return n.call(t,e,r,u,a)}:function(e,r,u){return n.call(t,e,r,u)}:n},G.debounce=function(n,t,e){function u(){var t=p&&(!s||1++l&&(i=n.apply(f,o)),c=ie(u,t),i}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=me.call(arguments,2); return ie(function(){n.apply(e,r)},t)},G.difference=Ct,G.filter=yt,G.flatten=Ot,G.forEach=bt,G.forIn=K,G.forOwn=P,G.functions=ut,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),bt(n,function(n,e,u){e=Jt(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return tt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; -n:for(;++uEt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=H(t[v])))(c))continue n;i.push(c)}}return i},G.invert=at,G.invoke=function(n,t){var e=me.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Dt(typeof a=="number"?a:0);return bt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},G.keys=we,G.map=mt,G.max=dt,G.memoize=function(n,t){var e={};return function(){var r=p+(t?t.apply(this,arguments):arguments[0]); -return ue.call(e,r)?e[r]:e[r]=n.apply(this,arguments)}},G.merge=pt,G.min=function(n,t,e){var r=1/0,u=r;if(!t&&ke(n)){e=-1;for(var a=n.length;++eEt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e) -}},G.pairs=function(n){for(var t=-1,e=we(n),r=e.length,u=Dt(r);++tEt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=H(t[v])))(c))continue n;i.push(c)}}return i},G.invert=at,G.invoke=function(n,t){var e=me.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Dt(typeof a=="number"?a:0);return bt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},G.keys=we,G.map=mt,G.max=dt,G.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); +return ue.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},G.merge=pt,G.min=function(n,t,e){var r=1/0,u=r;if(!t&&ke(n)){e=-1;for(var a=n.length;++eEt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e; +return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=we(n),r=e.length,u=Dt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+ee(be()*((+t||0)-n+1))},G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e;return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0; diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index c02b05a29d..ff142d17a7 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -182,6 +182,7 @@ * * @name _ * @constructor + * @alias chain * @category Chaining * @param {Mixed} value The value to wrap in a `lodash` instance. * @returns {Object} Returns a `lodash` instance. @@ -4275,6 +4276,7 @@ lodash.zip = zip; // add aliases + lodash.chain = chain; lodash.collect = map; lodash.drop = rest; lodash.each = forEach; @@ -4348,8 +4350,6 @@ /*--------------------------------------------------------------------------*/ - lodash.chain = chain; - /** * The semantic version number. * diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 458a1eb1c7..51f464eb66 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -26,10 +26,10 @@ return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){va u[t]=[o,n[o]]}return u},t.partial=function(n){return e(n,Bt.call(arguments,1))},t.pick=function(n){for(var t=-1,r=ht.apply(ct,Bt.call(arguments,1)),e=r.length,u={};++tr?0:r);++tr?Et(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+yt(Nt()*((+t||0)-n+1))},t.reduce=B,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=q,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t) -}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=q,t.detect=x,t.foldl=B,t.foldr=k,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Et(0,u-e))}},t.take=D,t.head=D,t.chain=function(n){return n=new i(n),n.__chain__=!0,n -},t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},O("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!qt.spliceObjects&&0===n.length&&delete n[0],this}}),O(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n -}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file +}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=q,t.detect=x,t.foldl=B,t.foldr=k,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Et(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this +},t.prototype.value=function(){return this.__wrapped__},O("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!qt.spliceObjects&&0===n.length&&delete n[0],this}}),O(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t +})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file diff --git a/lodash.js b/lodash.js index ad117f5c55..1329b39455 100644 --- a/lodash.js +++ b/lodash.js @@ -280,6 +280,7 @@ * * @name _ * @constructor + * @alias chain * @category Chaining * @param {Mixed} value The value to wrap in a `lodash` instance. * @returns {Object} Returns a `lodash` instance. @@ -5375,6 +5376,7 @@ lodash.zipObject = zipObject; // add aliases + lodash.chain = lodash; lodash.collect = map; lodash.drop = rest; lodash.each = forEach; diff --git a/test/test-build.js b/test/test-build.js index a39496bc01..4764ac5ed7 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -95,7 +95,7 @@ }); /** List of all methods */ - var allMethods = lodashMethods.concat('chain', 'findWhere'); + var allMethods = lodashMethods.concat('findWhere'); /** List of "Arrays" category methods */ var arraysMethods = [ From b72b0d60cb0bebac3cce453fdb7c8a0b80f1a7c5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 12 May 2013 15:48:01 -0700 Subject: [PATCH 023/117] Add support for floating point numbers to `_.random`. [closes #263] Former-commit-id: ef356bb180b163fc936ef69ac2ef33186983eaa7 --- lodash.js | 7 ++++++- test/test.js | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lodash.js b/lodash.js index 1329b39455..922174a777 100644 --- a/lodash.js +++ b/lodash.js @@ -4961,8 +4961,13 @@ if (max == null) { max = min; min = 0; + } else { + max = +max || 0; } - return min + floor(nativeRandom() * ((+max || 0) - min + 1)); + var rand = nativeRandom(); + return (min % 1 || max % 1) + ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max) + : min + floor(rand * (max - min + 1)); } /** diff --git a/test/test.js b/test/test.js index 3f4518106f..4be6117906 100644 --- a/test/test.js +++ b/test/test.js @@ -2306,6 +2306,15 @@ test('should coerce arguments to numbers', function() { strictEqual(_.random('1', '1'), 1); }); + + test('should support floats', function() { + var min = 1.5, + max = 1.6, + actual = _.random(min, max); + + ok(actual % 1); + ok(actual >= min && actual <= max); + }); }()); /*--------------------------------------------------------------------------*/ From 4b3009a1957ee00e07e506a444b1627541180051 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 14 May 2013 00:49:31 -0700 Subject: [PATCH 024/117] Ensure `_.clone`, `_.flatten`, and `_.uniq` can be used as a `callback` for methods like `_.map`. [closes #270] Former-commit-id: fb62b5bbdad844cb04c3259c323e27fb81932809 --- lodash.js | 6 +++--- test/test.js | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lodash.js b/lodash.js index 922174a777..d55cec4e93 100644 --- a/lodash.js +++ b/lodash.js @@ -1178,7 +1178,7 @@ // allows working with "Collections" methods without using their `callback` // argument, `index|key`, for this method's `callback` - if (typeof deep == 'function') { + if (typeof deep != 'boolean' && deep != null) { thisArg = callback; callback = deep; deep = false; @@ -3529,7 +3529,7 @@ // juggle arguments if (typeof isShallow != 'boolean' && isShallow != null) { thisArg = callback; - callback = isShallow; + callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined; isShallow = false; } if (callback != null) { @@ -4090,7 +4090,7 @@ // juggle arguments if (typeof isSorted != 'boolean' && isSorted != null) { thisArg = callback; - callback = isSorted; + callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined; isSorted = false; } // init value cache for large arrays diff --git a/test/test.js b/test/test.js index 4be6117906..f5be7bc450 100644 --- a/test/test.js +++ b/test/test.js @@ -392,11 +392,11 @@ }); }); - test('should shallow clone when used as `callback` for `_.map`', function() { + test('should perform a shallow clone when used as `callback` for `_.map`', function() { var expected = [{ 'a': [0] }, { 'b': [1] }], actual = _.map(expected, _.clone); - ok(actual != expected && actual.a == expected.a && actual.b == expected.b); + ok(actual[0] != expected[0] && actual[0].a === expected[0].a && actual[1].b === expected[1].b); }); test('should deep clone `index` and `input` array properties', function() { @@ -928,6 +928,13 @@ deepEqual(_.flatten(array, 'a'), [1, 2, 3]); }); + test('should perform a deep flatten when used as `callback` for `_.map`', function() { + var array = [[[['a']]], [[['b']]]], + actual = _.map(array, _.flatten); + + deepEqual(actual, [['a'], ['b']]); + }); + test('should treat sparse arrays as dense', function() { var array = [[1, 2, 3], Array(3)], expected = [1, 2, 3], @@ -3105,6 +3112,13 @@ deepEqual(actual, [1, 2, 3]); }); + test('should perform an unsorted uniq operation when used as `callback` for `_.map`', function() { + var array = [[2, 1, 2], [1, 2, 1]], + actual = _.map(array, _.uniq); + + deepEqual(actual, [[2, 1], [1, 2]]); + }); + test('should distinguish between numbers and numeric strings', function() { var array = [], expected = ['2', 2, Object('2'), Object(2)]; From d3df072a22874009762775e815d474037cf5ebce Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 14 May 2013 08:11:56 -0700 Subject: [PATCH 025/117] Make build.js remove extraneous semicolons from inlined methods. Former-commit-id: 061ed370a4c95a64669335c6b2a5da7ebc1015fd --- build.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/build.js b/build.js index 4a7670f850..c84c9be5b7 100755 --- a/build.js +++ b/build.js @@ -536,7 +536,7 @@ var filePath = path.join(directory, filename); if (pattern.test(filename)) { var text = fs.readFileSync(filePath, 'utf8'), - precompiled = getFunctionSource(_.template(text, null, options)), + precompiled = cleanupCompiled(getFunctionSource(_.template(text, null, options))), prop = filename.replace(/\..*$/, ''); source.push(" templates['" + prop.replace(/['\n\r\t]/g, '\\$&') + "'] = " + precompiled + ';', ''); @@ -576,6 +576,17 @@ return string[0].toUpperCase() + string.toLowerCase().slice(1); } + /** + * Removes unnecessary semicolons and whitespace from compiled code. + * + * @private + * @param {String} source The source to process. + * @returns {String} Returns the modified source. + */ + function cleanupCompiled(source) { + return source.replace(/([{}]) *;/g, '$1'); + } + /** * Removes unnecessary comments, whitespace, and pseudo private properties. * @@ -2788,7 +2799,7 @@ // extract, format, and inject the compiled function's source code source = source.replace(reFunc, function(match, indent, left) { return (indent + left) + - getFunctionSource(lodash[methodName], indent) + ';\n'; + cleanupCompiled(getFunctionSource(lodash[methodName], indent)) + ';\n'; }); } }); @@ -2851,7 +2862,7 @@ // inline `iteratorTemplate` template source = source.replace(getIteratorTemplate(source), function(match) { var indent = getIndent(match), - snippet = getFunctionSource(lodash._iteratorTemplate, indent); + snippet = cleanupCompiled(getFunctionSource(lodash._iteratorTemplate, indent)); // prepend data object references to property names to avoid having to // use a with-statement @@ -2867,7 +2878,6 @@ .replace(/__p *\+= *' *';/g, '') .replace(/\s*\+\s*'';/g, ';') .replace(/(__p *\+= *)' *' *\+/g, '$1') - .replace(/(?:; *)([{}])|([{}])(?: *;)/g, '$1$2') .replace(/\(\(__t *= *\( *([^)]+?) *\)\) *== *null *\? *'' *: *__t\)/g, '($1)'); // remove the with-statement From d76ce85327d1b5efc3054795156c3eb89f0763e2 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 14 May 2013 09:04:15 -0700 Subject: [PATCH 026/117] Add better `_.forIn` support for legacy browsers. Former-commit-id: a03ce4662021d6ac8ca12c4885a9c4718c227a30 --- build.js | 28 ++++++++++++++++++-- build/pre-compile.js | 6 +++-- lodash.js | 61 +++++++++++++++++++++++++++----------------- 3 files changed, 67 insertions(+), 28 deletions(-) diff --git a/build.js b/build.js index c84c9be5b7..cf3c2df4db 100755 --- a/build.js +++ b/build.js @@ -1148,6 +1148,27 @@ return source; } + /** + * Removes all `support.enumErrorProps` references from `source`. + * + * @private + * @param {String} source The source to process. + * @returns {String} Returns the modified source. + */ + function removeSupportEnumErrorProps(source) { + source = removeSupportProp(source, 'enumErrorProps'); + + // remove `support.enumErrorProps` from `iteratorTemplate` + source = source.replace(getIteratorTemplate(source), function(match) { + return match + .replace(/(?: *\/\/.*\n)* *["'] *(?:<% *)?if *\(support\.enumErrorProps *(?:&&|\))(.+?}["']|[\s\S]+?<% *} *(?:%>|["'])).+/g, '') + .replace(/support\.enumErrorProps\s*\|\|\s*/g, ''); + }); + + return source; + } + + /** * Removes all `support.enumPrototypes` references from `source`. * @@ -1168,7 +1189,7 @@ // remove `support.enumPrototypes` from `iteratorTemplate` source = source.replace(getIteratorTemplate(source), function(match) { return match - .replace(/(?: *\/\/.*\n)* *["'] *(?:<% *)?if *\(support\.enumPrototypes *(?:&&|\))[\s\S]+?<% *} *(?:%>|["']).+/g, '') + .replace(/(?: *\/\/.*\n)* *["'] *(?:<% *)?if *\(support\.enumPrototypes *(?:&&|\))(.+?}["']|[\s\S]+?<% *} *(?:%>|["'])).+/g, '') .replace(/support\.enumPrototypes\s*\|\|\s*/g, ''); }); @@ -1249,7 +1270,9 @@ // remove `support.nonEnumShadows` from `iteratorTemplate` source = source.replace(getIteratorTemplate(source), function(match) { - return match.replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.nonEnumShadows[\s\S]+?["']\1<% *} *%>.+/, ''); + return match + .replace(/\s*\|\|\s*support\.nonEnumShadows/, '') + .replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.nonEnumShadows[\s\S]+?["']\1<% *} *%>.+/, ''); }); return source; @@ -1986,6 +2009,7 @@ source = removeSupportNodeClass(source); if (!isMobile) { + source = removeSupportEnumErrorProps(source); source = removeSupportEnumPrototypes(source); source = removeSupportNonEnumArgs(source); diff --git a/build/pre-compile.js b/build/pre-compile.js index ffe53a78e3..cd2b3a8b2c 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -13,6 +13,7 @@ 'callback', 'className', 'collection', + 'conditions', 'ctor', 'ctorByClass', 'errorClass', @@ -36,8 +37,8 @@ 'objectTypes', 'ownIndex', 'ownProps', - 'proto', 'result', + 'skipErrorProps', 'skipProto', 'source', 'stringClass', @@ -112,6 +113,7 @@ 'difference', 'drop', 'each', + 'enumErrorProps', 'enumPrototypes', 'environment', 'escape', @@ -290,7 +292,7 @@ string = string.slice(left.length); } // avoids removing the '\n' of the `stringEscapes` object - string = string.replace(/\[object |delete |else (?!{)|function | in |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) { + string = string.replace(/\[object |delete |else (?!{)|function | in | instanceof |return\s+[\w"']|throw |typeof |use strict|var |@ |(["'])\\n\1|\\\\n|\\n|\s+/g, function(match) { return match == false || match == '\\n' ? '' : match; }); // unclip diff --git a/lodash.js b/lodash.js index d55cec4e93..f97cf1d888 100644 --- a/lodash.js +++ b/lodash.js @@ -191,6 +191,7 @@ getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, + propertyIsEnumerable = objectProto.propertyIsEnumerable, setImmediate = context.setImmediate, setTimeout = context.setTimeout, toString = objectProto.toString; @@ -346,6 +347,14 @@ */ support.argsClass = isArguments(arguments); + /** + * Detect if `name` or `message` properties of `Error.prototype` are + * enumerable by default. (IE < 9, Safari < 5.1) + * + * @type Boolean + */ + support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); + /** * Detect if `prototype` properties are enumerable by default. * @@ -357,7 +366,7 @@ * @memberOf _.support * @type Boolean */ - support.enumPrototypes = ctor.propertyIsEnumerable('prototype'); + support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); /** * Detect if `Function#bind` exists and is inferred to be fast (all but V8). @@ -529,7 +538,7 @@ // iterate over the array-like value ' while (++index < length) {\n' + - ' <%= loop %>\n' + + ' <%= loop %>;\n' + ' }\n' + '}\n' + 'else {' + @@ -541,7 +550,7 @@ ' if (length && isArguments(iterable)) {\n' + ' while (++index < length) {\n' + " index += '';\n" + - ' <%= loop %>\n' + + ' <%= loop %>;\n' + ' }\n' + ' } else {' + ' <% } %>' + @@ -551,29 +560,37 @@ " var skipProto = typeof iterable == 'function';\n" + ' <% } %>' + - // iterate own properties using `Object.keys` if it's fast + // avoid iterating over `Error.prototype` properties in older IE and Safari + ' <% if (support.enumErrorProps || support.nonEnumShadows) { %>\n' + + ' var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n' + + ' <% } %>' + + + // define conditions used in the loop + ' <%' + + ' var conditions = [];' + + ' if (support.enumPrototypes) { conditions.push("!(skipProto && index == \'prototype\')"); }' + + ' if (support.enumErrorProps) { conditions.push("!(skipErrorProps && (index == \'message\' || index == \'name\'))"); }' + + ' %>' + + + // iterate own properties using `Object.keys` ' <% if (useHas && useKeys) { %>\n' + ' var ownIndex = -1,\n' + ' ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n' + ' length = ownProps.length;\n\n' + ' while (++ownIndex < length) {\n' + - ' index = ownProps[ownIndex];\n' + - " <% if (support.enumPrototypes) { %>if (!(skipProto && index == 'prototype')) {\n <% } %>" + - ' <%= loop %>\n' + - ' <% if (support.enumPrototypes) { %>}\n<% } %>' + + ' index = ownProps[ownIndex];\n<%' + + " if (conditions.length) { %> if (<%= conditions.join(' && ') %>) {\n <% } %>" + + ' <%= loop %>;' + + ' <% if (conditions.length) { %>\n }<% } %>\n' + ' }' + // else using a for-in loop ' <% } else { %>\n' + - ' for (index in iterable) {<%' + - ' if (support.enumPrototypes || useHas) { %>\n if (<%' + - " if (support.enumPrototypes) { %>!(skipProto && index == 'prototype')<% }" + - ' if (support.enumPrototypes && useHas) { %> && <% }' + - ' if (useHas) { %>hasOwnProperty.call(iterable, index)<% }' + - ' %>) {' + - ' <% } %>\n' + + ' for (index in iterable) {\n<%' + + ' if (useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); }' + + " if (conditions.length) { %> if (<%= conditions.join(' && ') %>) {\n <% } %>" + ' <%= loop %>;' + - ' <% if (support.enumPrototypes || useHas) { %>\n }<% } %>\n' + + ' <% if (conditions.length) { %>\n }<% } %>\n' + ' }' + // Because IE < 9 can't set the `[[Enumerable]]` attribute of an @@ -583,19 +600,15 @@ ' <% if (support.nonEnumShadows) { %>\n\n' + ' if (iterable !== objectProto) {\n' + " var ctor = iterable.constructor,\n" + - ' proto = ctor && ctor.prototype,\n' + - ' isProto = iterable === proto,\n' + - ' nonEnum = nonEnumProps[objectClass];\n\n' + - ' if (isProto) {\n' + - " var className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n" + - ' nonEnum = nonEnumProps[iterable === (ctorByClass[className] && ctorByClass[className].prototype) ? className : objectClass];\n' + - ' }\n' + + ' isProto = iterable === (ctor && ctor.prototype),\n' + + ' className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n' + + ' nonEnum = nonEnumProps[className];\n' + ' <% for (k = 0; k < 7; k++) { %>\n' + " index = '<%= shadowedProps[k] %>';\n" + ' if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))<%' + ' if (!useHas) { %> || (!nonEnum[index] && iterable[index] !== objectProto[index])<% }' + ' %>) {\n' + - ' <%= loop %>\n' + + ' <%= loop %>;\n' + ' }' + ' <% } %>\n' + ' }' + From bad40b6125411111bf9cc3438053df9b185aff70 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 14 May 2013 09:14:58 -0700 Subject: [PATCH 027/117] Ensure snippet in `iteratorTemplate` is minifiable and remove unneeded references from `iteratorTemplate`. Former-commit-id: f8c96f63f1a50644c0d2074e5419e68d1a247d46 --- build/pre-compile.js | 1 - lodash.js | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index cd2b3a8b2c..3c8118d081 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -32,7 +32,6 @@ 'nonEnum', 'nonEnumProps', 'object', - 'objectClass', 'objectProto', 'objectTypes', 'ownIndex', diff --git a/lodash.js b/lodash.js index f97cf1d888..4254f55351 100644 --- a/lodash.js +++ b/lodash.js @@ -568,8 +568,8 @@ // define conditions used in the loop ' <%' + ' var conditions = [];' + - ' if (support.enumPrototypes) { conditions.push("!(skipProto && index == \'prototype\')"); }' + - ' if (support.enumErrorProps) { conditions.push("!(skipErrorProps && (index == \'message\' || index == \'name\'))"); }' + + ' if (support.enumPrototypes) { conditions.push(\'!(skipProto && index == "prototype")\'); }' + + ' if (support.enumErrorProps) { conditions.push(\'!(skipErrorProps && (index == "message" || index == "name"))\'); }' + ' %>' + // iterate own properties using `Object.keys` @@ -826,15 +826,15 @@ // create the function factory var factory = Function( 'ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, ' + - 'isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, ' + - 'nonEnumProps, stringClass, stringProto, toString', + 'isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, ' + + 'stringClass, stringProto, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, - isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, - nonEnumProps, stringClass, stringProto, toString + isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, + stringClass, stringProto, toString ); } From fdc9d5f1fdad92e3eb2e0ecee0dfd676845a58d9 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 14 May 2013 09:15:48 -0700 Subject: [PATCH 028/117] Rebuild docs and files. Former-commit-id: 59596707224acabb767b87078d69363c293eec2d --- dist/lodash.compat.js | 81 ++-- dist/lodash.compat.min.js | 83 ++-- dist/lodash.js | 38 +- dist/lodash.min.js | 14 +- dist/lodash.underscore.js | 18 +- dist/lodash.underscore.min.js | 40 +- doc/README.md | 783 ++++++++++++++++------------------ 7 files changed, 514 insertions(+), 543 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index e69857bde3..55749dde8a 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -192,6 +192,7 @@ getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, + propertyIsEnumerable = objectProto.propertyIsEnumerable, setImmediate = context.setImmediate, setTimeout = context.setTimeout, toString = objectProto.toString; @@ -347,6 +348,14 @@ */ support.argsClass = isArguments(arguments); + /** + * Detect if `name` or `message` properties of `Error.prototype` are + * enumerable by default. (IE < 9, Safari < 5.1) + * + * @type Boolean + */ + support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); + /** * Detect if `prototype` properties are enumerable by default. * @@ -358,7 +367,7 @@ * @memberOf _.support * @type Boolean */ - support.enumPrototypes = ctor.propertyIsEnumerable('prototype'); + support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); /** * Detect if `Function#bind` exists and is inferred to be fast (all but V8). @@ -524,50 +533,53 @@ } __p += '\n while (++index < length) {\n ' + (obj.loop) + - '\n }\n}\nelse { '; + ';\n }\n}\nelse { '; } else if (support.nonEnumArgs) { __p += '\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += \'\';\n ' + (obj.loop) + - '\n }\n } else { '; + ';\n }\n } else { '; } if (support.enumPrototypes) { __p += '\n var skipProto = typeof iterable == \'function\';\n '; } + if (support.enumErrorProps || support.nonEnumShadows) { + __p += '\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n '; + } + + var conditions = []; if (support.enumPrototypes) { conditions.push('!(skipProto && index == "prototype")'); } if (support.enumErrorProps) { conditions.push('!(skipErrorProps && (index == "message" || index == "name"))'); } + if (obj.useHas && obj.useKeys) { - __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n '; - if (support.enumPrototypes) { - __p += 'if (!(skipProto && index == \'prototype\')) {\n '; + __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n'; + if (conditions.length) { + __p += ' if (' + + ((__t = ( conditions.join(' && ') )) == null ? '' : __t) + + ') {\n '; } __p += - (obj.loop); - if (support.enumPrototypes) { - __p += '}\n'; + (obj.loop) + + '; '; + if (conditions.length) { + __p += '\n }'; } - __p += ' } '; + __p += '\n } '; } else { - __p += '\n for (index in iterable) {'; - if (support.enumPrototypes || obj.useHas) { - __p += '\n if ('; - if (support.enumPrototypes) { - __p += '!(skipProto && index == \'prototype\')'; - } if (support.enumPrototypes && obj.useHas) { - __p += ' && '; - } if (obj.useHas) { - __p += 'hasOwnProperty.call(iterable, index)'; - } - __p += ') { '; + __p += '\n for (index in iterable) {\n'; + if (obj.useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); } if (conditions.length) { + __p += ' if (' + + ((__t = ( conditions.join(' && ') )) == null ? '' : __t) + + ') {\n '; } __p += (obj.loop) + '; '; - if (support.enumPrototypes || obj.useHas) { + if (conditions.length) { __p += '\n }'; } __p += '\n } '; if (support.nonEnumShadows) { - __p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n proto = ctor && ctor.prototype,\n isProto = iterable === proto,\n nonEnum = nonEnumProps[objectClass];\n\n if (isProto) {\n var className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[iterable === (ctorByClass[className] && ctorByClass[className].prototype) ? className : objectClass];\n }\n '; + __p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n '; for (k = 0; k < 7; k++) { __p += '\n index = \'' + (obj.shadowedProps[k]) + @@ -577,7 +589,7 @@ } __p += ') {\n ' + (obj.loop) + - '\n } '; + ';\n } '; } __p += '\n } '; } @@ -796,15 +808,15 @@ // create the function factory var factory = Function( 'ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, ' + - 'isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, ' + - 'nonEnumProps, stringClass, stringProto, toString', + 'isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, ' + + 'stringClass, stringProto, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, - isArray, isString, keys, lodash, objectClass, objectProto, objectTypes, - nonEnumProps, stringClass, stringProto, toString + isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, + stringClass, stringProto, toString ); } @@ -1161,7 +1173,7 @@ // allows working with "Collections" methods without using their `callback` // argument, `index|key`, for this method's `callback` - if (typeof deep == 'function') { + if (typeof deep != 'boolean' && deep != null) { thisArg = callback; callback = deep; deep = false; @@ -3512,7 +3524,7 @@ // juggle arguments if (typeof isShallow != 'boolean' && isShallow != null) { thisArg = callback; - callback = isShallow; + callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined; isShallow = false; } if (callback != null) { @@ -4073,7 +4085,7 @@ // juggle arguments if (typeof isSorted != 'boolean' && isSorted != null) { thisArg = callback; - callback = isSorted; + callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined; isSorted = false; } // init value cache for large arrays @@ -4944,8 +4956,13 @@ if (max == null) { max = min; min = 0; + } else { + max = +max || 0; } - return min + floor(nativeRandom() * ((+max || 0) - min + 1)); + var rand = nativeRandom(); + return (min % 1 || max % 1) + ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max) + : min + floor(rand * (max - min + 1)); } /** diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index b0f684efe7..da6b3ba70a 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,44 +4,45 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(e){function a(n){return n&&typeof n=="object"&&!kr(n)&&tr.call(n,"__wrapped__")?n:new U(n)}function R(n){var t=n.length,r=t>=c;if(r)for(var e={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==z[m])"),e+="){"+t.f+"}"; -e+="}"}return(t.b||_r.nonEnumArgs)&&(e+="}"),e+=t.c+";return E",r("h,i,j,l,n,o,q,t,u,y,z,A,w,H,I,K","return function("+n+"){"+e+"}")(dr,A,Mt,tr,Y,kr,ot,Er,a,B,Gt,q,br,F,Ut,ar)}function H(n){return"\\"+z[n]}function M(n){return Sr[n]}function G(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function U(n){this.__wrapped__=n}function V(){}function Q(n){var t=!1;if(!n||ar.call(n)!=B||!_r.argsClass&&Y(n))return t;var r=n.constructor;return(et(r)?r instanceof r:_r.nodeClass||!G(n))?_r.ownLast?(Br(n,function(n,r,e){return t=tr.call(e,r),!1 -}),!0===t):(Br(n,function(n,r){t=r}),!1===t||tr.call(n,t)):t}function W(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Nt(0>r?0:r);++er?pr(0,u+r):r)||0,typeof u=="number"?a=-1<(ot(n)?n.indexOf(t,r):Ct(n,t,r)):Or(n,function(n){return++eu&&(u=i)}}else t=!t&&ot(n)?T:a.createCallback(t,r),Or(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n) -});return u}function ht(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),kr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var f=Er(n),o=f.length;else _r.unindexedChars&&ot(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),vt(n,function(n,e,a){e=f?f[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function dt(n,t,r){var e; -if(t=a.createCallback(t,r),kr(n)){r=-1;for(var u=n.length;++rr?pr(0,u+r):r||0)-1;else if(r)return e=kt(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])=c;if(p)var s={};for(null!=r&&(l=[],r=a.createCallback(r,e));++uCt(l,v))&&((r||p)&&l.push(v),i.push(e))}return i}function Et(n){for(var t=-1,r=n?yt($r(n,"length")):0,e=Nt(0>r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:h,variable:"",imports:{_:a}}; -var wr={a:"x,G,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Ar=tt(Sr),Ir=J(wr,{h:wr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"E[m]=d?d(E[m],r[m]):r[m]"}),Pr=J(wr),Br=J(Cr,jr,{i:!1}),Nr=J(Cr,jr);et(/x/)&&(et=function(n){return typeof n=="function"&&ar.call(n)==I});var Fr=nr?function(n){if(!n||ar.call(n)!=B||!_r.argsClass&&Y(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=nr(t))&&nr(r); -return r?n==r||nr(n)==r:Q(n)}:Q,$r=gt;mr&&u&&typeof er=="function"&&(At=St(er,e));var qr=8==vr(m+"08")?vr:function(n,t){return vr(ot(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ir,a.at=function(n){var t=-1,r=Yt.apply(Ht,yr.call(arguments,1)),e=r.length,u=Nt(e);for(_r.unindexedChars&&ot(n)&&(n=n.split(""));++t++f&&(a=n.apply(o,u)),i=ur(e,t),a}},a.defaults=Pr,a.defer=At,a.delay=function(n,t){var e=yr.call(arguments,2);return ur(function(){n.apply(r,e)},t)},a.difference=bt,a.filter=pt,a.flatten=wt,a.forEach=vt,a.forIn=Br,a.forOwn=Nr,a.functions=nt,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),vt(n,function(n,r,u){r=Lt(t(n,r,u)),(tr.call(e,r)?e[r]:e[r]=[]).push(n)}),e -},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return W(n,0,sr(pr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e={0:{}},u=-1,a=n?n.length:0,o=a>=c,i=[],l=i;n:for(;++uCt(l,p)){o&&l.push(p);for(var v=r;--v;)if(!(e[v]||(e[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=tt,a.invoke=function(n,t){var r=yr.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Nt(typeof a=="number"?a:0); -return vt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},a.keys=Er,a.map=gt,a.max=yt,a.memoize=function(n,t){function r(){var e=r.cache,u=f+(t?t.apply(this,arguments):arguments[0]);return tr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},a.merge=it,a.min=function(n,t,r){var e=1/0,u=e;if(!t&&kr(n)){r=-1;for(var o=n.length;++rCt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Er(n),e=r.length,u=Nt(e);++tr?pr(0,e+r):sr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Pt,a.noConflict=function(){return e._=Vt,this},a.parseInt=qr,a.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+Zt(gr()*((+t||0)-n+1)) -},a.reduce=ht,a.reduceRight=mt,a.result=function(n,t){var e=n?n[t]:r;return et(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Er(n).length},a.some=dt,a.sortedIndex=kt,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Pr({},e,u);var o,i=Pr({},e.imports,u.imports),u=Er(i),i=ft(i),f=0,c=e.interpolate||b,v="__p+='",c=Kt((e.escape||b).source+"|"+c.source+"|"+(c===h?g:b).source+"|"+(e.evaluate||b).source+"|$","g");n.replace(c,function(t,r,e,u,a,i){return e||(e=u),v+=n.slice(f,i).replace(w,H),r&&(v+="'+__e("+r+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),e&&(v+="'+((__t=("+e+"))==null?'':__t)+'"),f=i+t.length,t -}),v+="';\n",c=e=e.variable,c||(e="obj",v="with("+e+"){"+v+"}"),v=(o?v.replace(l,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+e+"){"+(c?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var y=zt(u,"return "+v).apply(r,i)}catch(m){throw m.source=v,m}return t?y(t):(y.source=v,y)},a.unescape=function(n){return null==n?"":Lt(n).replace(v,X)},a.uniqueId=function(n){var t=++o;return Lt(null==n?"":n)+t -},a.all=lt,a.any=dt,a.detect=st,a.foldl=ht,a.foldr=mt,a.include=ct,a.inject=ht,Nr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return rr.apply(t,arguments),n.apply(a,t)})}),a.first=_t,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return W(n,pr(0,u-e))}},a.take=_t,a.head=_t,Nr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); -return null==t||r&&typeof t!="function"?e:new U(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Lt(this.__wrapped__)},a.prototype.value=Bt,a.prototype.valueOf=Bt,Or(["join","pop","shift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Or(["push","reverse","sort","unshift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Or(["concat","slice","splice"],function(n){var t=Ht[n];a.prototype[n]=function(){return new U(t.apply(this.__wrapped__,arguments)) -}}),_r.spliceObjects||Or(["pop","shift","splice"],function(n){var t=Ht[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new U(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},f=+new Date+"",c=200,l=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,y=/\w*$/,h=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",I="[object Function]",P="[object Number]",B="[object Object]",N="[object RegExp]",F="[object String]",$={}; -$[I]=!1,$[x]=$[E]=$[O]=$[S]=$[P]=$[B]=$[N]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=D, define(function(){return D})):e&&!e.nodeType?u?(u.exports=D)._=D:e._=D:n._=D})(this); \ No newline at end of file +;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!xe(n)&&te.call(n,"__wrapped__")?n:new U(n)}function R(n){var t=n.length,e=t>=c;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)r+="n='"+t.g[k]+"';if((!(q&&w[n])&&m.call(s,n))",t.i||(r+="||(!w[n]&&s[n]!==z[n])"),r+="){"+t.f+";}"; +r+="}"}return(t.b||we.nonEnumArgs)&&(r+="}"),r+=t.c+";return D",n("i,j,k,m,o,p,r,u,v,z,A,x,H,I,K",e+r+"}")(be,A,Mt,te,Y,xe,ot,Oe,a,Gt,$,_e,P,Ut,oe)}function H(n){return"\\"+q[n]}function M(n){return Ae[n]}function G(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function U(n){this.__wrapped__=n}function V(){}function Q(n){var t=!1;if(!n||oe.call(n)!=B||!we.argsClass&&Y(n))return t;var e=n.constructor;return(rt(e)?e instanceof e:we.nodeClass||!G(n))?we.ownLast?(Ne(n,function(n,e,r){return t=te.call(r,e),!1 +}),!0===t):(Ne(n,function(n,e){t=e}),!1===t||te.call(n,t)):t}function W(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Nt(0>e?0:e);++re?pe(0,u+e):e)||0,typeof u=="number"?a=-1<(ot(n)?n.indexOf(t,e):Ct(n,t,e)):Se(n,function(n){return++ru&&(u=i)}}else t=!t&&ot(n)?T:a.createCallback(t,e),Se(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n) +});return u}function yt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),xe(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++oarguments.length;if(typeof o!="number")var l=Oe(n),o=l.length;else we.unindexedChars&&ot(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),vt(n,function(n,r,a){r=l?l[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function mt(n,t,e){var r; +if(t=a.createCallback(t,e),xe(n)){e=-1;for(var u=n.length;++ee?pe(0,u+e):e||0)-1;else if(e)return r=kt(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=c;if(p)var v={};for(null!=r&&(s=[],r=a.createCallback(r,u));++oCt(s,g))&&((r||p)&&s.push(g),f.push(u))}return f}function Et(n){for(var t=-1,e=n?ht($e(n,"length")):0,r=Nt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var Ce={a:"y,G,l",h:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},De=tt(Ae),Ie=J(Ce,{h:Ce.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=v.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"D[n]=d?d(D[n],s[n]):s[n]"}),Be=J(Ce),Ne=J(je,ke,{i:!1}),Pe=J(je,ke); +rt(/x/)&&(rt=function(n){return typeof n=="function"&&oe.call(n)==D});var Fe=ne?function(n){if(!n||oe.call(n)!=B||!we.argsClass&&Y(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=ne(t))&&ne(e);return e?n==e||ne(n)==e:Q(n)}:Q,$e=gt;me&&u&&typeof ue=="function"&&(At=St(ue,r));var qe=8==ge(d+"08")?ge:function(n,t){return ge(ot(n)?n.replace(m,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ie,a.at=function(n){var t=-1,e=Yt.apply(Ht,ye.call(arguments,1)),r=e.length,u=Nt(r); +for(we.unindexedChars&&ot(n)&&(n=n.split(""));++t++l&&(a=n.apply(o,u)),i=ae(r,t),a}},a.defaults=Be,a.defer=At,a.delay=function(n,t){var r=ye.call(arguments,2);return ae(function(){n.apply(e,r)},t)},a.difference=bt,a.filter=st,a.flatten=wt,a.forEach=vt,a.forIn=Ne,a.forOwn=Pe,a.functions=nt,a.groupBy=function(n,t,e){var r={}; +return t=a.createCallback(t,e),vt(n,function(n,e,u){e=Lt(t(n,e,u)),(te.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return W(n,0,ve(pe(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=c,i=[],f=i;n:for(;++uCt(f,s)){o&&f.push(s); +for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(s))continue n;i.push(s)}}return i},a.invert=tt,a.invoke=function(n,t){var e=ye.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Nt(typeof a=="number"?a:0);return vt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=Oe,a.map=gt,a.max=ht,a.memoize=function(n,t){function e(){var r=e.cache,u=l+(t?t.apply(this,arguments):arguments[0]);return te.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},a.merge=it,a.min=function(n,t,e){var r=1/0,u=r; +if(!t&&xe(n)){e=-1;for(var o=n.length;++eCt(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=Oe(n),r=e.length,u=Nt(r);++te?pe(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=It,a.noConflict=function(){return r._=Vt,this},a.parseInt=qe,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var e=he();return n%1||t%1?n+ve(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},a.reduce=yt,a.reduceRight=dt,a.result=function(n,t){var r=n?n[t]:e;return rt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0; +return typeof t=="number"?t:Oe(n).length},a.some=mt,a.sortedIndex=kt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=Be({},r,u);var o,i=Be({},r.imports,u.imports),u=Oe(i),i=lt(i),l=0,c=r.interpolate||b,v="__p+='",c=Kt((r.escape||b).source+"|"+c.source+"|"+(c===y?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(c,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(l,i).replace(w,H),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),l=i+t.length,t +}),v+="';\n",c=r=r.variable,c||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(s,"$1").replace(p,"$1;"),v="function("+r+"){"+(c?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=qt(u,"return "+v).apply(e,i)}catch(d){throw d.source=v,d}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Lt(n).replace(v,X)},a.uniqueId=function(n){var t=++o;return Lt(null==n?"":n)+t +},a.all=ft,a.any=mt,a.detect=pt,a.foldl=yt,a.foldr=dt,a.include=ct,a.inject=yt,Pe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ee.apply(t,arguments),n.apply(a,t)})}),a.first=_t,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return W(n,pe(0,u-r))}},a.take=_t,a.head=_t,Pe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); +return null==t||e&&typeof t!="function"?r:new U(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Lt(this.__wrapped__)},a.prototype.value=Bt,a.prototype.valueOf=Bt,Se(["join","pop","shift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Se(["push","reverse","sort","unshift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Se(["concat","slice","splice"],function(n){var t=Ht[n];a.prototype[n]=function(){return new U(t.apply(this.__wrapped__,arguments)) +}}),we.spliceObjects||Se(["pop","shift","splice"],function(n){var t=Ht[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new U(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},l=+new Date+"",c=200,f=/\b__p\+='';/g,s=/\b(__p\+=)''\+/g,p=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",m=RegExp("^["+d+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",D="[object Function]",I="[object Number]",B="[object Object]",N="[object RegExp]",P="[object String]",F={}; +F[D]=!1,F[x]=F[E]=F[O]=F[S]=F[I]=F[B]=F[N]=F[P]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):r&&!r.nodeType?u?(u.exports=z)._=z:r._=z:n._=z})(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 7e7cf20f55..dbd4ca397e 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -186,6 +186,7 @@ getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, + propertyIsEnumerable = objectProto.propertyIsEnumerable, setImmediate = context.setImmediate, setTimeout = context.setTimeout, toString = objectProto.toString; @@ -667,10 +668,10 @@ var shimKeys = function (object) { var index, iterable = object, result = []; if (!iterable) return result; - if (!(objectTypes[typeof object])) return result; + if (!(objectTypes[typeof object])) return result; for (index in iterable) { - if (hasOwnProperty.call(iterable, index)) { - result.push(index); + if (hasOwnProperty.call(iterable, index)) { + result.push(index); } } return result @@ -760,17 +761,17 @@ } while (++argsIndex < argsLength) { iterable = args[argsIndex]; - if (iterable && objectTypes[typeof iterable]) {; + if (iterable && objectTypes[typeof iterable]) { var ownIndex = -1, ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], length = ownProps.length; while (++ownIndex < length) { index = ownProps[ownIndex]; - result[index] = callback ? callback(result[index], iterable[index]) : iterable[index] + result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]; } } - }; + } return result }; @@ -821,7 +822,7 @@ // allows working with "Collections" methods without using their `callback` // argument, `index|key`, for this method's `callback` - if (typeof deep == 'function') { + if (typeof deep != 'boolean' && deep != null) { thisArg = callback; callback = deep; deep = false; @@ -973,17 +974,17 @@ argsLength = typeof guard == 'number' ? 2 : args.length; while (++argsIndex < argsLength) { iterable = args[argsIndex]; - if (iterable && objectTypes[typeof iterable]) {; + if (iterable && objectTypes[typeof iterable]) { var ownIndex = -1, ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], length = ownProps.length; while (++ownIndex < length) { index = ownProps[ownIndex]; - if (typeof result[index] == 'undefined') result[index] = iterable[index] + if (typeof result[index] == 'undefined') result[index] = iterable[index]; } } - }; + } return result }; @@ -1052,7 +1053,7 @@ var index, iterable = collection, result = iterable; if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; - callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); + callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); for (index in iterable) { if (callback(iterable[index], index, collection) === false) return result; } @@ -1084,14 +1085,14 @@ var index, iterable = collection, result = iterable; if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; - callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); + callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); var ownIndex = -1, ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], length = ownProps.length; while (++ownIndex < length) { index = ownProps[ownIndex]; - if (callback(iterable[index], index, collection) === false) return result + if (callback(iterable[index], index, collection) === false) return result; } return result }; @@ -3213,7 +3214,7 @@ // juggle arguments if (typeof isShallow != 'boolean' && isShallow != null) { thisArg = callback; - callback = isShallow; + callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined; isShallow = false; } if (callback != null) { @@ -3774,7 +3775,7 @@ // juggle arguments if (typeof isSorted != 'boolean' && isSorted != null) { thisArg = callback; - callback = isSorted; + callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined; isSorted = false; } // init value cache for large arrays @@ -4645,8 +4646,13 @@ if (max == null) { max = min; min = 0; + } else { + max = +max || 0; } - return min + floor(nativeRandom() * ((+max || 0) - min + 1)); + var rand = nativeRandom(); + return (min % 1 || max % 1) + ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max) + : min + floor(rand * (max - min + 1)); } /** diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 15236eca00..1027eb523c 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -8,8 +8,8 @@ if(!u)return a;for(var o=arguments,i=0,f=typeof e=="number"?2:o.length;++i=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; if(ne?0:e);++re?0:e);++ru&&(u=o) }}else t=!t&<(n)?J:G.createCallback(t,e),bt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function _t(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; if(typeof u!="number")var i=we(n),u=i.length;return t=G.createCallback(t,r,4),bt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=Nt(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(l)var v={};for(e!=u&&(c=[],e=G.createCallback(e,r));++oEt(c,g))&&((e||l)&&c.push(g),f.push(r))}return f}function At(n){for(var t=-1,e=n?dt(_t(n,"length")):0,r=Dt(0>e?0:e);++te?ge(0,u+e):e||0)-1;else if(e)return r=Nt(n,t),n[r]===t?r:-1; +for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=G.createCallback(r,o));++iEt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function At(n){for(var t=-1,e=n?dt(_t(n,"length")):0,r=Dt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,we=ve?function(n){return ft(n)?ve(n):[]}:V,je={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=at(je);return Ut&&i&&typeof oe=="function"&&(Ft=Bt(oe,o)),zt=8==he(_+"08")?he:function(n,t){return he(lt(n)?n.replace(k,""):n,t||0) },G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=te.apply(Qt,me.call(arguments,1)),r=e.length,u=Dt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){return n==u&&t==u&&(t=1),n=+n||0,t==u&&(t=n,n=0),n+ee(be()*((+t||0)-n+1))},G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e;return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:we(n).length},G.some=jt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=we(i),i=st(i),f=0,c=u.interpolate||w,l="__p+='",c=Ht((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t +},G.isString=lt,G.isUndefined=function(n){return typeof n=="undefined"},G.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ee(e*(t-n+1))},G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e; +return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:we(n).length},G.some=jt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=we(i),i=st(i),f=0,c=u.interpolate||w,l="__p+='",c=Ht((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t }),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Mt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Jt(n).replace(h,et)},G.uniqueId=function(n){var t=++c;return Jt(n==u?"":n)+t },G.all=gt,G.any=jt,G.detect=ht,G.foldl=kt,G.foldr=wt,G.include=vt,G.inject=kt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(G,t)})}),G.first=xt,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return tt(n,ge(0,a-r))}},G.take=xt,G.head=xt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Jt(this.__wrapped__)},G.prototype.value=qt,G.prototype.valueOf=qt,bt(["join","pop","shift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),bt(["push","reverse","sort","unshift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),bt(["concat","slice","splice"],function(n){var t=Qt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments)) diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index ff142d17a7..1b89fabd27 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -126,6 +126,7 @@ floor = Math.floor, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, + propertyIsEnumerable = objectProto.propertyIsEnumerable, setTimeout = window.setTimeout, toString = objectProto.toString; @@ -511,10 +512,10 @@ var shimKeys = function (object) { var index, iterable = object, result = []; if (!iterable) return result; - if (!(objectTypes[typeof object])) return result; + if (!(objectTypes[typeof object])) return result; for (index in iterable) { - if (hasOwnProperty.call(iterable, index)) { - result.push(index); + if (hasOwnProperty.call(iterable, index)) { + result.push(index); } } return result @@ -756,8 +757,8 @@ if (!iterable) return result; if (!objectTypes[typeof iterable]) return result; for (index in iterable) { - if (hasOwnProperty.call(iterable, index)) { - if (callback(iterable[index], index, collection) === indicatorObject) return result; + if (hasOwnProperty.call(iterable, index)) { + if (callback(iterable[index], index, collection) === indicatorObject) return result; } } return result @@ -3874,8 +3875,13 @@ if (max == null) { max = min; min = 0; + } else { + max = +max || 0; } - return min + floor(nativeRandom() * ((+max || 0) - min + 1)); + var rand = nativeRandom(); + return (min % 1 || max % 1) + ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max) + : min + floor(rand * (max - min + 1)); } /** diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 51f464eb66..4d1b51fe21 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -6,30 +6,30 @@ */ ;(function(n){function t(n){return n instanceof t?n:new i(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; -if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=P(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Rt(n),u=i.length;return t=P(t,e,4),O(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; -t=P(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rT(e,o)&&u.push(o)}return u}function D(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=P(t,r);++or?Et(0,u+r):r||0)-1;else if(r)return e=I(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])T(a,f))&&(r&&a.push(f),i.push(e))}return i}function C(n,t){return qt.fastBind||jt&&2"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",ft={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ct=Array.prototype,H=Object.prototype,pt=n._,st=RegExp("^"+(H.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),vt=Math.ceil,gt=n.clearTimeout,ht=ct.concat,yt=Math.floor,mt=H.hasOwnProperty,_t=ct.push,bt=n.setTimeout,dt=H.toString,jt=st.test(jt=dt.bind)&&jt,wt=st.test(wt=Array.isArray)&&wt,At=n.isFinite,xt=n.isNaN,Ot=st.test(Ot=Object.keys)&&Ot,Et=Math.max,St=Math.min,Nt=Math.random,Bt=ct.slice,H=st.test(n.attachEvent),kt=jt&&!/\n|true/.test(jt+H),qt={}; -(function(){var n={0:1,length:1};qt.fastBind=jt&&!kt,qt.spliceObjects=(ct.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},i.prototype=t.prototype,l(arguments)||(l=function(n){return n?mt.call(n,"callee"):!1});var Ft=wt||function(n){return n?typeof n=="object"&&dt.call(n)==tt:!1},wt=function(n){var t,r=[];if(!n||!ft[typeof n])return r;for(t in n)mt.call(n,t)&&r.push(t);return r},Rt=Ot?function(n){return m(n)?Ot(n):[] +}}function E(n,t,r){var e=-1,u=n?n.length:0;if(t=t&&typeof r=="undefined"?t:P(t,r),typeof u=="number")for(;++ee&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; +if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=P(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Rt(n),u=i.length;return t=P(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function k(n,t,r){var e; +t=P(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rT(e,o)&&u.push(o)}return u}function D(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=P(t,r);++or?Ot(0,u+r):r||0)-1;else if(r)return e=I(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])T(a,f))&&(r&&a.push(f),i.push(e))}return i}function C(n,t){return kt.fastBind||jt&&2"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",ft={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ct=Array.prototype,H=Object.prototype,pt=n._,st=RegExp("^"+(H.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),vt=Math.ceil,gt=n.clearTimeout,ht=ct.concat,yt=Math.floor,mt=H.hasOwnProperty,_t=ct.push,bt=n.setTimeout,dt=H.toString,jt=st.test(jt=dt.bind)&&jt,wt=st.test(wt=Array.isArray)&&wt,At=n.isFinite,xt=n.isNaN,Et=st.test(Et=Object.keys)&&Et,Ot=Math.max,St=Math.min,Nt=Math.random,Bt=ct.slice,H=st.test(n.attachEvent),Ft=jt&&!/\n|true/.test(jt+H),kt={}; +(function(){var n={0:1,length:1};kt.fastBind=jt&&!Ft,kt.spliceObjects=(ct.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},i.prototype=t.prototype,l(arguments)||(l=function(n){return n?mt.call(n,"callee"):!1});var qt=wt||function(n){return n?typeof n=="object"&&dt.call(n)==tt:!1},wt=function(n){var t,r=[];if(!n||!ft[typeof n])return r;for(t in n)mt.call(n,t)&&r.push(t);return r},Rt=Et?function(n){return m(n)?Et(n):[] }:wt,Dt={"&":"&","<":"<",">":">",'"':""","'":"'"},Mt=v(Dt),Tt=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(t(n[r],r,n)===K)break;return n},$t=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(mt.call(n,r)&&t(n[r],r,n)===K)break;return n};y(/x/)&&(y=function(n){return typeof n=="function"&&"[object Function]"==dt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},t.bind=C,t.bindAll=function(n){for(var t=1T(o,i)){for(var a=r;--a;)if(0>T(t[a],i))continue n;o.push(i)}}return o},t.invert=v,t.invoke=function(n,t){var r=Bt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return O(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Rt,t.map=E,t.max=S,t.memoize=function(n,t){var r={};return function(){var e=L+(t?t.apply(this,arguments):arguments[0]); -return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=P(t,r),O(n,function(n,r,o){r=t(n,r,o),rT(t,e)&&(r[e]=n)}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++tr?0:r);++tT(o,i)){for(var a=r;--a;)if(0>T(t[a],i))continue n;o.push(i)}}return o},t.invert=v,t.invoke=function(n,t){var r=Bt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Rt,t.map=O,t.max=S,t.memoize=function(n,t){var r={};return function(){var e=L+(t?t.apply(this,arguments):arguments[0]); +return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=P(t,r),E(n,function(n,r,o){r=t(n,r,o),rT(t,e)&&(r[e]=n)}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Et(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){return null==n&&null==t&&(t=1),n=+n||0,null==t&&(t=n,n=0),n+yt(Nt()*((+t||0)-n+1))},t.reduce=B,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=q,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); +for(typeof r=="number"&&(e=(0>r?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Nt();return n%1||t%1?n+St(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+yt(r*(t-n+1))},t.reduce=B,t.reduceRight=F,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=k,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t) -}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=q,t.detect=x,t.foldl=B,t.foldr=k,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Et(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this -},t.prototype.value=function(){return this.__wrapped__},O("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!qt.spliceObjects&&0===n.length&&delete n[0],this}}),O(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t +}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=k,t.detect=x,t.foldl=B,t.foldr=F,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this +},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!kt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t })):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 22b040285c..0aa6d6bcf3 100644 --- a/doc/README.md +++ b/doc/README.md @@ -6,31 +6,31 @@ ## `Arrays` -* [`_.compact`](#_compactarray) -* [`_.difference`](#_differencearray--array1-array2-) -* [`_.drop`](#_restarray--callbackn1-thisarg) -* [`_.findIndex`](#_findindexarray--callbackidentity-thisarg) -* [`_.first`](#_firstarray--callbackn-thisarg) -* [`_.flatten`](#_flattenarray--isshallowfalse-callbackidentity-thisarg) -* [`_.head`](#_firstarray--callbackn-thisarg) -* [`_.indexOf`](#_indexofarray-value--fromindex0) -* [`_.initial`](#_initialarray--callbackn1-thisarg) -* [`_.intersection`](#_intersectionarray1-array2-) -* [`_.last`](#_lastarray--callbackn-thisarg) -* [`_.lastIndexOf`](#_lastindexofarray-value--fromindexarraylength-1) -* [`_.object`](#_zipobjectkeys--values) -* [`_.range`](#_rangestart0-end--step1) -* [`_.rest`](#_restarray--callbackn1-thisarg) -* [`_.sortedIndex`](#_sortedindexarray-value--callbackidentity-thisarg) -* [`_.tail`](#_restarray--callbackn1-thisarg) -* [`_.take`](#_firstarray--callbackn-thisarg) -* [`_.union`](#_unionarray1-array2-) -* [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg) -* [`_.unique`](#_uniqarray--issortedfalse-callbackidentity-thisarg) -* [`_.unzip`](#_unziparray) -* [`_.without`](#_withoutarray--value1-value2-) -* [`_.zip`](#_ziparray1-array2-) -* [`_.zipObject`](#_zipobjectkeys--values) +* [`chain.compact`](#_compactarray) +* [`chain.difference`](#_differencearray--array1-array2-) +* [`chain.drop`](#_restarray--callbackn1-thisarg) +* [`chain.findIndex`](#_findindexarray--callbackidentity-thisarg) +* [`chain.first`](#_firstarray--callbackn-thisarg) +* [`chain.flatten`](#_flattenarray--isshallowfalse-callbackidentity-thisarg) +* [`chain.head`](#_firstarray--callbackn-thisarg) +* [`chain.indexOf`](#_indexofarray-value--fromindex0) +* [`chain.initial`](#_initialarray--callbackn1-thisarg) +* [`chain.intersection`](#_intersectionarray1-array2-) +* [`chain.last`](#_lastarray--callbackn-thisarg) +* [`chain.lastIndexOf`](#_lastindexofarray-value--fromindexarraylength-1) +* [`chain.object`](#_zipobjectkeys--values) +* [`chain.range`](#_rangestart0-end--step1) +* [`chain.rest`](#_restarray--callbackn1-thisarg) +* [`chain.sortedIndex`](#_sortedindexarray-value--callbackidentity-thisarg) +* [`chain.tail`](#_restarray--callbackn1-thisarg) +* [`chain.take`](#_firstarray--callbackn-thisarg) +* [`chain.union`](#_unionarray1-array2-) +* [`chain.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg) +* [`chain.unique`](#_uniqarray--issortedfalse-callbackidentity-thisarg) +* [`chain.unzip`](#_unziparray) +* [`chain.without`](#_withoutarray--value1-value2-) +* [`chain.zip`](#_ziparray1-array2-) +* [`chain.zipObject`](#_zipobjectkeys--values) @@ -38,11 +38,11 @@ ## `Chaining` -* [`_`](#_value) -* [`_.tap`](#_tapvalue-interceptor) -* [`_.prototype.toString`](#_prototypetostring) -* [`_.prototype.value`](#_prototypevalueof) -* [`_.prototype.valueOf`](#_prototypevalueof) +* [`chain`](#_value) +* [`chain.tap`](#_tapvalue-interceptor) +* [`chain.prototype.toString`](#_prototypetostring) +* [`chain.prototype.value`](#_prototypevalueof) +* [`chain.prototype.valueOf`](#_prototypevalueof) @@ -50,38 +50,38 @@ ## `Collections` -* [`_.all`](#_everycollection--callbackidentity-thisarg) -* [`_.any`](#_somecollection--callbackidentity-thisarg) -* [`_.at`](#_atcollection--index1-index2-) -* [`_.collect`](#_mapcollection--callbackidentity-thisarg) -* [`_.contains`](#_containscollection-target--fromindex0) -* [`_.countBy`](#_countbycollection--callbackidentity-thisarg) -* [`_.detect`](#_findcollection--callbackidentity-thisarg) -* [`_.each`](#_foreachcollection--callbackidentity-thisarg) -* [`_.every`](#_everycollection--callbackidentity-thisarg) -* [`_.filter`](#_filtercollection--callbackidentity-thisarg) -* [`_.find`](#_findcollection--callbackidentity-thisarg) -* [`_.foldl`](#_reducecollection--callbackidentity-accumulator-thisarg) -* [`_.foldr`](#_reducerightcollection--callbackidentity-accumulator-thisarg) -* [`_.forEach`](#_foreachcollection--callbackidentity-thisarg) -* [`_.groupBy`](#_groupbycollection--callbackidentity-thisarg) -* [`_.include`](#_containscollection-target--fromindex0) -* [`_.inject`](#_reducecollection--callbackidentity-accumulator-thisarg) -* [`_.invoke`](#_invokecollection-methodname--arg1-arg2-) -* [`_.map`](#_mapcollection--callbackidentity-thisarg) -* [`_.max`](#_maxcollection--callbackidentity-thisarg) -* [`_.min`](#_mincollection--callbackidentity-thisarg) -* [`_.pluck`](#_pluckcollection-property) -* [`_.reduce`](#_reducecollection--callbackidentity-accumulator-thisarg) -* [`_.reduceRight`](#_reducerightcollection--callbackidentity-accumulator-thisarg) -* [`_.reject`](#_rejectcollection--callbackidentity-thisarg) -* [`_.select`](#_filtercollection--callbackidentity-thisarg) -* [`_.shuffle`](#_shufflecollection) -* [`_.size`](#_sizecollection) -* [`_.some`](#_somecollection--callbackidentity-thisarg) -* [`_.sortBy`](#_sortbycollection--callbackidentity-thisarg) -* [`_.toArray`](#_toarraycollection) -* [`_.where`](#_wherecollection-properties) +* [`chain.all`](#_everycollection--callbackidentity-thisarg) +* [`chain.any`](#_somecollection--callbackidentity-thisarg) +* [`chain.at`](#_atcollection--index1-index2-) +* [`chain.collect`](#_mapcollection--callbackidentity-thisarg) +* [`chain.contains`](#_containscollection-target--fromindex0) +* [`chain.countBy`](#_countbycollection--callbackidentity-thisarg) +* [`chain.detect`](#_findcollection--callbackidentity-thisarg) +* [`chain.each`](#_foreachcollection--callbackidentity-thisarg) +* [`chain.every`](#_everycollection--callbackidentity-thisarg) +* [`chain.filter`](#_filtercollection--callbackidentity-thisarg) +* [`chain.find`](#_findcollection--callbackidentity-thisarg) +* [`chain.foldl`](#_reducecollection--callbackidentity-accumulator-thisarg) +* [`chain.foldr`](#_reducerightcollection--callbackidentity-accumulator-thisarg) +* [`chain.forEach`](#_foreachcollection--callbackidentity-thisarg) +* [`chain.groupBy`](#_groupbycollection--callbackidentity-thisarg) +* [`chain.include`](#_containscollection-target--fromindex0) +* [`chain.inject`](#_reducecollection--callbackidentity-accumulator-thisarg) +* [`chain.invoke`](#_invokecollection-methodname--arg1-arg2-) +* [`chain.map`](#_mapcollection--callbackidentity-thisarg) +* [`chain.max`](#_maxcollection--callbackidentity-thisarg) +* [`chain.min`](#_mincollection--callbackidentity-thisarg) +* [`chain.pluck`](#_pluckcollection-property) +* [`chain.reduce`](#_reducecollection--callbackidentity-accumulator-thisarg) +* [`chain.reduceRight`](#_reducerightcollection--callbackidentity-accumulator-thisarg) +* [`chain.reject`](#_rejectcollection--callbackidentity-thisarg) +* [`chain.select`](#_filtercollection--callbackidentity-thisarg) +* [`chain.shuffle`](#_shufflecollection) +* [`chain.size`](#_sizecollection) +* [`chain.some`](#_somecollection--callbackidentity-thisarg) +* [`chain.sortBy`](#_sortbycollection--callbackidentity-thisarg) +* [`chain.toArray`](#_toarraycollection) +* [`chain.where`](#_wherecollection-properties) @@ -89,21 +89,21 @@ ## `Functions` -* [`_.after`](#_aftern-func) -* [`_.bind`](#_bindfunc--thisarg-arg1-arg2-) -* [`_.bindAll`](#_bindallobject--methodname1-methodname2-) -* [`_.bindKey`](#_bindkeyobject-key--arg1-arg2-) -* [`_.compose`](#_composefunc1-func2-) -* [`_.createCallback`](#_createcallbackfuncidentity-thisarg-argcount3) -* [`_.debounce`](#_debouncefunc-wait-options) -* [`_.defer`](#_deferfunc--arg1-arg2-) -* [`_.delay`](#_delayfunc-wait--arg1-arg2-) -* [`_.memoize`](#_memoizefunc--resolver) -* [`_.once`](#_oncefunc) -* [`_.partial`](#_partialfunc--arg1-arg2-) -* [`_.partialRight`](#_partialrightfunc--arg1-arg2-) -* [`_.throttle`](#_throttlefunc-wait-options) -* [`_.wrap`](#_wrapvalue-wrapper) +* [`chain.after`](#_aftern-func) +* [`chain.bind`](#_bindfunc--thisarg-arg1-arg2-) +* [`chain.bindAll`](#_bindallobject--methodname1-methodname2-) +* [`chain.bindKey`](#_bindkeyobject-key--arg1-arg2-) +* [`chain.compose`](#_composefunc1-func2-) +* [`chain.createCallback`](#_createcallbackfuncidentity-thisarg-argcount3) +* [`chain.debounce`](#_debouncefunc-wait-options) +* [`chain.defer`](#_deferfunc--arg1-arg2-) +* [`chain.delay`](#_delayfunc-wait--arg1-arg2-) +* [`chain.memoize`](#_memoizefunc--resolver) +* [`chain.once`](#_oncefunc) +* [`chain.partial`](#_partialfunc--arg1-arg2-) +* [`chain.partialRight`](#_partialrightfunc--arg1-arg2-) +* [`chain.throttle`](#_throttlefunc-wait-options) +* [`chain.wrap`](#_wrapvalue-wrapper) @@ -111,41 +111,41 @@ ## `Objects` -* [`_.assign`](#_assignobject--source1-source2--callback-thisarg) -* [`_.clone`](#_clonevalue--deepfalse-callback-thisarg) -* [`_.cloneDeep`](#_clonedeepvalue--callback-thisarg) -* [`_.defaults`](#_defaultsobject--source1-source2-) -* [`_.extend`](#_assignobject--source1-source2--callback-thisarg) -* [`_.findKey`](#_findkeyobject--callbackidentity-thisarg) -* [`_.forIn`](#_forinobject--callbackidentity-thisarg) -* [`_.forOwn`](#_forownobject--callbackidentity-thisarg) -* [`_.functions`](#_functionsobject) -* [`_.has`](#_hasobject-property) -* [`_.invert`](#_invertobject) -* [`_.isArguments`](#_isargumentsvalue) -* [`_.isArray`](#_isarrayvalue) -* [`_.isBoolean`](#_isbooleanvalue) -* [`_.isDate`](#_isdatevalue) -* [`_.isElement`](#_iselementvalue) -* [`_.isEmpty`](#_isemptyvalue) -* [`_.isEqual`](#_isequala-b--callback-thisarg) -* [`_.isFinite`](#_isfinitevalue) -* [`_.isFunction`](#_isfunctionvalue) -* [`_.isNaN`](#_isnanvalue) -* [`_.isNull`](#_isnullvalue) -* [`_.isNumber`](#_isnumbervalue) -* [`_.isObject`](#_isobjectvalue) -* [`_.isPlainObject`](#_isplainobjectvalue) -* [`_.isRegExp`](#_isregexpvalue) -* [`_.isString`](#_isstringvalue) -* [`_.isUndefined`](#_isundefinedvalue) -* [`_.keys`](#_keysobject) -* [`_.merge`](#_mergeobject--source1-source2--callback-thisarg) -* [`_.methods`](#_functionsobject) -* [`_.omit`](#_omitobject-callback-prop1-prop2--thisarg) -* [`_.pairs`](#_pairsobject) -* [`_.pick`](#_pickobject-callback-prop1-prop2--thisarg) -* [`_.values`](#_valuesobject) +* [`chain.assign`](#_assignobject--source1-source2--callback-thisarg) +* [`chain.clone`](#_clonevalue--deepfalse-callback-thisarg) +* [`chain.cloneDeep`](#_clonedeepvalue--callback-thisarg) +* [`chain.defaults`](#_defaultsobject--source1-source2-) +* [`chain.extend`](#_assignobject--source1-source2--callback-thisarg) +* [`chain.findKey`](#_findkeyobject--callbackidentity-thisarg) +* [`chain.forIn`](#_forinobject--callbackidentity-thisarg) +* [`chain.forOwn`](#_forownobject--callbackidentity-thisarg) +* [`chain.functions`](#_functionsobject) +* [`chain.has`](#_hasobject-property) +* [`chain.invert`](#_invertobject) +* [`chain.isArguments`](#_isargumentsvalue) +* [`chain.isArray`](#_isarrayvalue) +* [`chain.isBoolean`](#_isbooleanvalue) +* [`chain.isDate`](#_isdatevalue) +* [`chain.isElement`](#_iselementvalue) +* [`chain.isEmpty`](#_isemptyvalue) +* [`chain.isEqual`](#_isequala-b--callback-thisarg) +* [`chain.isFinite`](#_isfinitevalue) +* [`chain.isFunction`](#_isfunctionvalue) +* [`chain.isNaN`](#_isnanvalue) +* [`chain.isNull`](#_isnullvalue) +* [`chain.isNumber`](#_isnumbervalue) +* [`chain.isObject`](#_isobjectvalue) +* [`chain.isPlainObject`](#_isplainobjectvalue) +* [`chain.isRegExp`](#_isregexpvalue) +* [`chain.isString`](#_isstringvalue) +* [`chain.isUndefined`](#_isundefinedvalue) +* [`chain.keys`](#_keysobject) +* [`chain.merge`](#_mergeobject--source1-source2--callback-thisarg) +* [`chain.methods`](#_functionsobject) +* [`chain.omit`](#_omitobject-callback-prop1-prop2--thisarg) +* [`chain.pairs`](#_pairsobject) +* [`chain.pick`](#_pickobject-callback-prop1-prop2--thisarg) +* [`chain.values`](#_valuesobject) @@ -153,18 +153,17 @@ ## `Utilities` -* [`_.escape`](#_escapestring) -* [`_.identity`](#_identityvalue) -* [`_.mixin`](#_mixinobject) -* [`_.noConflict`](#_noconflict) -* [`_.parseInt`](#_parseintvalue--radix) -* [`_.random`](#_randommin0-max1) -* [`_.result`](#_resultobject-property) -* [`_.runInContext`](#_runincontextcontextwindow) -* [`_.template`](#_templatetext-data-options) -* [`_.times`](#_timesn-callback--thisarg) -* [`_.unescape`](#_unescapestring) -* [`_.uniqueId`](#_uniqueidprefix) +* [`chain.escape`](#_escapestring) +* [`chain.identity`](#_identityvalue) +* [`chain.mixin`](#_mixinobject) +* [`chain.noConflict`](#_noconflict) +* [`chain.parseInt`](#_parseintvalue--radix) +* [`chain.random`](#_randommin0-max1) +* [`chain.result`](#_resultobject-property) +* [`chain.template`](#_templatetext-data-options) +* [`chain.times`](#_timesn-callback--thisarg) +* [`chain.unescape`](#_unescapestring) +* [`chain.uniqueId`](#_uniqueidprefix) @@ -180,7 +179,8 @@ ## `Properties` -* [`_.VERSION`](#_version) +* [`chain.VERSION`](#_version) +* [`enumErrorProps`](#enumerrorprops) * [`_.support`](#_support) * [`_.support.argsClass`](#_supportargsclass) * [`_.support.argsObject`](#_supportargsobject) @@ -213,8 +213,8 @@ -### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3325 "View in source") [Ⓣ][1] +### `chain.compact(array)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3339 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -237,8 +237,8 @@ _.compact([0, 1, false, 2, '', 3]); -### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3355 "View in source") [Ⓣ][1] +### `chain.difference(array [, array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3369 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -262,8 +262,8 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); -### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3391 "View in source") [Ⓣ][1] +### `chain.findIndex(array [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3405 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -290,8 +290,8 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { -### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3461 "View in source") [Ⓣ][1] +### `chain.first(array [, callback|n, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3475 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -350,8 +350,8 @@ _.first(food, { 'type': 'fruit' }); -### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3523 "View in source") [Ⓣ][1] +### `chain.flatten(array [, isShallow=false, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3537 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -393,8 +393,8 @@ _.flatten(stooges, 'quotes'); -### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3576 "View in source") [Ⓣ][1] +### `chain.indexOf(array, value [, fromIndex=0])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3590 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -425,8 +425,8 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); -### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3650 "View in source") [Ⓣ][1] +### `chain.initial(array [, callback|n=1, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3664 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -482,8 +482,8 @@ _.initial(food, { 'type': 'vegetable' }); -### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3684 "View in source") [Ⓣ][1] +### `chain.intersection([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3698 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -506,8 +506,8 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); -### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3776 "View in source") [Ⓣ][1] +### `chain.last(array [, callback|n, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3790 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -563,8 +563,8 @@ _.last(food, { 'type': 'vegetable' }); -### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3817 "View in source") [Ⓣ][1] +### `chain.lastIndexOf(array, value [, fromIndex=array.length-1])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3831 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -592,8 +592,8 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); -### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3858 "View in source") [Ⓣ][1] +### `chain.range([start=0], end [, step=1])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3872 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -630,8 +630,8 @@ _.range(0); -### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3937 "View in source") [Ⓣ][1] +### `chain.rest(array [, callback|n=1, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3951 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -690,8 +690,8 @@ _.rest(food, { 'type': 'fruit' }); -### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4001 "View in source") [Ⓣ][1] +### `chain.sortedIndex(array, value [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4015 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -739,8 +739,8 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { -### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4033 "View in source") [Ⓣ][1] +### `chain.union([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4047 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -763,8 +763,8 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); -### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4083 "View in source") [Ⓣ][1] +### `chain.uniq(array [, isSorted=false, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4097 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -810,8 +810,8 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); -### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4141 "View in source") [Ⓣ][1] +### `chain.unzip(array)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4155 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -834,8 +834,8 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); -### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4167 "View in source") [Ⓣ][1] +### `chain.without(array [, value1, value2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4181 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -859,8 +859,8 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); -### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4187 "View in source") [Ⓣ][1] +### `chain.zip([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4201 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -883,8 +883,8 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); -### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4209 "View in source") [Ⓣ][1] +### `chain.zipObject(keys [, values=[]])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4223 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -918,61 +918,8 @@ _.zipObject(['moe', 'larry'], [30, 40]); -### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L307 "View in source") [Ⓣ][1] - -Creates a `lodash` object, which wraps the given `value`, to enable method chaining. - -In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
-`concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, and `unshift` - -Chaining is supported in custom builds as long as the `value` method is implicitly or explicitly included in the build. - -The chainable wrapper functions are:
-`after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, `concat`, `countBy`, `createCallback`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forIn`, `forOwn`, `functions`, `groupBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, and `zip` - -The non-chainable wrapper functions are:
-`clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, `template`, `unescape`, `uniqueId`, and `value` - -The wrapper functions `first` and `last` return wrapped values when `n` is passed, otherwise they return unwrapped values. - -#### Arguments -1. `value` *(Mixed)*: The value to wrap in a `lodash` instance. - -#### Returns -*(Object)*: Returns a `lodash` instance. - -#### Example -```js -var wrapped = _([1, 2, 3]); - -// returns an unwrapped value -wrapped.reduce(function(sum, num) { - return sum + num; -}); -// => 6 - -// returns a wrapped value -var squares = wrapped.map(function(num) { - return num * num; -}); - -_.isArray(squares); -// => false - -_.isArray(squares.value()); -// => true -``` - -* * * - - - - - - -### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5275 "View in source") [Ⓣ][1] +### `chain.tap(value, interceptor)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5297 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1001,8 +948,8 @@ _([1, 2, 3, 4]) -### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5292 "View in source") [Ⓣ][1] +### `chain.prototype.toString()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5314 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1022,8 +969,8 @@ _([1, 2, 3]).toString(); -### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5309 "View in source") [Ⓣ][1] +### `chain.prototype.valueOf()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5331 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1053,8 +1000,8 @@ _([1, 2, 3]).valueOf(); -### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2314 "View in source") [Ⓣ][1] +### `chain.at(collection [, index1, index2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2328 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1081,8 +1028,8 @@ _.at(['moe', 'larry', 'curly'], 0, 2); -### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2356 "View in source") [Ⓣ][1] +### `chain.contains(collection, target [, fromIndex=0])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2370 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1119,8 +1066,8 @@ _.contains('curly', 'ur'); -### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2410 "View in source") [Ⓣ][1] +### `chain.countBy(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2424 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1155,8 +1102,8 @@ _.countBy(['one', 'two', 'three'], 'length'); -### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2462 "View in source") [Ⓣ][1] +### `chain.every(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2476 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1201,8 +1148,8 @@ _.every(stooges, { 'age': 50 }); -### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2523 "View in source") [Ⓣ][1] +### `chain.filter(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2537 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1247,8 +1194,8 @@ _.filter(food, { 'type': 'fruit' }); -### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2590 "View in source") [Ⓣ][1] +### `chain.find(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2604 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1296,8 +1243,8 @@ _.find(food, 'organic'); -### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2637 "View in source") [Ⓣ][1] +### `chain.forEach(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2651 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1328,8 +1275,8 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); -### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2687 "View in source") [Ⓣ][1] +### `chain.groupBy(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2701 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1365,8 +1312,8 @@ _.groupBy(['one', 'two', 'three'], 'length'); -### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2720 "View in source") [Ⓣ][1] +### `chain.invoke(collection, methodName [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2734 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1394,8 +1341,8 @@ _.invoke([123, 456], String.prototype.split, ''); -### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] +### `chain.map(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2786 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1439,8 +1386,8 @@ _.map(stooges, 'name'); -### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2829 "View in source") [Ⓣ][1] +### `chain.max(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2843 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1481,8 +1428,8 @@ _.max(stooges, 'age'); -### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2898 "View in source") [Ⓣ][1] +### `chain.min(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2912 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1523,8 +1470,8 @@ _.min(stooges, 'age'); -### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2948 "View in source") [Ⓣ][1] +### `chain.pluck(collection, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2962 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1553,8 +1500,8 @@ _.pluck(stooges, 'name'); -### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2980 "View in source") [Ⓣ][1] +### `chain.reduce(collection [, callback=identity, accumulator, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2994 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1591,8 +1538,8 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { -### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3023 "View in source") [Ⓣ][1] +### `chain.reduceRight(collection [, callback=identity, accumulator, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3037 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1622,8 +1569,8 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); -### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] +### `chain.reject(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3097 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1665,8 +1612,8 @@ _.reject(food, { 'type': 'fruit' }); -### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3104 "View in source") [Ⓣ][1] +### `chain.shuffle(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3118 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1689,8 +1636,8 @@ _.shuffle([1, 2, 3, 4, 5, 6]); -### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3137 "View in source") [Ⓣ][1] +### `chain.size(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3151 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1719,8 +1666,8 @@ _.size('curly'); -### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3184 "View in source") [Ⓣ][1] +### `chain.some(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3198 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1765,8 +1712,8 @@ _.some(food, { 'type': 'meat' }); -### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3240 "View in source") [Ⓣ][1] +### `chain.sortBy(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3254 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1802,8 +1749,8 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); -### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3275 "View in source") [Ⓣ][1] +### `chain.toArray(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3289 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1826,8 +1773,8 @@ Converts the `collection` to an array. -### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3307 "View in source") [Ⓣ][1] +### `chain.where(collection, properties)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3321 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1863,8 +1810,8 @@ _.where(stooges, { 'age': 40 }); -### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4249 "View in source") [Ⓣ][1] +### `chain.after(n, func)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4263 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1891,8 +1838,8 @@ _.forEach(notes, function(note) { -### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4282 "View in source") [Ⓣ][1] +### `chain.bind(func [, thisArg, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4296 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1922,8 +1869,8 @@ func(); -### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4313 "View in source") [Ⓣ][1] +### `chain.bindAll(object [, methodName1, methodName2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4327 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1953,8 +1900,8 @@ jQuery('#docs').on('click', view.onClick); -### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4359 "View in source") [Ⓣ][1] +### `chain.bindKey(object, key [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4373 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -1994,8 +1941,8 @@ func(); -### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4382 "View in source") [Ⓣ][1] +### `chain.compose([func1, func2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4396 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2021,8 +1968,8 @@ welcome('moe'); -### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4441 "View in source") [Ⓣ][1] +### `chain.createCallback([func=identity, thisArg, argCount=3])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4455 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2075,8 +2022,8 @@ _.toLookup(stooges, 'name'); -### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4517 "View in source") [Ⓣ][1] +### `chain.debounce(func, wait, options)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4531 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2108,8 +2055,8 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { -### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4567 "View in source") [Ⓣ][1] +### `chain.defer(func [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4581 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2133,8 +2080,8 @@ _.defer(function() { alert('deferred'); }); -### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4593 "View in source") [Ⓣ][1] +### `chain.delay(func, wait [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4607 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2160,8 +2107,8 @@ _.delay(log, 1000, 'logged later'); -### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4617 "View in source") [Ⓣ][1] +### `chain.memoize(func [, resolver])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4631 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2186,8 +2133,8 @@ var fibonacci = _.memoize(function(n) { -### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4644 "View in source") [Ⓣ][1] +### `chain.once(func)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4661 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2212,8 +2159,8 @@ initialize(); -### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4679 "View in source") [Ⓣ][1] +### `chain.partial(func [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4696 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2239,8 +2186,8 @@ hi('moe'); -### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4710 "View in source") [Ⓣ][1] +### `chain.partialRight(func [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4727 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2276,8 +2223,8 @@ options.imports -### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4743 "View in source") [Ⓣ][1] +### `chain.throttle(func, wait, options)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4760 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2308,8 +2255,8 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { -### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4808 "View in source") [Ⓣ][1] +### `chain.wrap(value, wrapper)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4825 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2344,8 +2291,8 @@ hello(); -### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1120 "View in source") [Ⓣ][1] +### `chain.assign(object [, source1, source2, ..., callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1134 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2382,8 +2329,8 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); -### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1175 "View in source") [Ⓣ][1] +### `chain.clone(value [, deep=false, callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1189 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2429,8 +2376,8 @@ clone.childNodes.length; -### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1300 "View in source") [Ⓣ][1] +### `chain.cloneDeep(value [, callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1314 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2475,8 +2422,8 @@ clone.node == view.node; -### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1324 "View in source") [Ⓣ][1] +### `chain.defaults(object [, source1, source2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1338 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2501,8 +2448,8 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); -### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1346 "View in source") [Ⓣ][1] +### `chain.findKey(object [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1360 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2529,8 +2476,8 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { -### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1387 "View in source") [Ⓣ][1] +### `chain.forIn(object [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1401 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2565,8 +2512,8 @@ _.forIn(new Dog('Dagny'), function(value, key) { -### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1412 "View in source") [Ⓣ][1] +### `chain.forOwn(object [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1426 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2593,8 +2540,8 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { -### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1429 "View in source") [Ⓣ][1] +### `chain.functions(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1443 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2620,8 +2567,8 @@ _.functions(_); -### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1454 "View in source") [Ⓣ][1] +### `chain.has(object, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1468 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2645,8 +2592,8 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); -### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1471 "View in source") [Ⓣ][1] +### `chain.invert(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1485 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2669,8 +2616,8 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); -### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L983 "View in source") [Ⓣ][1] +### `chain.isArguments(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L997 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2696,8 +2643,8 @@ _.isArguments([1, 2, 3]); -### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1009 "View in source") [Ⓣ][1] +### `chain.isArray(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1023 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2723,8 +2670,8 @@ _.isArray([1, 2, 3]); -### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1497 "View in source") [Ⓣ][1] +### `chain.isBoolean(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1511 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2747,8 +2694,8 @@ _.isBoolean(null); -### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1514 "View in source") [Ⓣ][1] +### `chain.isDate(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1528 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2771,8 +2718,8 @@ _.isDate(new Date); -### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1531 "View in source") [Ⓣ][1] +### `chain.isElement(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1545 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2795,8 +2742,8 @@ _.isElement(document.body); -### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1] +### `chain.isEmpty(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1570 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2825,8 +2772,8 @@ _.isEmpty(''); -### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1615 "View in source") [Ⓣ][1] +### `chain.isEqual(a, b [, callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1629 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2870,8 +2817,8 @@ _.isEqual(words, otherWords, function(a, b) { -### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1796 "View in source") [Ⓣ][1] +### `chain.isFinite(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1810 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2908,8 +2855,8 @@ _.isFinite(Infinity); -### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1813 "View in source") [Ⓣ][1] +### `chain.isFunction(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1827 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2932,8 +2879,8 @@ _.isFunction(_); -### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1876 "View in source") [Ⓣ][1] +### `chain.isNaN(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1890 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2967,8 +2914,8 @@ _.isNaN(undefined); -### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1898 "View in source") [Ⓣ][1] +### `chain.isNull(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1912 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -2994,8 +2941,8 @@ _.isNull(undefined); -### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1915 "View in source") [Ⓣ][1] +### `chain.isNumber(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1929 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3018,8 +2965,8 @@ _.isNumber(8.4 * 5); -### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1843 "View in source") [Ⓣ][1] +### `chain.isObject(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1857 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3048,8 +2995,8 @@ _.isObject(1); -### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1943 "View in source") [Ⓣ][1] +### `chain.isPlainObject(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1957 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3083,8 +3030,8 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); -### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1968 "View in source") [Ⓣ][1] +### `chain.isRegExp(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1982 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3107,8 +3054,8 @@ _.isRegExp(/moe/); -### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1985 "View in source") [Ⓣ][1] +### `chain.isString(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1999 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3131,8 +3078,8 @@ _.isString('moe'); -### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2002 "View in source") [Ⓣ][1] +### `chain.isUndefined(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2016 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3155,8 +3102,8 @@ _.isUndefined(void 0); -### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1042 "View in source") [Ⓣ][1] +### `chain.keys(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1056 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3179,8 +3126,8 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); -### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2061 "View in source") [Ⓣ][1] +### `chain.merge(object [, source1, source2, ..., callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2075 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3235,8 +3182,8 @@ _.merge(food, otherFood, function(a, b) { -### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2170 "View in source") [Ⓣ][1] +### `chain.omit(object, callback|[prop1, prop2, ..., thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2184 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3266,8 +3213,8 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { -### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2204 "View in source") [Ⓣ][1] +### `chain.pairs(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2218 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3290,8 +3237,8 @@ _.pairs({ 'moe': 30, 'larry': 40 }); -### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2242 "View in source") [Ⓣ][1] +### `chain.pick(object, callback|[prop1, prop2, ..., thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2256 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3321,8 +3268,8 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { -### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2279 "View in source") [Ⓣ][1] +### `chain.values(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2293 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3352,8 +3299,8 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); -### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4832 "View in source") [Ⓣ][1] +### `chain.escape(string)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4849 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3376,8 +3323,8 @@ _.escape('Moe, Larry & Curly'); -### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4850 "View in source") [Ⓣ][1] +### `chain.identity(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4867 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3401,8 +3348,8 @@ moe === _.identity(moe); -### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4876 "View in source") [Ⓣ][1] +### `chain.mixin(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4893 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3431,8 +3378,8 @@ _('moe').capitalize(); -### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4905 "View in source") [Ⓣ][1] +### `chain.noConflict()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4922 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3451,8 +3398,8 @@ var lodash = _.noConflict(); -### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4929 "View in source") [Ⓣ][1] +### `chain.parseInt(value [, radix])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4946 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3478,8 +3425,8 @@ _.parseInt('08'); -### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4952 "View in source") [Ⓣ][1] +### `chain.random([min=0, max=1])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4969 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3506,8 +3453,8 @@ _.random(5); -### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4991 "View in source") [Ⓣ][1] +### `chain.result(object, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5013 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3541,26 +3488,8 @@ _.result(object, 'stuff'); -### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L150 "View in source") [Ⓣ][1] - -Create a new `lodash` function using the given `context` object. - -#### Arguments -1. `[context=window]` *(Object)*: The context object. - -#### Returns -*(Function)*: Returns the `lodash` function. - -* * * - - - - - - -### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5075 "View in source") [Ⓣ][1] +### `chain.template(text, data, options)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5097 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3641,8 +3570,8 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ -### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5200 "View in source") [Ⓣ][1] +### `chain.times(n, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5222 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3673,8 +3602,8 @@ _.times(3, function(n) { this.cast(n); }, mage); -### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5227 "View in source") [Ⓣ][1] +### `chain.unescape(string)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5249 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3697,8 +3626,8 @@ _.unescape('Moe, Larry & Curly'); -### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5247 "View in source") [Ⓣ][1] +### `chain.uniqueId([prefix])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5269 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3732,7 +3661,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L494 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L504 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3750,8 +3679,8 @@ A reference to the `lodash` function. -### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5484 "View in source") [Ⓣ][1] +### `chain.VERSION` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5507 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3760,10 +3689,22 @@ A reference to the `lodash` function. + + +### `enumErrorProps` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L356 "View in source") [Ⓣ][1] + +*(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* + +* * * + + + + ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L321 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L323 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3775,7 +3716,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L346 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L348 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3787,7 +3728,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L338 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L340 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3799,7 +3740,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L359 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L369 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3813,7 +3754,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L367 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L377 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3825,7 +3766,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L384 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L394 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3837,7 +3778,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L395 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L405 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3851,7 +3792,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L375 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L385 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3863,7 +3804,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L409 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L419 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3877,7 +3818,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L420 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L430 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3891,7 +3832,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L446 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L456 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3903,7 +3844,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L454 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L464 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3915,7 +3856,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L462 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L472 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3927,7 +3868,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L470 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L480 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3939,7 +3880,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L478 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L488 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -3951,7 +3892,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L486 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L496 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. From ee1933389ae5e931a03115a1c118537095c16cdf Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 14 May 2013 22:48:34 -0700 Subject: [PATCH 029/117] Add `_.chain` tests and ensure they pass. Former-commit-id: e365b65da8a740383c975c7b904ad2156d1cc8ab --- build.js | 9 ++++----- dist/lodash.compat.js | 5 ++++- dist/lodash.compat.min.js | 2 +- dist/lodash.js | 5 ++++- dist/lodash.min.js | 12 ++++++------ dist/lodash.underscore.js | 6 ++++-- dist/lodash.underscore.min.js | 14 +++++++------- lodash.js | 5 ++++- test/test.js | 17 +++++++++++++++++ 9 files changed, 51 insertions(+), 24 deletions(-) diff --git a/build.js b/build.js index cf3c2df4db..f9bd49b98d 100755 --- a/build.js +++ b/build.js @@ -367,14 +367,13 @@ ].join('\n' + indent)); }); - // replace `lodash.chain` assignment + // replace `chain` assignments source = source.replace(getMethodAssignments(source), function(match) { - return match.replace(/^( *lodash\.chain *= *).+/m, '$1chain;'); + return match + .replace(/^( *lodash\.chain *= *)[\s\S]+?(?=;\n)/m, '$1chain') + .replace(/^( *lodash\.prototype\.chain *= *)[\s\S]+?(?=;\n)/m, '$1wrapperChain'); }); - // add `lodash.prototype.chain` assignment - source = source.replace(/^( *)lodash\.prototype\.value *=.+\n/m, '$1lodash.prototype.chain = wrapperChain;\n$&'); - // remove `lodash.prototype.toString` and `lodash.prototype.valueOf` assignments source = source.replace(/^ *lodash\.prototype\.(?:toString|valueOf) *=.+\n/gm, ''); diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 55749dde8a..4f37c3fca0 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -5376,7 +5376,6 @@ lodash.zipObject = zipObject; // add aliases - lodash.chain = lodash; lodash.collect = map; lodash.drop = rest; lodash.each = forEach; @@ -5387,6 +5386,10 @@ lodash.tail = rest; lodash.unique = uniq; + // add chain compat + lodash.chain = lodash; + lodash.prototype.chain = function() { return this; }; + // add functions to `lodash.prototype` mixin(lodash); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index da6b3ba70a..b584fbfca5 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -36,7 +36,7 @@ if(!t&&xe(n)){e=-1;for(var o=n.length;++ee?pe(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=It,a.noConflict=function(){return r._=Vt,this},a.parseInt=qe,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var e=he();return n%1||t%1?n+ve(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},a.reduce=yt,a.reduceRight=dt,a.result=function(n,t){var r=n?n[t]:e;return rt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0; diff --git a/dist/lodash.js b/dist/lodash.js index dbd4ca397e..9b725b4090 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -5066,7 +5066,6 @@ lodash.zipObject = zipObject; // add aliases - lodash.chain = lodash; lodash.collect = map; lodash.drop = rest; lodash.each = forEach; @@ -5077,6 +5076,10 @@ lodash.tail = rest; lodash.unique = uniq; + // add chain compat + lodash.chain = lodash; + lodash.prototype.chain = function() { return this; }; + // add functions to `lodash.prototype` mixin(lodash); diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 1027eb523c..c583ef8c7a 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -21,7 +21,7 @@ if(typeof u!="number")var i=we(n),u=i.length;return t=G.createCallback(t,r,4),bt if(typeof t!="number"&&t!=u){var o=-1;for(t=G.createCallback(t,e);++oe?ge(0,u+e):e||0)-1;else if(e)return r=Nt(n,t),n[r]===t?r:-1; for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=G.createCallback(r,o));++iEt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function At(n){for(var t=-1,e=n?dt(_t(n,"length")):0,r=Dt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,we=ve?function(n){return ft(n)?ve(n):[]}:V,je={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=at(je);return Ut&&i&&typeof oe=="function"&&(Ft=Bt(oe,o)),zt=8==he(_+"08")?he:function(n,t){return he(lt(n)?n.replace(k,""):n,t||0) },G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=te.apply(Qt,me.call(arguments,1)),r=e.length,u=Dt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ee(e*(t-n+1))},G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e; -return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:we(n).length},G.some=jt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=we(i),i=st(i),f=0,c=u.interpolate||w,l="__p+='",c=Ht((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t +return u},G.toArray=function(n){return n&&typeof n.length=="number"?tt(n):st(n)},G.union=function(n){return ke(n)||(arguments[0]=n?me.call(n):Qt),St(te.apply(Qt,arguments))},G.uniq=St,G.unzip=At,G.values=st,G.where=yt,G.without=function(n){return Ct(n,me.call(arguments,1))},G.wrap=function(n,t){return function(){var e=[n];return ae.apply(e,arguments),t.apply(this,e)}},G.zip=function(n){return n?At(arguments):[]},G.zipObject=$t,G.collect=mt,G.drop=It,G.each=bt,G.extend=U,G.methods=ut,G.object=$t,G.select=yt,G.tail=It,G.unique=St,G.chain=G,G.prototype.chain=function(){return this +},Tt(G),G.clone=rt,G.cloneDeep=function(n,t,e){return rt(n,r,t,e)},G.contains=vt,G.escape=function(n){return n==u?"":Jt(n).replace(j,X)},G.every=gt,G.find=ht,G.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=G.createCallback(t,e);++re?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ee(e*(t-n+1)) +},G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e;return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:we(n).length},G.some=jt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=we(i),i=st(i),f=0,c=u.interpolate||w,l="__p+='",c=Ht((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t }),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Mt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Jt(n).replace(h,et)},G.uniqueId=function(n){var t=++c;return Jt(n==u?"":n)+t },G.all=gt,G.any=jt,G.detect=ht,G.foldl=kt,G.foldr=wt,G.include=vt,G.inject=kt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(G,t)})}),G.first=xt,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return tt(n,ge(0,a-r))}},G.take=xt,G.head=xt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Jt(this.__wrapped__)},G.prototype.value=qt,G.prototype.valueOf=qt,bt(["join","pop","shift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),bt(["push","reverse","sort","unshift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),bt(["concat","slice","splice"],function(n){var t=Qt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments)) diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 1b89fabd27..398b942d9d 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -4282,7 +4282,6 @@ lodash.zip = zip; // add aliases - lodash.chain = chain; lodash.collect = map; lodash.drop = rest; lodash.each = forEach; @@ -4293,6 +4292,10 @@ lodash.tail = rest; lodash.unique = uniq; + // add chain compat + lodash.chain = chain; + lodash.prototype.chain = wrapperChain; + /*--------------------------------------------------------------------------*/ // add functions that return unwrapped values when chaining @@ -4369,7 +4372,6 @@ mixin(lodash); // add "Chaining" functions to the wrapper - lodash.prototype.chain = wrapperChain; lodash.prototype.value = wrapperValueOf; // add `Array` mutator functions to the wrapper diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 4d1b51fe21..7d8278ae60 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -26,10 +26,10 @@ return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){va u[t]=[o,n[o]]}return u},t.partial=function(n){return e(n,Bt.call(arguments,1))},t.pick=function(n){for(var t=-1,r=ht.apply(ct,Bt.call(arguments,1)),e=r.length,u={};++tr?0:r);++tr?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Nt();return n%1||t%1?n+St(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+yt(r*(t-n+1))},t.reduce=B,t.reduceRight=F,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=k,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); -var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t) -}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=k,t.detect=x,t.foldl=B,t.foldr=F,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this -},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!kt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t -})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file +return e},t.collect=O,t.drop=$,t.each=E,t.extend=c,t.methods=s,t.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++rr?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Nt();return n%1||t%1?n+St(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+yt(r*(t-n+1))},t.reduce=B,t.reduceRight=F,t.result=function(n,t){var r=n?n[t]:null; +return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=k,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings);var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}"; +try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=k,t.detect=x,t.foldl=B,t.foldr=F,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.value=function(){return this.__wrapped__ +},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!kt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t +})(this); \ No newline at end of file diff --git a/lodash.js b/lodash.js index 4254f55351..cca0127718 100644 --- a/lodash.js +++ b/lodash.js @@ -5394,7 +5394,6 @@ lodash.zipObject = zipObject; // add aliases - lodash.chain = lodash; lodash.collect = map; lodash.drop = rest; lodash.each = forEach; @@ -5405,6 +5404,10 @@ lodash.tail = rest; lodash.unique = uniq; + // add chain compat + lodash.chain = lodash; + lodash.prototype.chain = function() { return this; }; + // add functions to `lodash.prototype` mixin(lodash); diff --git a/test/test.js b/test/test.js index f5be7bc450..33abe0c92c 100644 --- a/test/test.js +++ b/test/test.js @@ -338,6 +338,23 @@ }); }()); + + /*--------------------------------------------------------------------------*/ + + QUnit.module('lodash.chain'); + + (function() { + test('should return a wrapped value', function() { + var actual = _.chain({ 'a': 0 }); + ok(actual instanceof _); + }); + + test('should return the existing wrapper when chaining', function() { + var wrapper = _({ 'a': 0 }); + equal(wrapper.chain(), wrapper); + }); + }()); + /*--------------------------------------------------------------------------*/ QUnit.module('cloning'); From f7c960fc0d360887cf705853aed6267524840f63 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 14 May 2013 22:49:15 -0700 Subject: [PATCH 030/117] Ensure `Error` is escaped for advanced Closure Compiler minification. Former-commit-id: 7a9cfbe464afa9e52ec3ed23692965d07db51d32 --- build/pre-compile.js | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pre-compile.js b/build/pre-compile.js index 3c8118d081..aea4626d92 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -71,6 +71,7 @@ 'Array', 'Boolean', 'Date', + 'Error', 'Function', 'Math', 'Number', From 43fea34f612aacb26aa5f72392fb0b6757f012fe Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 15 May 2013 12:45:55 -0700 Subject: [PATCH 031/117] Ensure `_.chain` works as expected. Former-commit-id: ed176702dc08deeb35d94bb7b40623ab06142848 --- build.js | 51 +++++++++++++++++++++++++++++---------------------- lodash.js | 8 ++++---- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/build.js b/build.js index f9bd49b98d..5e238ec395 100755 --- a/build.js +++ b/build.js @@ -180,6 +180,7 @@ 'zipObject': [], // method used by the `backbone` and `underscore` builds + 'chain': ['value'], 'findWhere': ['find'] }; @@ -198,7 +199,7 @@ ]; /** List of all methods */ - var allMethods = _.without(_.keys(dependencyMap)); + var allMethods = _.keys(dependencyMap); /** List of Lo-Dash methods */ var lodashMethods = _.without(allMethods, 'findWhere'); @@ -279,9 +280,7 @@ ]; /** List of Underscore methods */ - var underscoreMethods = _.without - .apply(_, [allMethods].concat(lodashOnlyMethods)) - .concat('chain'); + var underscoreMethods = _.without.apply(_, [allMethods].concat(lodashOnlyMethods)); /** List of ways to export the `lodash` function */ var exportsAll = [ @@ -367,13 +366,6 @@ ].join('\n' + indent)); }); - // replace `chain` assignments - source = source.replace(getMethodAssignments(source), function(match) { - return match - .replace(/^( *lodash\.chain *= *)[\s\S]+?(?=;\n)/m, '$1chain') - .replace(/^( *lodash\.prototype\.chain *= *)[\s\S]+?(?=;\n)/m, '$1wrapperChain'); - }); - // remove `lodash.prototype.toString` and `lodash.prototype.valueOf` assignments source = source.replace(/^ *lodash\.prototype\.(?:toString|valueOf) *=.+\n/gm, ''); @@ -438,6 +430,11 @@ ].join('\n' + indent); }); + // replace `_.chain` assignment + source = source.replace(getMethodAssignments(source), function(match) { + return match.replace(/^( *lodash\.chain *= *)[\s\S]+?(?=;\n)/m, '$1chain') + }); + // move `mixin(lodash)` to after the method assignments source = source.replace(/(?:\s*\/\/.*)*\n( *)mixin\(lodash\).+/, ''); source = source.replace(getMethodAssignments(source), function(match) { @@ -450,6 +447,11 @@ ].join('\n' + indent); }); + // move the `lodash.prototype.chain` assignment to after `mixin(lodash)` + source = source + .replace(/^ *lodash\.prototype\.chain *=[\s\S]+?;\n/m, '') + .replace(/^( *)lodash\.prototype\.value *=/m, '$1lodash.prototype.chain = wrapperChain;\n$&'); + return source; } @@ -679,7 +681,11 @@ */ function getCategory(source, methodName) { var result = /@category +(\w+)/.exec(matchFunction(source, methodName)); - return result ? result[1] : ''; + if (result) { + return result[1]; + } + // check for the `_.chain` alias + return methodName == 'chain' ? 'Chaining' : ''; } /** @@ -880,7 +886,7 @@ return slice.call(arguments, 1).every(function(funcName) { return !( matchFunction(source, funcName) || - RegExp('^ *lodash\\.prototype\\.' + funcName + ' *=.+', 'm').test(source) + RegExp('^ *lodash\\.prototype\\.' + funcName + ' *=[\\s\\S]+?;\\n', 'm').test(source) ); }); } @@ -1007,18 +1013,19 @@ } else if (funcName != 'each' && (snippet = matchFunction(source, funcName))) { source = source.replace(snippet, ''); } - // grab the method assignments snippet - snippet = getMethodAssignments(source); // remove method assignment from `lodash.prototype` - source = source.replace(RegExp('^ *lodash\\.prototype\\.' + funcName + ' *=.+\\n', 'm'), ''); + source = source.replace(RegExp('^ *lodash\\.prototype\\.' + funcName + ' *=[\\s\\S]+?;\\n', 'm'), ''); // remove pseudo private methods - source = source.replace(RegExp('^(?: *//.*\\s*)* *lodash\\._' + funcName + ' *=.+\\n', 'm'), ''); + source = source.replace(RegExp('^(?: *//.*\\s*)* *lodash\\._' + funcName + ' *=[\\s\\S]+?;\\n', 'm'), ''); + + // grab the method assignments snippet + snippet = getMethodAssignments(source); // remove assignment and aliases var modified = getAliases(funcName).concat(funcName).reduce(function(result, otherName) { - return result.replace(RegExp('^(?: *//.*\\s*)* *lodash\\.' + otherName + ' *=.+\\n', 'm'), ''); + return result.replace(RegExp('^(?: *//.*\\s*)* *lodash\\.' + otherName + ' *=[\\s\\S]+?;\\n', 'm'), ''); }, snippet); // replace with the modified snippet @@ -1837,7 +1844,6 @@ } }); - dependencyMap.chain = ['value']; dependencyMap.findWhere = ['where']; dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); dependencyMap.value = _.without(dependencyMap.value, 'isArray'); @@ -2750,7 +2756,7 @@ }); } // add Underscore's chaining methods - if (_.contains(buildMethods, 'chain')) { + if (isUnderscore ? !_.contains(plusMethods, 'chain') : _.contains(plusMethods, 'chain')) { source = addChainMethods(source); } // replace `each` references with `forEach` and `forOwn` @@ -2901,7 +2907,7 @@ .replace(/__p *\+= *' *';/g, '') .replace(/\s*\+\s*'';/g, ';') .replace(/(__p *\+= *)' *' *\+/g, '$1') - .replace(/\(\(__t *= *\( *([^)]+?) *\)\) *== *null *\? *'' *: *__t\)/g, '($1)'); + .replace(/\(\(__t *= *\( *([\s\S]+?) *\)\) *== *null *\? *'' *: *__t\)/g, '($1)'); // remove the with-statement snippet = snippet.replace(/ *with *\(.+?\) *{/, '\n').replace(/}([^}]*}[^}]*$)/, '$1'); @@ -3040,6 +3046,7 @@ source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, ''); } if (isRemoved(source, 'value')) { + source = removeFunction(source, 'chain'); source = removeFunction(source, 'wrapperToString'); source = removeFunction(source, 'wrapperValueOf'); source = removeSupportSpliceObjects(source); @@ -3065,7 +3072,7 @@ source = source .replace(/(?:\s*\/\/.*)*\n( *)forOwn\(lodash, *function\(func, *methodName\)[\s\S]+?\n\1}.+/g, '') .replace(/(?:\s*\/\/.*)*\n( *)(?:each|forEach)\(\['[\s\S]+?\n\1}.+/g, '') - .replace(/(?:\s*\/\/.*)*\n *lodash\.prototype.+/g, ''); + .replace(/(?:\s*\/\/.*)*\n *lodash\.prototype.[\s\S]+?;/g, ''); } if (!/\beach\(/.test(source)) { source = source.replace(matchFunction(source, 'each'), ''); diff --git a/lodash.js b/lodash.js index cca0127718..7fc5d4ab72 100644 --- a/lodash.js +++ b/lodash.js @@ -5404,13 +5404,13 @@ lodash.tail = rest; lodash.unique = uniq; - // add chain compat - lodash.chain = lodash; - lodash.prototype.chain = function() { return this; }; - // add functions to `lodash.prototype` mixin(lodash); + // add Underscore `_.chain` compat + lodash.chain = lodash; + lodash.prototype.chain = function() { return this; }; + /*--------------------------------------------------------------------------*/ // add functions that return unwrapped values when chaining From d162eed4c79f6b59ec37121b2885372fc08b1d85 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 16 May 2013 08:48:28 -0700 Subject: [PATCH 032/117] Rebuild files. Former-commit-id: dd3db7be0213bfada5ab7d8593e233a9af4a9dd0 --- dist/lodash.compat.js | 12 ++++++------ dist/lodash.compat.min.js | 4 ++-- dist/lodash.js | 8 ++++---- dist/lodash.min.js | 4 ++-- dist/lodash.underscore.js | 4 ++-- dist/lodash.underscore.min.js | 14 +++++++------- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 4f37c3fca0..ace4533734 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -554,7 +554,7 @@ __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n'; if (conditions.length) { __p += ' if (' + - ((__t = ( conditions.join(' && ') )) == null ? '' : __t) + + (conditions.join(' && ')) + ') {\n '; } __p += @@ -568,7 +568,7 @@ __p += '\n for (index in iterable) {\n'; if (obj.useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); } if (conditions.length) { __p += ' if (' + - ((__t = ( conditions.join(' && ') )) == null ? '' : __t) + + (conditions.join(' && ')) + ') {\n '; } __p += @@ -5386,13 +5386,13 @@ lodash.tail = rest; lodash.unique = uniq; - // add chain compat - lodash.chain = lodash; - lodash.prototype.chain = function() { return this; }; - // add functions to `lodash.prototype` mixin(lodash); + // add Underscore `_.chain` compat + lodash.chain = lodash; + lodash.prototype.chain = function() { return this; }; + /*--------------------------------------------------------------------------*/ // add functions that return unwrapped values when chaining diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index b584fbfca5..1940b48e3a 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -6,7 +6,7 @@ */ ;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!xe(n)&&te.call(n,"__wrapped__")?n:new U(n)}function R(n){var t=n.length,e=t>=c;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)r+="n='"+t.g[k]+"';if((!(q&&w[n])&&m.call(s,n))",t.i||(r+="||(!w[n]&&s[n]!==z[n])"),r+="){"+t.f+";}"; +var u=[];if(we.enumPrototypes&&u.push('!(F&&n=="prototype")'),we.enumErrorProps&&u.push('!(E&&(n=="message"||n=="name"))'),t.i&&t.j)r+="var B=-1,C=A[typeof s]?u(s):[],t=C.length;while(++Bk;k++)r+="n='"+t.g[k]+"';if((!(q&&w[n])&&m.call(s,n))",t.i||(r+="||(!w[n]&&s[n]!==z[n])"),r+="){"+t.f+";}"; r+="}"}return(t.b||we.nonEnumArgs)&&(r+="}"),r+=t.c+";return D",n("i,j,k,m,o,p,r,u,v,z,A,x,H,I,K",e+r+"}")(be,A,Mt,te,Y,xe,ot,Oe,a,Gt,$,_e,P,Ut,oe)}function H(n){return"\\"+q[n]}function M(n){return Ae[n]}function G(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function U(n){this.__wrapped__=n}function V(){}function Q(n){var t=!1;if(!n||oe.call(n)!=B||!we.argsClass&&Y(n))return t;var e=n.constructor;return(rt(e)?e instanceof e:we.nodeClass||!G(n))?we.ownLast?(Ne(n,function(n,e,r){return t=te.call(r,e),!1 }),!0===t):(Ne(n,function(n,e){t=e}),!1===t||te.call(n,t)):t}function W(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Nt(0>e?0:e);++re?pe(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=It,a.noConflict=function(){return r._=Vt,this},a.parseInt=qe,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var e=he();return n%1||t%1?n+ve(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},a.reduce=yt,a.reduceRight=dt,a.result=function(n,t){var r=n?n[t]:e;return rt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0; diff --git a/dist/lodash.js b/dist/lodash.js index 9b725b4090..9622ebc001 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -5076,13 +5076,13 @@ lodash.tail = rest; lodash.unique = uniq; - // add chain compat - lodash.chain = lodash; - lodash.prototype.chain = function() { return this; }; - // add functions to `lodash.prototype` mixin(lodash); + // add Underscore `_.chain` compat + lodash.chain = lodash; + lodash.prototype.chain = function() { return this; }; + /*--------------------------------------------------------------------------*/ // add functions that return unwrapped values when chaining diff --git a/dist/lodash.min.js b/dist/lodash.min.js index c583ef8c7a..023c7a38b3 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -32,8 +32,8 @@ return ue.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},G.mer return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=we(n),r=e.length,u=Dt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ee(e*(t-n+1)) },G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e;return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:we(n).length},G.some=jt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=we(i),i=st(i),f=0,c=u.interpolate||w,l="__p+='",c=Ht((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 398b942d9d..92d7f107c0 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -4292,9 +4292,8 @@ lodash.tail = rest; lodash.unique = uniq; - // add chain compat + // add Underscore `_.chain` compat lodash.chain = chain; - lodash.prototype.chain = wrapperChain; /*--------------------------------------------------------------------------*/ @@ -4372,6 +4371,7 @@ mixin(lodash); // add "Chaining" functions to the wrapper + lodash.prototype.chain = wrapperChain; lodash.prototype.value = wrapperValueOf; // add `Array` mutator functions to the wrapper diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 7d8278ae60..e0f71675c4 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -26,10 +26,10 @@ return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){va u[t]=[o,n[o]]}return u},t.partial=function(n){return e(n,Bt.call(arguments,1))},t.pick=function(n){for(var t=-1,r=ht.apply(ct,Bt.call(arguments,1)),e=r.length,u={};++tr?0:r);++tr?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Nt();return n%1||t%1?n+St(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+yt(r*(t-n+1))},t.reduce=B,t.reduceRight=F,t.result=function(n,t){var r=n?n[t]:null; -return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=k,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings);var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}"; -try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=k,t.detect=x,t.foldl=B,t.foldr=F,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.value=function(){return this.__wrapped__ -},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!kt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t -})(this); \ No newline at end of file +return e},t.collect=O,t.drop=$,t.each=E,t.extend=c,t.methods=s,t.object=function(n,t){for(var r=-1,e=n?n.length:0,u={};++rr?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Nt();return n%1||t%1?n+St(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+yt(r*(t-n+1))},t.reduce=B,t.reduceRight=F,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=k,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); +var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t) +}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=k,t.detect=x,t.foldl=B,t.foldr=F,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this +},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!kt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t +})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file From a56ba245ea1afc01f11997edac354f365c248636 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 16 May 2013 09:12:56 -0700 Subject: [PATCH 033/117] Fix `_.support.enumErrorProps` docs. Former-commit-id: f7aa45537b1e4d173f966a78f89b183c444faaeb --- lodash.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lodash.js b/lodash.js index 7fc5d4ab72..cf96dc641e 100644 --- a/lodash.js +++ b/lodash.js @@ -351,6 +351,7 @@ * Detect if `name` or `message` properties of `Error.prototype` are * enumerable by default. (IE < 9, Safari < 5.1) * + * @memberOf _.support * @type Boolean */ support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); From e85ae351c7d075703796b33e44294990837628da Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 17 May 2013 08:41:55 -0700 Subject: [PATCH 034/117] Ensure `--output` paths containing build commands are processed w/o problems. Former-commit-id: 4790e4e2ea2eba6af8c93e3576858d1f6ff45e70 --- build.js | 24 ++++++++++++------------ test/test-build.js | 3 ++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/build.js b/build.js index 5e238ec395..09268fd917 100755 --- a/build.js +++ b/build.js @@ -1638,7 +1638,7 @@ // used to specify a custom IIFE to wrap Lo-Dash var iife = options.reduce(function(result, value) { - var match = value.match(/iife=(.*)/); + var match = value.match(/^iife=(.*)$/); return match ? match[1] : result; }, null); @@ -1693,7 +1693,7 @@ // used to specify the ways to export the `lodash` function var exportsOptions = options.reduce(function(result, value) { - return /exports/.test(value) ? optionToArray(value).sort() : result; + return /^exports=.*$/.test(value) ? optionToArray(value).sort() : result; }, isUnderscore ? ['commonjs', 'global', 'node'] : exportsAll.slice() @@ -1701,13 +1701,13 @@ // used to specify the AMD module ID of Lo-Dash used by precompiled templates var moduleId = options.reduce(function(result, value) { - var match = value.match(/moduleId=(.*)/); + var match = value.match(/^moduleId=(.*)$/); return match ? match[1] : result; }, 'lodash'); // used to specify the output path for builds var outputPath = options.reduce(function(result, value, index) { - if (/-o|--output/.test(value)) { + if (/^(?:-o|--output)$/.test(value)) { result = options[index + 1]; var dirname = path.dirname(result); fs.mkdirpSync(dirname); @@ -1718,7 +1718,7 @@ // used to match external template files to precompile var templatePattern = options.reduce(function(result, value) { - var match = value.match(/template=(.+)$/); + var match = value.match(/^template=(.+)$/); return match ? path.join(fs.realpathSync(path.dirname(match[1])), path.basename(match[1])) : result; @@ -1726,7 +1726,7 @@ // used as the template settings for precompiled templates var templateSettings = options.reduce(function(result, value) { - var match = value.match(/settings=(.+)$/); + var match = value.match(/^settings=(.+)$/); return match ? _.assign(result, Function('return {' + match[1].replace(/^{|}$/g, '') + '}')()) : result; @@ -1759,30 +1759,30 @@ // methods to include in the build var includeMethods = options.reduce(function(accumulator, value) { - return /include/.test(value) + return /^include=.*$/.test(value) ? _.union(accumulator, optionToMethodsArray(source, value)) : accumulator; }, []); // methods to remove from the build var minusMethods = options.reduce(function(accumulator, value) { - return /exclude|minus/.test(value) + return /^(?:exclude|minus)=.*$/.test(value) ? _.union(accumulator, optionToMethodsArray(source, value)) : accumulator; }, []); // methods to add to the build var plusMethods = options.reduce(function(accumulator, value) { - return /plus/.test(value) + return /^plus=.*$/.test(value) ? _.union(accumulator, optionToMethodsArray(source, value)) : accumulator; }, []); // methods categories to include in the build var categories = options.reduce(function(accumulator, value) { - if (/category|exclude|include|minus|plus/.test(value)) { + if (/^(category|exclude|include|minus|plus)=.+$/.test(value)) { var array = optionToArray(value); - accumulator = _.union(accumulator, /category/.test(value) + accumulator = _.union(accumulator, /^category=.*$/.test(value) ? array.map(capitalize) : array.filter(function(category) { return /^[A-Z]/.test(category); }) ); @@ -3131,7 +3131,7 @@ // flag to specify creating a custom build var isCustom = ( isLegacy || isMapped || isModern || isNoDep || isStrict || isUnderscore || outputPath || - /(?:category|exclude|exports|iife|include|minus|plus)=/.test(options) || + /(?:category|exclude|exports|iife|include|minus|plus)=.*$/.test(options) || !_.isEqual(exportsOptions, exportsAll) ); diff --git a/test/test-build.js b/test/test-build.js index 4764ac5ed7..36abc04964 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -1334,7 +1334,8 @@ '--output b.js', '-o ' + path.join('a', 'b', 'c.js'), '-o ' + relativePrefix + path.join('a', 'b', 'c.js'), - '-o ' + path.join(nestedPath, 'c.js') + '-o ' + path.join(nestedPath, 'c.js'), + '-o name_with_keywords_like_category_include_exclude_plus_minus.js' ]; commands.forEach(function(command) { From 3721db34abfe271e8894c374c3715e8c2352ea2f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 17 May 2013 16:44:39 -0700 Subject: [PATCH 035/117] Avoid writing a minified file when `--stdout` is used. [closes #273] Former-commit-id: 75068b4a92f3a98d4c47ad049e88ef764154bcc1 --- build.js | 5 ++--- test/test-build.js | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/build.js b/build.js index 09268fd917..0631e3ef53 100755 --- a/build.js +++ b/build.js @@ -3183,11 +3183,10 @@ data.source = addCommandsToHeader(data.source, options); } if (isStdOut) { + delete data.outputPath; stdout.write(data.source); - callback(data); - } else { - callback(data); } + callback(data); } }); } diff --git a/test/test-build.js b/test/test-build.js index 36abc04964..f572d3158f 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -1387,6 +1387,8 @@ build(['exports=', 'include='].concat(command.split(' ')), function(data) { process.stdout.write = write; + + strictEqual('outputPath' in data, false); equal(written, data.source); equal(arguments.length, 1); start(); From 9270cc47b585174a6caf7a2d714602b26e18b5f3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 18 May 2013 19:12:22 -0700 Subject: [PATCH 036/117] Add `_.transform`. Former-commit-id: 6c040fedd130e8436ff99b1d70892ac8cebbb996 --- build.js | 65 ++++++++++++++++++++++++--------- build/pre-compile.js | 1 + lodash.js | 86 ++++++++++++++++++++++++++++++++++++++++---- test/test-build.js | 2 ++ 4 files changed, 130 insertions(+), 24 deletions(-) diff --git a/build.js b/build.js index 0631e3ef53..7f13eda4c6 100755 --- a/build.js +++ b/build.js @@ -88,7 +88,7 @@ 'contains': ['indexOf', 'isString'], 'countBy': ['createCallback', 'forEach'], 'createCallback': ['identity', 'isEqual', 'keys'], - 'debounce': [], + 'debounce': ['isObject'], 'defaults': ['isArray', 'keys'], 'defer': ['bind'], 'delay': [], @@ -163,9 +163,10 @@ 'sortedIndex': ['createCallback', 'identity'], 'tap': ['value'], 'template': ['defaults', 'escape', 'keys', 'values'], - 'throttle': [], + 'throttle': ['isObject'], 'times': ['createCallback'], 'toArray': ['isString', 'values'], + 'transform': ['createCallback', 'forOwn', 'isArray', 'isObject'], 'unescape': [], 'union': ['isArray', 'uniq'], 'uniq': ['createCallback', 'indexOf'], @@ -276,6 +277,7 @@ 'parseInt', 'partialRight', 'runInContext', + 'transform', 'unzip' ]; @@ -800,7 +802,7 @@ * @returns {String} Returns the `isArguments` fallback. */ function getIsArgumentsFallback(source) { - return (source.match(/(?:\s*\/\/.*)*\n( *)if *\((?:!support\.argsClass|!isArguments)[\s\S]+?};\n\1}/) || [''])[0]; + return (source.match(/(?:\s*\/\/.*)*\n( *)if *\((?:!support\.argsClass|!isArguments)[\s\S]+?\n *};\n\1}/) || [''])[0]; } /** @@ -824,7 +826,18 @@ * @returns {String} Returns the `isFunction` fallback. */ function getIsFunctionFallback(source) { - return (source.match(/(?:\s*\/\/.*)*\n( *)if *\(isFunction\(\/x\/[\s\S]+?};\n\1}/) || [''])[0]; + return (source.match(/(?:\s*\/\/.*)*\n( *)if *\(isFunction\(\/x\/[\s\S]+?\n *};\n\1}/) || [''])[0]; + } + + /** + * Gets the `createObject` fallback from `source`. + * + * @private + * @param {String} source The source to inspect. + * @returns {String} Returns the `isArguments` fallback. + */ + function getCreateObjectFallback(source) { + return (source.match(/(?:\s*\/\/.*)*\n( *)if *\((?:!nativeCreate)[\s\S]+?\n *};\n\1}/) || [''])[0]; } /** @@ -1069,6 +1082,17 @@ return source.replace(getIsFunctionFallback(source), ''); } + /** + * Removes the `createObject` fallback from `source`. + * + * @private + * @param {String} source The source to process. + * @returns {String} Returns the modified source. + */ + function removeCreateObjectFallback(source) { + return source.replace(getCreateObjectFallback(source), ''); + } + /** * Removes the `Object.keys` object iteration optimization from `source`. * @@ -1939,11 +1963,11 @@ source = removeSupportProp(source, 'fastBind'); source = replaceSupportProp(source, 'argsClass', 'false'); - _.each(['getPrototypeOf', 'nativeBind', 'nativeIsArray', 'nativeKeys'], function(varName) { + _.each(['getPrototypeOf'], function(varName) { source = replaceVar(source, varName, 'false'); }); - _.each(['isIeOpera', 'isV8', 'nativeBind', 'nativeIsArray', 'nativeKeys', 'reNative'], function(varName) { + _.each(['isIeOpera', 'isV8', 'nativeBind', 'nativeCreate', 'nativeIsArray', 'nativeKeys', 'reNative'], function(varName) { source = removeVar(source, varName); }); @@ -1957,6 +1981,23 @@ return match.replace(/\bnativeIsArray\s*\|\|\s*/, ''); }); + // replace `createObject` and `isArguments` with their fallbacks + _.each({ + 'createObject': { 'get': getCreateObjectFallback, 'remove': removeCreateObjectFallback }, + 'isArguments': { 'get': getIsArgumentsFallback, 'remove': removeIsArgumentsFallback } + }, + function(util, methodName) { + source = source.replace(matchFunction(source, methodName).replace(RegExp('[\\s\\S]+?function ' + methodName), ''), function() { + var snippet = util.get(source), + body = snippet.match(RegExp(methodName + ' *= *function([\\s\\S]+?\\n *});'))[1], + indent = getIndent(snippet); + + return body.replace(RegExp('^' + indent, 'gm'), indent.slice(0, -2)) + '\n'; + }); + + source = util.remove(source); + }); + // replace `_.keys` with `shimKeys` source = source.replace( matchFunction(source, 'keys').replace(/[\s\S]+?var keys *= */, ''), @@ -1964,17 +2005,6 @@ ); source = removeFunction(source, 'shimKeys'); - - // replace `_.isArguments` with fallback - source = source.replace(matchFunction(source, 'isArguments').replace(/[\s\S]+?function isArguments/, ''), function() { - var fallback = getIsArgumentsFallback(source), - body = fallback.match(/isArguments *= *function([\s\S]+? *});/)[1], - indent = getIndent(fallback); - - return body.replace(RegExp('^' + indent, 'gm'), indent.slice(0, -2)) + '\n'; - }); - - source = removeIsArgumentsFallback(source); } if (isModern) { source = removeSupportSpliceObjects(source); @@ -1987,6 +2017,7 @@ else { source = removeIsArrayFallback(source); source = removeIsFunctionFallback(source); + source = removeCreateObjectFallback(source); // remove `shimIsPlainObject` from `_.isPlainObject` source = source.replace(matchFunction(source, 'isPlainObject'), function(match) { diff --git a/build/pre-compile.js b/build/pre-compile.js index aea4626d92..d4e984819b 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -222,6 +222,7 @@ 'times', 'toArray', 'trailing', + 'transform', 'unescape', 'unindexedChars', 'union', diff --git a/lodash.js b/lodash.js index cf96dc641e..f2182367be 100644 --- a/lodash.js +++ b/lodash.js @@ -198,6 +198,7 @@ /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, + nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsFinite = context.isFinite, nativeIsNaN = context.isNaN, @@ -264,8 +265,8 @@ * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, - * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`, - * `values`, `where`, `without`, `wrap`, and `zip` + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, @@ -771,9 +772,7 @@ } if (this instanceof bound) { // ensure `new bound` is an instance of `func` - noop.prototype = func.prototype; - thisBinding = new noop; - noop.prototype = null; + thisBinding = createObject(func.prototype); // mimic the constructor's `return` behavior // http://es5.github.com/#x13.2.2 @@ -839,6 +838,28 @@ ); } + /** + * Creates a new object with the specified `prototype`. + * + * @private + * @param {Object} prototype The prototype object. + * @returns {Object} Returns the new object. + */ + function createObject(prototype) { + return isObject(prototype) ? nativeCreate(prototype) : {}; + } + // fallback for browsers without `Object.create` + if (!nativeCreate) { + var createObject = function(prototype) { + if (isObject(prototype)) { + noop.prototype = prototype; + var result = new noop; + noop.prototype = null; + } + return result || {}; + }; + } + /** * Used by `template` to escape characters for inclusion in compiled * string literals. @@ -2278,6 +2299,56 @@ return result; } + /** + * Transforms an `object` to an new `accumulator` object which is the result + * of running each of its elements through the `callback`, with each `callback` + * execution potentially mutating the `accumulator` object. The `callback`is + * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). + * Callbacks may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Objects + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {Mixed} [accumulator] The custom accumulator value. + * @param {Mixed} [thisArg] The `this` binding of `callback`. + * @returns {Mixed} Returns the accumulated value. + * @example + * + * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { + * num *= num; + * if (num % 2) { + * return result.push(num) < 3; + * } + * }); + * // => [1, 9, 25] + * + * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { + * result[key] = num * 3; + * }); + * // => { 'a': 3, 'b': 6, 'c': 9 } + */ + function transform(object, callback, accumulator, thisArg) { + var isArr = isArray(object); + callback = lodash.createCallback(callback, thisArg, 4); + + if (arguments.length < 3) { + if (isArr) { + accumulator = []; + } else { + var ctor = object && object.constructor, + proto = ctor && ctor.prototype; + + accumulator = createObject(proto); + } + } + (isArr ? each : forOwn)(object, function(value, index, object) { + return callback(accumulator, value, index, object); + }); + return accumulator; + } + /** * Creates an array composed of the own enumerable property values of `object`. * @@ -4547,7 +4618,7 @@ if (options === true) { var leading = true; trailing = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = options.leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -4776,7 +4847,7 @@ } if (options === false) { leading = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -5384,6 +5455,7 @@ lodash.throttle = throttle; lodash.times = times; lodash.toArray = toArray; + lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; diff --git a/test/test-build.js b/test/test-build.js index f572d3158f..e97e501257 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -225,6 +225,7 @@ 'omit', 'pairs', 'pick', + 'transform', 'values' ]; @@ -316,6 +317,7 @@ 'parseInt', 'partialRight', 'runInContext', + 'transform', 'unzip' ]; From 24fd17f0722727fb9c53320f45f17a6a16b9ea0f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 18 May 2013 19:32:16 -0700 Subject: [PATCH 037/117] Replace `_.isPlainObject` with `shimIsPlainObject`. Former-commit-id: c1c273a352387e25ae5a6a22dfda8871beac8400 --- build.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/build.js b/build.js index 7f13eda4c6..4c061c4324 100755 --- a/build.js +++ b/build.js @@ -1963,11 +1963,7 @@ source = removeSupportProp(source, 'fastBind'); source = replaceSupportProp(source, 'argsClass', 'false'); - _.each(['getPrototypeOf'], function(varName) { - source = replaceVar(source, varName, 'false'); - }); - - _.each(['isIeOpera', 'isV8', 'nativeBind', 'nativeCreate', 'nativeIsArray', 'nativeKeys', 'reNative'], function(varName) { + _.each(['isIeOpera', 'isV8', 'getPrototypeOf', 'nativeBind', 'nativeCreate', 'nativeIsArray', 'nativeKeys', 'reNative'], function(varName) { source = removeVar(source, varName); }); @@ -1998,6 +1994,14 @@ source = util.remove(source); }); + // replace `_.isPlainObject` with `shimIsPlainObject` + source = source.replace( + matchFunction(source, 'isPlainObject').replace(/[\s\S]+?var isPlainObject *= */, ''), + matchFunction(source, 'shimIsPlainObject').replace(/[\s\S]+?function shimIsPlainObject/, 'function') + ); + + source = removeFunction(source, 'shimIsPlainObject'); + // replace `_.keys` with `shimKeys` source = source.replace( matchFunction(source, 'keys').replace(/[\s\S]+?var keys *= */, ''), From 39e123aaf4dbba862c2398baabf2919fa54eff0d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 18 May 2013 19:33:17 -0700 Subject: [PATCH 038/117] Rebuild files. Former-commit-id: ab61934d0b097036dc4cab968d92bfd1450fe8c7 --- dist/lodash.compat.js | 87 ++++++++++++++++++++++++++++++++--- dist/lodash.compat.min.js | 82 ++++++++++++++++----------------- dist/lodash.js | 75 +++++++++++++++++++++++++++--- dist/lodash.min.js | 74 ++++++++++++++--------------- dist/lodash.underscore.js | 31 +++++++++++-- dist/lodash.underscore.min.js | 58 +++++++++++------------ 6 files changed, 281 insertions(+), 126 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index ace4533734..0b0c31e283 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -199,6 +199,7 @@ /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, + nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsFinite = context.isFinite, nativeIsNaN = context.isNaN, @@ -265,8 +266,8 @@ * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, - * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`, - * `values`, `where`, `without`, `wrap`, and `zip` + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, @@ -352,6 +353,7 @@ * Detect if `name` or `message` properties of `Error.prototype` are * enumerable by default. (IE < 9, Safari < 5.1) * + * @memberOf _.support * @type Boolean */ support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); @@ -754,9 +756,7 @@ } if (this instanceof bound) { // ensure `new bound` is an instance of `func` - noop.prototype = func.prototype; - thisBinding = new noop; - noop.prototype = null; + thisBinding = createObject(func.prototype); // mimic the constructor's `return` behavior // http://es5.github.com/#x13.2.2 @@ -820,6 +820,28 @@ ); } + /** + * Creates a new object with the specified `prototype`. + * + * @private + * @param {Object} prototype The prototype object. + * @returns {Object} Returns the new object. + */ + function createObject(prototype) { + return isObject(prototype) ? nativeCreate(prototype) : {}; + } + // fallback for browsers without `Object.create` + if (!nativeCreate) { + var createObject = function(prototype) { + if (isObject(prototype)) { + noop.prototype = prototype; + var result = new noop; + noop.prototype = null; + } + return result || {}; + }; + } + /** * Used by `template` to escape characters for inclusion in compiled * string literals. @@ -2259,6 +2281,56 @@ return result; } + /** + * Transforms an `object` to an new `accumulator` object which is the result + * of running each of its elements through the `callback`, with each `callback` + * execution potentially mutating the `accumulator` object. The `callback`is + * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). + * Callbacks may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Objects + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {Mixed} [accumulator] The custom accumulator value. + * @param {Mixed} [thisArg] The `this` binding of `callback`. + * @returns {Mixed} Returns the accumulated value. + * @example + * + * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { + * num *= num; + * if (num % 2) { + * return result.push(num) < 3; + * } + * }); + * // => [1, 9, 25] + * + * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { + * result[key] = num * 3; + * }); + * // => { 'a': 3, 'b': 6, 'c': 9 } + */ + function transform(object, callback, accumulator, thisArg) { + var isArr = isArray(object); + callback = lodash.createCallback(callback, thisArg, 4); + + if (arguments.length < 3) { + if (isArr) { + accumulator = []; + } else { + var ctor = object && object.constructor, + proto = ctor && ctor.prototype; + + accumulator = createObject(proto); + } + } + (isArr ? each : forOwn)(object, function(value, index, object) { + return callback(accumulator, value, index, object); + }); + return accumulator; + } + /** * Creates an array composed of the own enumerable property values of `object`. * @@ -4528,7 +4600,7 @@ if (options === true) { var leading = true; trailing = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = options.leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -4757,7 +4829,7 @@ } if (options === false) { leading = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -5365,6 +5437,7 @@ lodash.throttle = throttle; lodash.times = times; lodash.toArray = toArray; + lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 1940b48e3a..0080d3f035 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,45 +4,45 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!xe(n)&&te.call(n,"__wrapped__")?n:new U(n)}function R(n){var t=n.length,e=t>=c;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)r+="n='"+t.g[k]+"';if((!(q&&w[n])&&m.call(s,n))",t.i||(r+="||(!w[n]&&s[n]!==z[n])"),r+="){"+t.f+";}"; -r+="}"}return(t.b||we.nonEnumArgs)&&(r+="}"),r+=t.c+";return D",n("i,j,k,m,o,p,r,u,v,z,A,x,H,I,K",e+r+"}")(be,A,Mt,te,Y,xe,ot,Oe,a,Gt,$,_e,P,Ut,oe)}function H(n){return"\\"+q[n]}function M(n){return Ae[n]}function G(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function U(n){this.__wrapped__=n}function V(){}function Q(n){var t=!1;if(!n||oe.call(n)!=B||!we.argsClass&&Y(n))return t;var e=n.constructor;return(rt(e)?e instanceof e:we.nodeClass||!G(n))?we.ownLast?(Ne(n,function(n,e,r){return t=te.call(r,e),!1 -}),!0===t):(Ne(n,function(n,e){t=e}),!1===t||te.call(n,t)):t}function W(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Nt(0>e?0:e);++re?pe(0,u+e):e)||0,typeof u=="number"?a=-1<(ot(n)?n.indexOf(t,e):Ct(n,t,e)):Se(n,function(n){return++ru&&(u=i)}}else t=!t&&ot(n)?T:a.createCallback(t,e),Se(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n) -});return u}function yt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),xe(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++oarguments.length;if(typeof o!="number")var l=Oe(n),o=l.length;else we.unindexedChars&&ot(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),vt(n,function(n,r,a){r=l?l[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function mt(n,t,e){var r; -if(t=a.createCallback(t,e),xe(n)){e=-1;for(var u=n.length;++ee?pe(0,u+e):e||0)-1;else if(e)return r=kt(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=c;if(p)var v={};for(null!=r&&(s=[],r=a.createCallback(r,u));++oCt(s,g))&&((r||p)&&s.push(g),f.push(u))}return f}function Et(n){for(var t=-1,e=n?ht($e(n,"length")):0,r=Nt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var Ce={a:"y,G,l",h:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},De=tt(Ae),Ie=J(Ce,{h:Ce.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=v.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"D[n]=d?d(D[n],s[n]):s[n]"}),Be=J(Ce),Ne=J(je,ke,{i:!1}),Pe=J(je,ke); -rt(/x/)&&(rt=function(n){return typeof n=="function"&&oe.call(n)==D});var Fe=ne?function(n){if(!n||oe.call(n)!=B||!we.argsClass&&Y(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=ne(t))&&ne(e);return e?n==e||ne(n)==e:Q(n)}:Q,$e=gt;me&&u&&typeof ue=="function"&&(At=St(ue,r));var qe=8==ge(d+"08")?ge:function(n,t){return ge(ot(n)?n.replace(m,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ie,a.at=function(n){var t=-1,e=Yt.apply(Ht,ye.call(arguments,1)),r=e.length,u=Nt(r); -for(we.unindexedChars&&ot(n)&&(n=n.split(""));++t++l&&(a=n.apply(o,u)),i=ae(r,t),a}},a.defaults=Be,a.defer=At,a.delay=function(n,t){var r=ye.call(arguments,2);return ae(function(){n.apply(e,r)},t)},a.difference=bt,a.filter=st,a.flatten=wt,a.forEach=vt,a.forIn=Ne,a.forOwn=Pe,a.functions=nt,a.groupBy=function(n,t,e){var r={}; -return t=a.createCallback(t,e),vt(n,function(n,e,u){e=Lt(t(n,e,u)),(te.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return W(n,0,ve(pe(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=c,i=[],f=i;n:for(;++uCt(f,s)){o&&f.push(s); -for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(s))continue n;i.push(s)}}return i},a.invert=tt,a.invoke=function(n,t){var e=ye.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Nt(typeof a=="number"?a:0);return vt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=Oe,a.map=gt,a.max=ht,a.memoize=function(n,t){function e(){var r=e.cache,u=l+(t?t.apply(this,arguments):arguments[0]);return te.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},a.merge=it,a.min=function(n,t,e){var r=1/0,u=r; -if(!t&&xe(n)){e=-1;for(var o=n.length;++eCt(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=Oe(n),r=e.length,u=Nt(r);++te?pe(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=It,a.noConflict=function(){return r._=Vt,this},a.parseInt=qe,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var e=he();return n%1||t%1?n+ve(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},a.reduce=yt,a.reduceRight=dt,a.result=function(n,t){var r=n?n[t]:e;return rt(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:Oe(n).length},a.some=mt,a.sortedIndex=kt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=Be({},r,u);var o,i=Be({},r.imports,u.imports),u=Oe(i),i=lt(i),l=0,c=r.interpolate||b,v="__p+='",c=Kt((r.escape||b).source+"|"+c.source+"|"+(c===y?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(c,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(l,i).replace(w,H),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),l=i+t.length,t -}),v+="';\n",c=r=r.variable,c||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(s,"$1").replace(p,"$1;"),v="function("+r+"){"+(c?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=qt(u,"return "+v).apply(e,i)}catch(d){throw d.source=v,d}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Lt(n).replace(v,X)},a.uniqueId=function(n){var t=++o;return Lt(null==n?"":n)+t -},a.all=ft,a.any=mt,a.detect=pt,a.foldl=yt,a.foldr=dt,a.include=ct,a.inject=yt,Pe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ee.apply(t,arguments),n.apply(a,t)})}),a.first=_t,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return W(n,pe(0,u-r))}},a.take=_t,a.head=_t,Pe(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return null==t||e&&typeof t!="function"?r:new U(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Lt(this.__wrapped__)},a.prototype.value=Bt,a.prototype.valueOf=Bt,Se(["join","pop","shift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Se(["push","reverse","sort","unshift"],function(n){var t=Ht[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Se(["concat","slice","splice"],function(n){var t=Ht[n];a.prototype[n]=function(){return new U(t.apply(this.__wrapped__,arguments)) -}}),we.spliceObjects||Se(["pop","shift","splice"],function(n){var t=Ht[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new U(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},l=+new Date+"",c=200,f=/\b__p\+='';/g,s=/\b(__p\+=)''\+/g,p=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",m=RegExp("^["+d+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",D="[object Function]",I="[object Number]",B="[object Object]",N="[object RegExp]",P="[object String]",F={}; +;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!Oe(n)&&ee.call(n,"__wrapped__")?n:new V(n)}function R(n){var t=n.length,e=t>=l;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)r+="n='"+t.g[k]+"';if((!(q&&w[n])&&m.call(s,n))",t.i||(r+="||(!w[n]&&s[n]!==z[n])"),r+="){"+t.f+";}"; +r+="}"}return(t.b||je.nonEnumArgs)&&(r+="}"),r+=t.c+";return D",n("i,j,k,m,o,p,r,u,v,z,A,x,H,I,K",e+r+"}")(we,A,Gt,ee,Z,Oe,it,Ae,a,Ut,$,Ce,P,Vt,ie)}function H(n){return at(n)?le(n):{}}function M(n){return"\\"+q[n]}function G(n){return Ie[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function Q(){}function W(n){var t=!1;if(!n||ie.call(n)!=B||!je.argsClass&&Z(n))return t;var e=n.constructor;return(ut(e)?e instanceof e:je.nodeClass||!U(n))?je.ownLast?(Fe(n,function(n,e,r){return t=ee.call(r,e),!1 +}),!0===t):(Fe(n,function(n,e){t=e}),!1===t||ee.call(n,t)):t}function X(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Pt(0>e?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?a=-1<(it(n)?n.indexOf(t,e):jt(n,t,e)):De(n,function(n){return++ru&&(u=i)}}else t=!t&&it(n)?T:a.createCallback(t,e),De(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n) +});return u}function mt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),Oe(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++oarguments.length;if(typeof o!="number")var c=Ae(n),o=c.length;else je.unindexedChars&&it(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),gt(n,function(n,r,a){r=c?c[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function bt(n,t,e){var r; +if(t=a.createCallback(t,e),Oe(n)){e=-1;for(var u=n.length;++ee?ge(0,u+e):e||0)-1;else if(e)return r=xt(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=l;if(p)var v={};for(null!=r&&(s=[],r=a.createCallback(r,u));++ojt(s,g))&&((r||p)&&s.push(g),f.push(u))}return f}function Ot(n){for(var t=-1,e=n?yt(ze(n,"length")):0,r=Pt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var ke={a:"y,G,l",h:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Be=et(Ie),Ne=J(ke,{h:ke.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=v.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"D[n]=d?d(D[n],s[n]):s[n]"}),Pe=J(ke),Fe=J(xe,Ee,{i:!1}),$e=J(xe,Ee); +ut(/x/)&&(ut=function(n){return typeof n=="function"&&ie.call(n)==D});var qe=te?function(n){if(!n||ie.call(n)!=B||!je.argsClass&&Z(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=te(t))&&te(e);return e?n==e||te(n)==e:W(n)}:W,ze=ht;_e&&u&&typeof ae=="function"&&(Dt=At(ae,r));var Re=8==ye(m+"08")?ye:function(n,t){return ye(it(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ne,a.at=function(n){var t=-1,e=Zt.apply(Mt,de.call(arguments,1)),r=e.length,u=Pt(r); +for(je.unindexedChars&&it(n)&&(n=n.split(""));++t++c&&(a=n.apply(o,u)),i=oe(r,t),a}},a.defaults=Pe,a.defer=Dt,a.delay=function(n,t){var r=de.call(arguments,2);return oe(function(){n.apply(e,r)},t)},a.difference=_t,a.filter=pt,a.flatten=Ct,a.forEach=gt,a.forIn=Fe,a.forOwn=$e,a.functions=tt,a.groupBy=function(n,t,e){var r={}; +return t=a.createCallback(t,e),gt(n,function(n,e,u){e=Jt(t(n,e,u)),(ee.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return X(n,0,he(ge(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],f=i;n:for(;++ujt(f,s)){o&&f.push(s); +for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(s))continue n;i.push(s)}}return i},a.invert=et,a.invoke=function(n,t){var e=de.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Pt(typeof a=="number"?a:0);return gt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=Ae,a.map=ht,a.max=yt,a.memoize=function(n,t){function e(){var r=e.cache,u=c+(t?t.apply(this,arguments):arguments[0]);return ee.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},a.merge=ct,a.min=function(n,t,e){var r=1/0,u=r; +if(!t&&Oe(n)){e=-1;for(var o=n.length;++ejt(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=Ae(n),r=e.length,u=Pt(r);++targuments.length)if(u)e=[];else{var o=n&&n.constructor;e=H(o&&o.prototype)}return(u?De:$e)(n,function(n,r,u){return t(e,n,r,u)}),e},a.union=function(n){return Oe(n)||(arguments[0]=n?de.call(n):Mt),Et(Zt.apply(Mt,arguments))},a.uniq=Et,a.unzip=Ot,a.values=lt,a.where=pt,a.without=function(n){return _t(n,de.call(arguments,1))},a.wrap=function(n,t){return function(){var e=[n];return re.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){return n?Ot(arguments):[]},a.zipObject=St,a.collect=ht,a.drop=kt,a.each=gt,a.extend=Ne,a.methods=tt,a.object=St,a.select=pt,a.tail=kt,a.unique=Et,Bt(a),a.chain=a,a.prototype.chain=function(){return this +},a.clone=nt,a.cloneDeep=function(n,t,e){return nt(n,!0,t,e)},a.contains=ft,a.escape=function(n){return null==n?"":Jt(n).replace(_,G)},a.every=st,a.find=vt,a.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=a.createCallback(t,e);++re?ge(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=Bt,a.noConflict=function(){return r._=Qt,this},a.parseInt=Re,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ne(e*(t-n+1))},a.reduce=mt,a.reduceRight=dt,a.result=function(n,t){var r=n?n[t]:e; +return ut(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ae(n).length},a.some=bt,a.sortedIndex=xt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=Pe({},r,u);var o,i=Pe({},r.imports,u.imports),u=Ae(i),i=lt(i),c=0,l=r.interpolate||b,v="__p+='",l=Lt((r.escape||b).source+"|"+l.source+"|"+(l===y?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(l,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(c,i).replace(w,M),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),c=i+t.length,t +}),v+="';\n",l=r=r.variable,l||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(s,"$1").replace(p,"$1;"),v="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=zt(u,"return "+v).apply(e,i)}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(v,Y)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t +},a.all=st,a.any=bt,a.detect=vt,a.foldl=mt,a.foldr=dt,a.include=ft,a.inject=mt,$e(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return re.apply(t,arguments),n.apply(a,t)})}),a.first=wt,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return X(n,ge(0,u-r))}},a.take=wt,a.head=wt,$e(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); +return null==t||e&&typeof t!="function"?r:new V(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Nt,a.prototype.valueOf=Nt,De(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),De(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),De(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments)) +}}),je.spliceObjects||De(["pop","shift","splice"],function(n){var t=Mt[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new V(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=200,f=/\b__p\+='';/g,s=/\b(__p\+=)''\+/g,p=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",D="[object Function]",I="[object Number]",B="[object Object]",N="[object RegExp]",P="[object String]",F={}; F[D]=!1,F[x]=F[E]=F[O]=F[S]=F[I]=F[B]=F[N]=F[P]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):r&&!r.nodeType?u?(u.exports=z)._=z:r._=z:n._=z})(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 9622ebc001..cedd4486ae 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -193,6 +193,7 @@ /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, + nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsFinite = context.isFinite, nativeIsNaN = context.isNaN, @@ -240,8 +241,8 @@ * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, - * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`, - * `values`, `where`, `without`, `wrap`, and `zip` + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, @@ -487,9 +488,7 @@ } if (this instanceof bound) { // ensure `new bound` is an instance of `func` - noop.prototype = func.prototype; - thisBinding = new noop; - noop.prototype = null; + thisBinding = createObject(func.prototype); // mimic the constructor's `return` behavior // http://es5.github.com/#x13.2.2 @@ -501,6 +500,17 @@ return bound; } + /** + * Creates a new object with the specified `prototype`. + * + * @private + * @param {Object} prototype The prototype object. + * @returns {Object} Returns the new object. + */ + function createObject(prototype) { + return isObject(prototype) ? nativeCreate(prototype) : {}; + } + /** * Used by `template` to escape characters for inclusion in compiled * string literals. @@ -1942,6 +1952,56 @@ return result; } + /** + * Transforms an `object` to an new `accumulator` object which is the result + * of running each of its elements through the `callback`, with each `callback` + * execution potentially mutating the `accumulator` object. The `callback`is + * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). + * Callbacks may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @category Objects + * @param {Array|Object} collection The collection to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {Mixed} [accumulator] The custom accumulator value. + * @param {Mixed} [thisArg] The `this` binding of `callback`. + * @returns {Mixed} Returns the accumulated value. + * @example + * + * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { + * num *= num; + * if (num % 2) { + * return result.push(num) < 3; + * } + * }); + * // => [1, 9, 25] + * + * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { + * result[key] = num * 3; + * }); + * // => { 'a': 3, 'b': 6, 'c': 9 } + */ + function transform(object, callback, accumulator, thisArg) { + var isArr = isArray(object); + callback = lodash.createCallback(callback, thisArg, 4); + + if (arguments.length < 3) { + if (isArr) { + accumulator = []; + } else { + var ctor = object && object.constructor, + proto = ctor && ctor.prototype; + + accumulator = createObject(proto); + } + } + (isArr ? each : forOwn)(object, function(value, index, object) { + return callback(accumulator, value, index, object); + }); + return accumulator; + } + /** * Creates an array composed of the own enumerable property values of `object`. * @@ -4218,7 +4278,7 @@ if (options === true) { var leading = true; trailing = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = options.leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -4447,7 +4507,7 @@ } if (options === false) { leading = false; - } else if (options && objectTypes[typeof options]) { + } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } @@ -5055,6 +5115,7 @@ lodash.throttle = throttle; lodash.times = times; lodash.toArray = toArray; + lodash.transform = transform; lodash.union = union; lodash.uniq = uniq; lodash.unzip = unzip; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 023c7a38b3..ac344b22d1 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,41 +4,41 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(o){function f(n){if(!n||fe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=re(t))&&re(e);return e?n==e||re(n)==e:nt(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?we(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; -if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(lt(n)?n.indexOf(t,e):Et(n,t,e)):P(n,function(n){return++ru&&(u=o) -}}else t=!t&<(n)?J:G.createCallback(t,e),bt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function _t(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -if(typeof u!="number")var i=we(n),u=i.length;return t=G.createCallback(t,r,4),bt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=Nt(n,t),n[r]===t?r:-1; -for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=G.createCallback(r,o));++iEt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function At(n){for(var t=-1,e=n?dt(_t(n,"length")):0,r=Dt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,we=ve?function(n){return ft(n)?ve(n):[]}:V,je={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=at(je);return Ut&&i&&typeof oe=="function"&&(Ft=Bt(oe,o)),zt=8==he(_+"08")?he:function(n,t){return he(lt(n)?n.replace(k,""):n,t||0) -},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=te.apply(Qt,me.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(i=n.apply(f,o)),c=ie(u,t),i}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=me.call(arguments,2); -return ie(function(){n.apply(e,r)},t)},G.difference=Ct,G.filter=yt,G.flatten=Ot,G.forEach=bt,G.forIn=K,G.forOwn=P,G.functions=ut,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),bt(n,function(n,e,u){e=Jt(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return tt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; -n:for(;++uEt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=H(t[v])))(c))continue n;i.push(c)}}return i},G.invert=at,G.invoke=function(n,t){var e=me.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Dt(typeof a=="number"?a:0);return bt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},G.keys=we,G.map=mt,G.max=dt,G.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); -return ue.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},G.merge=pt,G.min=function(n,t,e){var r=1/0,u=r;if(!t&&ke(n)){e=-1;for(var a=n.length;++eEt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e; -return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=we(n),r=e.length,u=Dt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Xt,this},G.parseInt=zt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ee(e*(t-n+1)) -},G.reduce=kt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e;return it(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:we(n).length},G.some=jt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=we(i),i=st(i),f=0,c=u.interpolate||w,l="__p+='",c=Ht((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t -}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Mt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Jt(n).replace(h,et)},G.uniqueId=function(n){var t=++c;return Jt(n==u?"":n)+t -},G.all=gt,G.any=jt,G.detect=ht,G.foldl=kt,G.foldr=wt,G.include=vt,G.inject=kt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(G,t)})}),G.first=xt,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return tt(n,ge(0,a-r))}},G.take=xt,G.head=xt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Jt(this.__wrapped__)},G.prototype.value=qt,G.prototype.valueOf=qt,bt(["join","pop","shift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),bt(["push","reverse","sort","unshift"],function(n){var t=Qt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),bt(["concat","slice","splice"],function(n){var t=Qt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments)) -}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,j=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Error]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; +;(function(n){function t(o){function f(n){if(!n||ie.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ee(t))&&ee(e);return e?n==e||ee(n)==e:Z(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?je(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; +if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(ct(n)?n.indexOf(t,e):Ot(n,t,e)):P(n,function(n){return++ru&&(u=o) +}}else t=!t&&ct(n)?J:G.createCallback(t,e),ht(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function dt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=qt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=je(n),u=i.length;return t=G.createCallback(t,r,4),ht(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=It(n,t),n[r]===t?r:-1; +for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=G.createCallback(r,o));++iOt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function St(n){for(var t=-1,e=n?mt(dt(n,"length")):0,r=qt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,je=ve?function(n){return it(n)?ve(n):[]}:V,we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=ut(we);return Mt&&i&&typeof ae=="function"&&(Bt=$t(ae,o)),Dt=8==he(_+"08")?he:function(n,t){return he(ct(n)?n.replace(k,""):n,t||0) +},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=ne.apply(Lt,me.call(arguments,1)),r=e.length,u=qt(r);++t++l&&(i=n.apply(f,o)),c=oe(u,t),i}},G.defaults=M,G.defer=Bt,G.delay=function(n,t){var r=me.call(arguments,2); +return oe(function(){n.apply(e,r)},t)},G.difference=wt,G.filter=gt,G.flatten=xt,G.forEach=ht,G.forIn=K,G.forOwn=P,G.functions=rt,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),ht(n,function(n,e,u){e=Ht(t(n,e,u)),(re.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return nt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; +n:for(;++uOt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=H(t[v])))(c))continue n;i.push(c)}}return i},G.invert=ut,G.invoke=function(n,t){var e=me.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=qt(typeof a=="number"?a:0);return ht(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},G.keys=je,G.map=bt,G.max=mt,G.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); +return re.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},G.merge=lt,G.min=function(n,t,e){var r=1/0,u=r;if(!t&&ke(n)){e=-1;for(var a=n.length;++eOt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e; +return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=je(n),r=e.length,u=qt(r);++targuments.length)if(u)e=[];else{var a=n&&n.constructor;e=it(a&&a.prototype)?ce(a&&a.prototype):{}}return(u?each:P)(n,function(n,r,u){return t(e,n,r,u)}),e},G.union=function(n){return ke(n)||(arguments[0]=n?me.call(n):Lt),Nt(ne.apply(Lt,arguments))},G.uniq=Nt,G.unzip=St,G.values=pt,G.where=gt,G.without=function(n){return wt(n,me.call(arguments,1)) +},G.wrap=function(n,t){return function(){var e=[n];return ue.apply(e,arguments),t.apply(this,e)}},G.zip=function(n){return n?St(arguments):[]},G.zipObject=At,G.collect=bt,G.drop=Et,G.each=ht,G.extend=U,G.methods=rt,G.object=At,G.select=gt,G.tail=Et,G.unique=Nt,Rt(G),G.chain=G,G.prototype.chain=function(){return this},G.clone=et,G.cloneDeep=function(n,t,e){return et(n,r,t,e)},G.contains=st,G.escape=function(n){return n==u?"":Ht(n).replace(w,X)},G.every=vt,G.find=yt,G.findIndex=function(n,t,e){var r=-1,u=n?n.length:0; +for(t=G.createCallback(t,e);++re?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Rt,G.noConflict=function(){return o._=Wt,this},G.parseInt=Dt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},G.reduce=_t,G.reduceRight=kt,G.result=function(n,t){var r=n?n[t]:e;return ot(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:je(n).length +},G.some=jt,G.sortedIndex=It,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=je(i),i=pt(i),f=0,c=u.interpolate||j,l="__p+='",c=Gt((u.escape||j).source+"|"+c.source+"|"+(c===d?b:j).source+"|"+(u.evaluate||j).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; +try{var p=Kt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Ht(n).replace(h,tt)},G.uniqueId=function(n){var t=++c;return Ht(n==u?"":n)+t},G.all=vt,G.any=jt,G.detect=yt,G.foldl=_t,G.foldr=kt,G.include=st,G.inject=_t,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ue.apply(t,arguments),n.apply(G,t)})}),G.first=Ct,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; +for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return nt(n,ge(0,a-r))}},G.take=Ct,G.head=Ct,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Ht(this.__wrapped__)},G.prototype.value=Tt,G.prototype.valueOf=Tt,ht(["join","pop","shift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),ht(["push","reverse","sort","unshift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ht(["concat","slice","splice"],function(n){var t=Lt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments))}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),j=/($^)/,w=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Error]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; T[A]=a,T[O]=T[E]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z})(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 92d7f107c0..26cf100deb 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -132,6 +132,7 @@ /* Native method shortcuts for methods with the same name as other `lodash` methods */ var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind, + nativeCreate = reNative.test(nativeCreate = Object.create) && nativeCreate, nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray, nativeIsFinite = window.isFinite, nativeIsNaN = window.isNaN, @@ -166,8 +167,8 @@ * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, - * `tap`, `throttle`, `times`, `toArray`, `union`, `uniq`, `unshift`, `unzip`, - * `values`, `where`, `without`, `wrap`, and `zip` + * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, + * `unzip`, `values`, `where`, `without`, `wrap`, and `zip` * * The non-chainable wrapper functions are: * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, @@ -382,9 +383,7 @@ } if (this instanceof bound) { // ensure `new bound` is an instance of `func` - noop.prototype = func.prototype; - thisBinding = new noop; - noop.prototype = null; + thisBinding = createObject(func.prototype); // mimic the constructor's `return` behavior // http://es5.github.com/#x13.2.2 @@ -396,6 +395,28 @@ return bound; } + /** + * Creates a new object with the specified `prototype`. + * + * @private + * @param {Object} prototype The prototype object. + * @returns {Object} Returns the new object. + */ + function createObject(prototype) { + return isObject(prototype) ? nativeCreate(prototype) : {}; + } + // fallback for browsers without `Object.create` + if (!nativeCreate) { + var createObject = function(prototype) { + if (isObject(prototype)) { + noop.prototype = prototype; + var result = new noop; + noop.prototype = null; + } + return result || {}; + }; + } + /** * Used by `template` to escape characters for inclusion in compiled * string literals. diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index e0f71675c4..f51d4be4b4 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,32 +4,32 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(n){return n instanceof t?n:new i(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; -if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=P(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Rt(n),u=i.length;return t=P(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function k(n,t,r){var e; -t=P(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rT(e,o)&&u.push(o)}return u}function D(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=P(t,r);++or?Ot(0,u+r):r||0)-1;else if(r)return e=I(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])T(a,f))&&(r&&a.push(f),i.push(e))}return i}function C(n,t){return kt.fastBind||jt&&2"']/g,Z=/['\n\r\t\u2028\u2029\\]/g,nt="[object Arguments]",tt="[object Array]",rt="[object Boolean]",et="[object Date]",ut="[object Number]",ot="[object Object]",it="[object RegExp]",at="[object String]",ft={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},ct=Array.prototype,H=Object.prototype,pt=n._,st=RegExp("^"+(H.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),vt=Math.ceil,gt=n.clearTimeout,ht=ct.concat,yt=Math.floor,mt=H.hasOwnProperty,_t=ct.push,bt=n.setTimeout,dt=H.toString,jt=st.test(jt=dt.bind)&&jt,wt=st.test(wt=Array.isArray)&&wt,At=n.isFinite,xt=n.isNaN,Et=st.test(Et=Object.keys)&&Et,Ot=Math.max,St=Math.min,Nt=Math.random,Bt=ct.slice,H=st.test(n.attachEvent),Ft=jt&&!/\n|true/.test(jt+H),kt={}; -(function(){var n={0:1,length:1};kt.fastBind=jt&&!Ft,kt.spliceObjects=(ct.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},i.prototype=t.prototype,l(arguments)||(l=function(n){return n?mt.call(n,"callee"):!1});var qt=wt||function(n){return n?typeof n=="object"&&dt.call(n)==tt:!1},wt=function(n){var t,r=[];if(!n||!ft[typeof n])return r;for(t in n)mt.call(n,t)&&r.push(t);return r},Rt=Et?function(n){return m(n)?Et(n):[] -}:wt,Dt={"&":"&","<":"<",">":">",'"':""","'":"'"},Mt=v(Dt),Tt=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(t(n[r],r,n)===K)break;return n},$t=function(n,t){var r;if(!n||!ft[typeof n])return n;for(r in n)if(mt.call(n,r)&&t(n[r],r,n)===K)break;return n};y(/x/)&&(y=function(n){return typeof n=="function"&&"[object Function]"==dt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},t.bind=C,t.bindAll=function(n){for(var t=1T(o,i)){for(var a=r;--a;)if(0>T(t[a],i))continue n;o.push(i)}}return o},t.invert=v,t.invoke=function(n,t){var r=Bt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Rt,t.map=O,t.max=S,t.memoize=function(n,t){var r={};return function(){var e=L+(t?t.apply(this,arguments):arguments[0]); -return mt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=P(t,r),E(n,function(n,r,o){r=t(n,r,o),rT(t,e)&&(r[e]=n)}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Rt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Ot(0,e+r):St(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=V,t.noConflict=function(){return n._=pt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Nt();return n%1||t%1?n+St(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+yt(r*(t-n+1))},t.reduce=B,t.reduceRight=F,t.result=function(n,t){var r=n?n[t]:null;return y(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rt(n).length},t.some=k,t.sortedIndex=I,t.template=function(n,r,e){n||(n=""),e=p({},e,t.templateSettings); -var o=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||X).source+"|"+(e.interpolate||X).source+"|"+(e.evaluate||X).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(o,f).replace(Z,u),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t) -}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Q,f)},t.uniqueId=function(n){var t=++J+"";return n?n+t:t},t.all=w,t.any=k,t.detect=x,t.foldl=B,t.foldr=F,t.include=j,t.inject=B,t.first=D,t.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=P(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Bt.call(n,Ot(0,u-e))}},t.take=D,t.head=D,t.VERSION="1.2.1",V(t),t.prototype.chain=function(){return this.__chain__=!0,this -},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=ct[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!kt.spliceObjects&&0===n.length&&delete n[0],this}}),E(["concat","join","slice"],function(n){var r=ct[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t -})):W&&!W.nodeType?G?(G.exports=t)._=t:W._=t:n._=t})(this); \ No newline at end of file +;(function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function B(n,t){var r=-1,e=n?n.length:0; +if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Mt(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; +t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Nt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Rt.fastBind||wt&&2"']/g,nt=/['\n\r\t\u2028\u2029\\]/g,tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Number]",it="[object Object]",at="[object RegExp]",ft="[object String]",ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},pt=Array.prototype,J=Object.prototype,st=n._,vt=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,ht=n.clearTimeout,yt=pt.concat,mt=Math.floor,_t=J.hasOwnProperty,bt=pt.push,dt=n.setTimeout,jt=J.toString,wt=vt.test(wt=jt.bind)&&wt,At=vt.test(At=Object.create)&&At,xt=vt.test(xt=Array.isArray)&&xt,Ot=n.isFinite,Et=n.isNaN,St=vt.test(St=Object.keys)&&St,Nt=Math.max,Bt=Math.min,Ft=Math.random,kt=pt.slice,J=vt.test(n.attachEvent),qt=wt&&!/\n|true/.test(wt+J),Rt={}; +(function(){var n={0:1,length:1};Rt.fastBind=wt&&!qt,Rt.spliceObjects=(pt.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},At||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,l(arguments)||(l=function(n){return n?_t.call(n,"callee"):!1});var Dt=xt||function(n){return n?typeof n=="object"&&jt.call(n)==rt:!1},xt=function(n){var t,r=[];if(!n||!ct[typeof n])return r; +for(t in n)_t.call(n,t)&&r.push(t);return r},Mt=St?function(n){return _(n)?St(n):[]}:xt,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=g(Tt),It=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},zt=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(_t.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==jt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=g,t.invoke=function(n,t){var r=kt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Mt,t.map=S,t.max=N,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return _t.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) +}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Mt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Nt(0,e+r):Bt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=st,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Ft();return n%1||t%1?n+Bt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+mt(r*(t-n+1)) +},t.reduce=F,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Mt(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Y).source+"|"+(e.interpolate||Y).source+"|"+(e.evaluate||Y).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(nt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t +}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(c){throw c.source=i,c}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,c)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=F,t.foldr=k,t.include=w,t.inject=F,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return kt.call(n,Nt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=pt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Rt.spliceObjects&&0===n.length&&delete n[0],this +}}),E(["concat","join","slice"],function(n){var r=pt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t})(this); \ No newline at end of file From 8da0141cac767c7ac2d1dfe224dbb0db55e025a2 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 00:37:40 -0700 Subject: [PATCH 039/117] Fix `legacy include=defer` build test. Former-commit-id: 49d0598ad3a979796cd07b6819c0aa08642c93a1 --- build.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/build.js b/build.js index 4c061c4324..fe1f2d22b1 100755 --- a/build.js +++ b/build.js @@ -1862,6 +1862,12 @@ dependencyMap.toArray.push('isArray', 'map'); } + _.each(['debounce', 'throttle'], function(methodName) { + if (!useLodashMethod(methodName)) { + dependencyMap[methodName] = []; + } + }); + _.each(['max', 'min'], function(methodName) { if (!useLodashMethod(methodName)) { dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isArray', 'isString'); @@ -1997,7 +2003,7 @@ // replace `_.isPlainObject` with `shimIsPlainObject` source = source.replace( matchFunction(source, 'isPlainObject').replace(/[\s\S]+?var isPlainObject *= */, ''), - matchFunction(source, 'shimIsPlainObject').replace(/[\s\S]+?function shimIsPlainObject/, 'function') + matchFunction(source, 'shimIsPlainObject').replace(/[\s\S]+?function shimIsPlainObject/, 'function').replace(/\s*$/, '') ); source = removeFunction(source, 'shimIsPlainObject'); From 90cca8a3ebf2469e73c1de53697f26681d51bc25 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 10:52:56 -0700 Subject: [PATCH 040/117] Remove Error enum fixes/code from builds that don't need them. Former-commit-id: db060ff3571ef656709447970b62f4af753ea0cb --- build.js | 22 +++++++++++++++------- lodash.js | 15 +++++++-------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/build.js b/build.js index fe1f2d22b1..3639599813 100755 --- a/build.js +++ b/build.js @@ -1300,9 +1300,7 @@ // remove `support.nonEnumShadows` from `iteratorTemplate` source = source.replace(getIteratorTemplate(source), function(match) { - return match - .replace(/\s*\|\|\s*support\.nonEnumShadows/, '') - .replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.nonEnumShadows[\s\S]+?["']\1<% *} *%>.+/, ''); + return match.replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.nonEnumShadows[\s\S]+?["']\1<% *} *%>.+/, ''); }); return source; @@ -1826,10 +1824,9 @@ dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); if (!isMobile) { - dependencyMap.isEmpty = _.without(dependencyMap.isEmpty, 'isArguments'); - dependencyMap.isEqual = _.without(dependencyMap.isEqual, 'isArguments'); - dependencyMap.isPlainObject = _.without(dependencyMap.isPlainObject, 'isArguments'); - dependencyMap.keys = _.without(dependencyMap.keys, 'isArguments'); + _.each(['isEmpty', 'isEqual', 'isPlainObject', 'keys'], function(methodName) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isArguments'); + }); } } if (isUnderscore) { @@ -3160,6 +3157,17 @@ if (_.size(source.match(/\bfreeExports\b/g)) < 2) { source = removeVar(source, 'freeExports'); } + if (!/^ *support\.(?:skipErrorProps|nonEnumShadows) *=/m.test(source)) { + source = removeVar(source, 'Error'); + source = removeVar(source, 'errorProto'); + source = removeFromCreateIterator(source, 'errorClass'); + source = removeFromCreateIterator(source, 'errorProto'); + + // remove 'Error' from the `contextProps` array + source = source.replace(/^ *var contextProps *=[\s\S]+?;/m, function(match) { + return match.replace(/'Error', */, ''); + }); + } debugSource = cleanupSource(source); source = cleanupSource(source); diff --git a/lodash.js b/lodash.js index f2182367be..ed6e876ac7 100644 --- a/lodash.js +++ b/lodash.js @@ -218,7 +218,6 @@ ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; ctorByClass[dateClass] = Date; - ctorByClass[errorClass] = Error; ctorByClass[funcClass] = Function; ctorByClass[objectClass] = Object; ctorByClass[numberClass] = Number; @@ -563,7 +562,7 @@ ' <% } %>' + // avoid iterating over `Error.prototype` properties in older IE and Safari - ' <% if (support.enumErrorProps || support.nonEnumShadows) { %>\n' + + ' <% if (support.enumErrorProps) { %>\n' + ' var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n' + ' <% } %>' + @@ -825,16 +824,16 @@ // create the function factory var factory = Function( - 'ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, ' + - 'isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, ' + - 'stringClass, stringProto, toString', + 'errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, ' + + 'keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, ' + + 'stringProto, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( - ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, - isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, - stringClass, stringProto, toString + errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, + keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, + stringProto, toString ); } From 10626904afa676ccc2f900ad6ef0651789dcc7b5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 10:57:50 -0700 Subject: [PATCH 041/117] Add `_.transform` unit tests. Former-commit-id: 34e844950f5c003eeeaf2daea7a5ef6247fbfdab --- lodash.js | 2 +- test/test.js | 79 ++++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 71 insertions(+), 10 deletions(-) diff --git a/lodash.js b/lodash.js index ed6e876ac7..0815e46d37 100644 --- a/lodash.js +++ b/lodash.js @@ -2332,7 +2332,7 @@ var isArr = isArray(object); callback = lodash.createCallback(callback, thisArg, 4); - if (arguments.length < 3) { + if (accumulator == null) { if (isArr) { accumulator = []; } else { diff --git a/test/test.js b/test/test.js index 33abe0c92c..431d884c65 100644 --- a/test/test.js +++ b/test/test.js @@ -860,7 +860,7 @@ deepEqual(args, [1, 0, array]); }); - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual = _.first(array, function(value, index) { return this[index] < 3; }, array); @@ -933,7 +933,7 @@ deepEqual(args, [{ 'a': [1, [2]] }, 0, array]); }); - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual = _.flatten(array, function(value, index) { return this[index].a; }, array); @@ -983,7 +983,7 @@ equal(wrapper.forEach(Boolean), wrapper); }); - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual; function callback(value, index) { @@ -1267,7 +1267,7 @@ QUnit.module('lodash.groupBy'); (function() { - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual = _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); @@ -1404,7 +1404,7 @@ deepEqual(args, [3, 2, array]); }); - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual = _.initial(array, function(value, index) { return this[index] > 1; }, array); @@ -1798,7 +1798,7 @@ deepEqual(args, [3, 2, array]); }); - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual = _.last(array, function(value, index) { return this[index] > 1; }, array); @@ -2642,7 +2642,7 @@ deepEqual(actual, collection); }); - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual = _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); @@ -2664,7 +2664,7 @@ QUnit.module('lodash.sortedIndex'); (function() { - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual = _.sortedIndex([1, 2, 3], 4, function(num) { return this.sin(num); }, Math); @@ -3079,6 +3079,67 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.transform'); + + (function() { + test('should produce an that is an instance of the given object\'s constructor', function() { + function Foo() { + this.a = 1; + this.b = 2; + this.c = 3; + } + + var actual = _.transform(new Foo, function(result, value, key) { + result[key] = value * value; + }); + + ok(actual instanceof Foo); + deepEqual(_.clone(actual), { 'a': 1, 'b': 4, 'c': 9 }); + }); + + test('should treat sparse arrays as dense', function() { + var actual = _.transform(Array(1), function(result, value, index) { + result[index] = String(value); + }); + + deepEqual(actual, ['undefined']); + }); + + _.each({ + 'array': [1, 2, 3], + 'object': { 'a': 1, 'b': 2, 'c': 3 } + }, + function(object, key) { + test('should pass the correct `callback` arguments when transforming an ' + key, function() { + var args; + + _.transform(object, function() { + args || (args = slice.call(arguments)); + }); + + var first = args[0]; + if (key == 'array') { + ok(first != object && _.isArray(first)); + deepEqual(args, [first, 1, 0, object]); + } else { + ok(first != object && _.isPlainObject(first)); + deepEqual(args, [first, 1, 'a', object]); + } + }); + + test('should support the `thisArg` argument when transforming an ' + key, function() { + var actual = _.transform(object, function(result, value, key) { + result[key] = this[key]; + }, null, object); + + notEqual(actual, object); + deepEqual(actual, object); + }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.unescape'); (function() { @@ -3121,7 +3182,7 @@ QUnit.module('lodash.uniq'); (function() { - test('supports the `thisArg` argument', function() { + test('should support the `thisArg` argument', function() { var actual = _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); From 0b4b86f6c90ac2bf6ff395b94d9fcf253abb2165 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 10:58:36 -0700 Subject: [PATCH 042/117] Remove `ctorByClass` from the minified vars list in pre-compile.js. Former-commit-id: 5f5fe90d6a1a9726a07ee7b4c2c9b9b23b6700d3 --- build/pre-compile.js | 1 - 1 file changed, 1 deletion(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index d4e984819b..2bbc6af25b 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -15,7 +15,6 @@ 'collection', 'conditions', 'ctor', - 'ctorByClass', 'errorClass', 'errorProto', 'guard', From 06daad87cabecbdf7ca999fca8720ec50824583f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 11:36:04 -0700 Subject: [PATCH 043/117] Remove unnecessary semicolons from compiled strings. Former-commit-id: d4f31dafd3335878469babc5daac45957c6d4e80 --- build/pre-compile.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/pre-compile.js b/build/pre-compile.js index 2bbc6af25b..235dde7779 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -372,6 +372,11 @@ return "['" + prop.replace(/['\n\r\t]/g, '\\$&') + "']"; }); + // remove unnecessary semicolons in strings + modified = modified.replace(/;(?:}["']|(?:\\n|\s)*["']\s*\+\s*["'](?:\\n|\s)*})/g, function(match) { + return match.slice(1); + }); + // minify `createIterator` option property names iteratorOptions.forEach(function(property, index) { var minName = minNames[index]; From 87af68c0928d169f94e211c8fd069d27d1e29af4 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 11:45:24 -0700 Subject: [PATCH 044/117] Add Java options for faster Closure Compiler minification to minify.js. Former-commit-id: b493d461e78d0df80c80805a570220fdff93d487 --- build/minify.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/build/minify.js b/build/minify.js index 2b8a670ecd..a007984db2 100755 --- a/build/minify.js +++ b/build/minify.js @@ -3,8 +3,8 @@ 'use strict'; /** Load Node.js modules */ - var https = require('https'), - spawn = require('child_process').spawn, + var cp = require('child_process'), + https = require('https'), zlib = require('zlib'); /** Load other modules */ @@ -59,6 +59,17 @@ }; }()); + /** + * Java command-line options used for faster minification. + * See https://code.google.com/p/closure-compiler/wiki/FAQ#What_are_the_recommended_Java_VM_command-line_options?. + */ + var javaOptions = []; + cp.exec('java -version -client -d32', function(error) { + if (!error && process.platform != 'win32') { + javaOptions.push('-client', '-d32'); + } + }); + /** The Closure Compiler optimization modes */ var optimizationModes = { 'simple': 'SIMPLE_OPTIMIZATIONS', @@ -375,8 +386,7 @@ if (isMapped) { options.push('--create_source_map=' + mapPath, '--source_map_format=V3'); } - - var compiler = spawn('java', ['-jar', closurePath].concat(options)); + var compiler = cp.spawn('java', javaOptions.concat('-jar', closurePath, options)); if (!this.isSilent) { console.log('Compressing ' + path.basename(outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...'); } From a2088fa500e6fe95ae964284399bf83cd8d80ffb Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 13:11:57 -0700 Subject: [PATCH 045/117] Rebuild docs, files, and update minifiers. Former-commit-id: 65b04c3efc7677c8ec5cc7ce6e5840fed23b3716 --- build/minify.js | 4 +- dist/lodash.compat.js | 17 +- dist/lodash.compat.min.js | 84 +-- dist/lodash.js | 7 +- dist/lodash.min.js | 76 +-- dist/lodash.underscore.js | 1 - dist/lodash.underscore.min.js | 6 +- doc/README.md | 832 +++++++++++++---------- vendor/benchmark.js/README.md | 2 +- vendor/benchmark.js/benchmark.js | 2 +- vendor/docdown/src/DocDown/Generator.php | 4 +- vendor/platform.js/README.md | 2 +- vendor/requirejs/require.js | 70 +- vendor/underscore/underscore-min.js | 2 +- vendor/underscore/underscore.js | 24 +- 15 files changed, 632 insertions(+), 501 deletions(-) diff --git a/build/minify.js b/build/minify.js index a007984db2..31ed8f89ec 100755 --- a/build/minify.js +++ b/build/minify.js @@ -19,10 +19,10 @@ path = util.path; /** The Git object ID of `closure-compiler.tar.gz` */ - var closureId = '7815712f73ccb21f587bf3fb72a2f50be788515d'; + var closureId = '9fd5d61c1b706e7505aeb5187941c2c5497e5fd8'; /** The Git object ID of `uglifyjs.tar.gz` */ - var uglifyId = 'fb620e8672ad194b3ab501790e19c40c8ac79286'; + var uglifyId = '48cae9c0cd76acf812f90d4f98de499ac61ec105'; /** The path of the directory that is the base of the repository */ var basePath = fs.realpathSync(path.join(__dirname, '..')); diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 0b0c31e283..69093708a2 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -219,7 +219,6 @@ ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; ctorByClass[dateClass] = Date; - ctorByClass[errorClass] = Error; ctorByClass[funcClass] = Function; ctorByClass[objectClass] = Object; ctorByClass[numberClass] = Number; @@ -546,7 +545,7 @@ __p += '\n var skipProto = typeof iterable == \'function\';\n '; } - if (support.enumErrorProps || support.nonEnumShadows) { + if (support.enumErrorProps) { __p += '\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n '; } @@ -807,16 +806,16 @@ // create the function factory var factory = Function( - 'ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, ' + - 'isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, ' + - 'stringClass, stringProto, toString', + 'errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, ' + + 'keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, ' + + 'stringProto, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); // return the compiled function return factory( - ctorByClass, errorClass, errorProto, hasOwnProperty, isArguments, - isArray, isString, keys, lodash, objectProto, objectTypes, nonEnumProps, - stringClass, stringProto, toString + errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, + keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, + stringProto, toString ); } @@ -2315,7 +2314,7 @@ var isArr = isArray(object); callback = lodash.createCallback(callback, thisArg, 4); - if (arguments.length < 3) { + if (accumulator == null) { if (isArr) { accumulator = []; } else { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 0080d3f035..93f23c31ab 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,45 +4,45 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(r){function a(n){return n&&typeof n=="object"&&!Oe(n)&&ee.call(n,"__wrapped__")?n:new V(n)}function R(n){var t=n.length,e=t>=l;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)r+="n='"+t.g[k]+"';if((!(q&&w[n])&&m.call(s,n))",t.i||(r+="||(!w[n]&&s[n]!==z[n])"),r+="){"+t.f+";}"; -r+="}"}return(t.b||je.nonEnumArgs)&&(r+="}"),r+=t.c+";return D",n("i,j,k,m,o,p,r,u,v,z,A,x,H,I,K",e+r+"}")(we,A,Gt,ee,Z,Oe,it,Ae,a,Ut,$,Ce,P,Vt,ie)}function H(n){return at(n)?le(n):{}}function M(n){return"\\"+q[n]}function G(n){return Ie[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function Q(){}function W(n){var t=!1;if(!n||ie.call(n)!=B||!je.argsClass&&Z(n))return t;var e=n.constructor;return(ut(e)?e instanceof e:je.nodeClass||!U(n))?je.ownLast?(Fe(n,function(n,e,r){return t=ee.call(r,e),!1 -}),!0===t):(Fe(n,function(n,e){t=e}),!1===t||ee.call(n,t)):t}function X(n,t,e){t||(t=0),typeof e=="undefined"&&(e=n?n.length:0);var r=-1;e=e-t||0;for(var u=Pt(0>e?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?a=-1<(it(n)?n.indexOf(t,e):jt(n,t,e)):De(n,function(n){return++ru&&(u=i)}}else t=!t&&it(n)?T:a.createCallback(t,e),De(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n) -});return u}function mt(n,t,e,r){var u=3>arguments.length;if(t=a.createCallback(t,r,4),Oe(n)){var o=-1,i=n.length;for(u&&(e=n[++o]);++oarguments.length;if(typeof o!="number")var c=Ae(n),o=c.length;else je.unindexedChars&&it(n)&&(u=n.split(""));return t=a.createCallback(t,r,4),gt(n,function(n,r,a){r=c?c[--o]:--o,e=i?(i=!1,u[r]):t(e,u[r],r,a)}),e}function bt(n,t,e){var r; -if(t=a.createCallback(t,e),Oe(n)){e=-1;for(var u=n.length;++ee?ge(0,u+e):e||0)-1;else if(e)return r=xt(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=l;if(p)var v={};for(null!=r&&(s=[],r=a.createCallback(r,u));++ojt(s,g))&&((r||p)&&s.push(g),f.push(u))}return f}function Ot(n){for(var t=-1,e=n?yt(ze(n,"length")):0,r=Pt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var ke={a:"y,G,l",h:"var a=arguments,b=0,c=typeof l=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Be=et(Ie),Ne=J(ke,{h:ke.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=v.createCallback(a[--c-1],a[c--],2);}else if(c>2&&typeof a[c-1]=='function'){d=a[--c];}"),f:"D[n]=d?d(D[n],s[n]):s[n]"}),Pe=J(ke),Fe=J(xe,Ee,{i:!1}),$e=J(xe,Ee); -ut(/x/)&&(ut=function(n){return typeof n=="function"&&ie.call(n)==D});var qe=te?function(n){if(!n||ie.call(n)!=B||!je.argsClass&&Z(n))return!1;var t=n.valueOf,e=typeof t=="function"&&(e=te(t))&&te(e);return e?n==e||te(n)==e:W(n)}:W,ze=ht;_e&&u&&typeof ae=="function"&&(Dt=At(ae,r));var Re=8==ye(m+"08")?ye:function(n,t){return ye(it(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Ne,a.at=function(n){var t=-1,e=Zt.apply(Mt,de.call(arguments,1)),r=e.length,u=Pt(r); -for(je.unindexedChars&&it(n)&&(n=n.split(""));++t++c&&(a=n.apply(o,u)),i=oe(r,t),a}},a.defaults=Pe,a.defer=Dt,a.delay=function(n,t){var r=de.call(arguments,2);return oe(function(){n.apply(e,r)},t)},a.difference=_t,a.filter=pt,a.flatten=Ct,a.forEach=gt,a.forIn=Fe,a.forOwn=$e,a.functions=tt,a.groupBy=function(n,t,e){var r={}; -return t=a.createCallback(t,e),gt(n,function(n,e,u){e=Jt(t(n,e,u)),(ee.call(r,e)?r[e]:r[e]=[]).push(n)}),r},a.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=null==t||e?1:t||r;return X(n,0,he(ge(0,u-r),u))},a.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],f=i;n:for(;++ujt(f,s)){o&&f.push(s); -for(var v=e;--v;)if(!(r[v]||(r[v]=R(t[v])))(s))continue n;i.push(s)}}return i},a.invert=et,a.invoke=function(n,t){var e=de.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Pt(typeof a=="number"?a:0);return gt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},a.keys=Ae,a.map=ht,a.max=yt,a.memoize=function(n,t){function e(){var r=e.cache,u=c+(t?t.apply(this,arguments):arguments[0]);return ee.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},a.merge=ct,a.min=function(n,t,e){var r=1/0,u=r; -if(!t&&Oe(n)){e=-1;for(var o=n.length;++ejt(o,e))&&(u[e]=n)}),u},a.once=function(n){var t,e;return function(){return t?e:(t=!0,e=n.apply(this,arguments),n=null,e)}},a.pairs=function(n){for(var t=-1,e=Ae(n),r=e.length,u=Pt(r);++targuments.length)if(u)e=[];else{var o=n&&n.constructor;e=H(o&&o.prototype)}return(u?De:$e)(n,function(n,r,u){return t(e,n,r,u)}),e},a.union=function(n){return Oe(n)||(arguments[0]=n?de.call(n):Mt),Et(Zt.apply(Mt,arguments))},a.uniq=Et,a.unzip=Ot,a.values=lt,a.where=pt,a.without=function(n){return _t(n,de.call(arguments,1))},a.wrap=function(n,t){return function(){var e=[n];return re.apply(e,arguments),t.apply(this,e)}},a.zip=function(n){return n?Ot(arguments):[]},a.zipObject=St,a.collect=ht,a.drop=kt,a.each=gt,a.extend=Ne,a.methods=tt,a.object=St,a.select=pt,a.tail=kt,a.unique=Et,Bt(a),a.chain=a,a.prototype.chain=function(){return this -},a.clone=nt,a.cloneDeep=function(n,t,e){return nt(n,!0,t,e)},a.contains=ft,a.escape=function(n){return null==n?"":Jt(n).replace(_,G)},a.every=st,a.find=vt,a.findIndex=function(n,t,e){var r=-1,u=n?n.length:0;for(t=a.createCallback(t,e);++re?ge(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},a.mixin=Bt,a.noConflict=function(){return r._=Qt,this},a.parseInt=Re,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ne(e*(t-n+1))},a.reduce=mt,a.reduceRight=dt,a.result=function(n,t){var r=n?n[t]:e; -return ut(r)?n[t]():r},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ae(n).length},a.some=bt,a.sortedIndex=xt,a.template=function(n,t,r){var u=a.templateSettings;n||(n=""),r=Pe({},r,u);var o,i=Pe({},r.imports,u.imports),u=Ae(i),i=lt(i),c=0,l=r.interpolate||b,v="__p+='",l=Lt((r.escape||b).source+"|"+l.source+"|"+(l===y?g:b).source+"|"+(r.evaluate||b).source+"|$","g");n.replace(l,function(t,e,r,u,a,i){return r||(r=u),v+=n.slice(c,i).replace(w,M),e&&(v+="'+__e("+e+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),r&&(v+="'+((__t=("+r+"))==null?'':__t)+'"),c=i+t.length,t -}),v+="';\n",l=r=r.variable,l||(r="obj",v="with("+r+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(s,"$1").replace(p,"$1;"),v="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=zt(u,"return "+v).apply(e,i)}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(v,Y)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t -},a.all=st,a.any=bt,a.detect=vt,a.foldl=mt,a.foldr=dt,a.include=ft,a.inject=mt,$e(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return re.apply(t,arguments),n.apply(a,t)})}),a.first=wt,a.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,null==r||e)return n[u-1];return X(n,ge(0,u-r))}},a.take=wt,a.head=wt,$e(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return null==t||e&&typeof t!="function"?r:new V(r)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Nt,a.prototype.valueOf=Nt,De(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),De(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),De(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments)) -}}),je.spliceObjects||De(["pop","shift","splice"],function(n){var t=Mt[n],e="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,r=t.apply(n,arguments);return 0===n.length&&delete n[0],e?new V(r):r}}),a}var e,r=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==r&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=200,f=/\b__p\+='';/g,s=/\b(__p\+=)''\+/g,p=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,w=/['\n\r\t\u2028\u2029\\]/g,C="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",D="[object Function]",I="[object Number]",B="[object Object]",N="[object RegExp]",P="[object String]",F={}; -F[D]=!1,F[x]=F[E]=F[O]=F[S]=F[I]=F[B]=F[N]=F[P]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):r&&!r.nodeType?u?(u.exports=z)._=z:r._=z:n._=z})(this); \ No newline at end of file +;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Er(n)&&tr.call(n,"__wrapped__")?n:new V(n)}function R(n){var t=n.length,r=t>=l;if(r)for(var e={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; +e+="}"}return(t.b||wr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(A,Kt,tr,Z,Er,it,Sr,a,Mt,$,Cr,z,Ut,or)}function J(n){return at(n)?cr(n):{}}function K(n){return"\\"+q[n]}function M(n){return Ir[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function Q(){}function W(n){var t=!1;if(!n||or.call(n)!=N||!wr.argsClass&&Z(n))return t;var r=n.constructor;return(ut(r)?r instanceof r:wr.nodeClass||!U(n))?wr.ownLast?(zr(n,function(n,r,e){return t=tr.call(e,r),!1 +}),!0===t):(zr(n,function(n,r){t=r}),!1===t||tr.call(n,t)):t}function X(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=zt(0>r?0:r);++er?vr(0,u+r):r)||0,typeof u=="number"?a=-1<(it(n)?n.indexOf(t,r):jt(n,t,r)):Ar(n,function(n){return++eu&&(u=i)}}else t=!t&&it(n)?T:a.createCallback(t,r),Ar(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n) +});return u}function mt(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Er(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Sr(n),o=c.length;else wr.unindexedChars&&it(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),gt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function bt(n,t,r){var e; +if(t=a.createCallback(t,r),Er(n)){r=-1;for(var u=n.length;++rr?vr(0,u+r):r||0)-1;else if(r)return e=xt(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])=l;if(s)var v={};for(null!=e&&(p=[],e=a.createCallback(e,u));++ojt(p,g))&&((e||s)&&p.push(g),f.push(u))}return f}function Ot(n){for(var t=-1,r=n?yt(qr(n,"length")):0,e=zt(0>r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var jr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Br=rt(Ir),Nr=H(jr,{h:jr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Pr=H(jr),zr=H(kr,xr,{i:!1}),Fr=H(kr,xr); +ut(/x/)&&(ut=function(n){return typeof n=="function"&&or.call(n)==I});var $r=nr?function(n){if(!n||or.call(n)!=N||!wr.argsClass&&Z(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=nr(t))&&nr(r);return r?n==r||nr(n)==r:W(n)}:W,qr=ht;br&&u&&typeof ur=="function"&&(It=At(ur,e));var Dr=8==hr(m+"08")?hr:function(n,t){return hr(it(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Nr,a.at=function(n){var t=-1,r=Yt.apply(Jt,mr.call(arguments,1)),e=r.length,u=zt(e); +for(wr.unindexedChars&&it(n)&&(n=n.split(""));++t++c&&(a=n.apply(o,u)),i=ar(e,t),a}},a.defaults=Pr,a.defer=It,a.delay=function(n,t){var e=mr.call(arguments,2);return ar(function(){n.apply(r,e)},t)},a.difference=_t,a.filter=st,a.flatten=wt,a.forEach=gt,a.forIn=zr,a.forOwn=Fr,a.functions=tt,a.groupBy=function(n,t,r){var e={}; +return t=a.createCallback(t,r),gt(n,function(n,r,u){r=Gt(t(n,r,u)),(tr.call(e,r)?e[r]:e[r]=[]).push(n)}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return X(n,0,gr(vr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],f=i;n:for(;++ujt(f,p)){o&&f.push(p); +for(var v=r;--v;)if(!(e[v]||(e[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=rt,a.invoke=function(n,t){var r=mr.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=zt(typeof a=="number"?a:0);return gt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},a.keys=Sr,a.map=ht,a.max=yt,a.memoize=function(n,t){function r(){var e=r.cache,u=c+(t?t.apply(this,arguments):arguments[0]);return tr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},a.merge=ct,a.min=function(n,t,r){var e=1/0,u=e; +if(!t&&Er(n)){r=-1;for(var o=n.length;++rjt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Sr(n),e=r.length,u=zt(e);++tr?vr(0,e+r):gr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Nt,a.noConflict=function(){return e._=Vt,this},a.parseInt=Dr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=yr();return n%1||t%1?n+gr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+Zt(r*(t-n+1))},a.reduce=mt,a.reduceRight=dt,a.result=function(n,t){var e=n?n[t]:r; +return ut(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Sr(n).length},a.some=bt,a.sortedIndex=xt,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Pr({},e,u);var o,i=Pr({},e.imports,u.imports),u=Sr(i),i=lt(i),c=0,l=e.interpolate||b,v="__p+='",l=Lt((e.escape||b).source+"|"+l.source+"|"+(l===y?g:b).source+"|"+(e.evaluate||b).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),v+=n.slice(c,i).replace(C,K),r&&(v+="'+__e("+r+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),e&&(v+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t +}),v+="';\n",l=e=e.variable,l||(e="obj",v="with("+e+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=qt(u,"return "+v).apply(r,i)}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Gt(n).replace(v,Y)},a.uniqueId=function(n){var t=++o;return Gt(null==n?"":n)+t +},a.all=pt,a.any=bt,a.detect=vt,a.foldl=mt,a.foldr=dt,a.include=ft,a.inject=mt,Fr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return rr.apply(t,arguments),n.apply(a,t)})}),a.first=Ct,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return X(n,vr(0,u-e))}},a.take=Ct,a.head=Ct,Fr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); +return null==t||r&&typeof t!="function"?e:new V(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Gt(this.__wrapped__)},a.prototype.value=Pt,a.prototype.valueOf=Pt,Ar(["join","pop","shift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Ar(["push","reverse","sort","unshift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ar(["concat","slice","splice"],function(n){var t=Jt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments)) +}}),wr.spliceObjects||Ar(["pop","shift","splice"],function(n){var t=Jt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new V(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=200,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",I="[object Function]",B="[object Number]",N="[object Object]",P="[object RegExp]",z="[object String]",F={}; +F[I]=!1,F[x]=F[E]=F[O]=F[S]=F[B]=F[N]=F[P]=F[z]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=D, define(function(){return D})):e&&!e.nodeType?u?(u.exports=D)._=D:e._=D:n._=D}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index cedd4486ae..6aa1d4966a 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -82,7 +82,7 @@ /** Used to assign default `context` object properties */ var contextProps = [ - 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', + 'Array', 'Boolean', 'Date', 'Function', 'Math', 'Number', 'Object', 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', 'parseInt', 'setImmediate', 'setTimeout' ]; @@ -153,7 +153,6 @@ var Array = context.Array, Boolean = context.Boolean, Date = context.Date, - Error = context.Error, Function = context.Function, Math = context.Math, Number = context.Number, @@ -164,7 +163,6 @@ /** Used for `Array` and `Object` method references */ var arrayProto = Array.prototype, - errorProto = Error.prototype, objectProto = Object.prototype, stringProto = String.prototype; @@ -213,7 +211,6 @@ ctorByClass[arrayClass] = Array; ctorByClass[boolClass] = Boolean; ctorByClass[dateClass] = Date; - ctorByClass[errorClass] = Error; ctorByClass[funcClass] = Function; ctorByClass[objectClass] = Object; ctorByClass[numberClass] = Number; @@ -1986,7 +1983,7 @@ var isArr = isArray(object); callback = lodash.createCallback(callback, thisArg, 4); - if (arguments.length < 3) { + if (accumulator == null) { if (isArr) { accumulator = []; } else { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index ac344b22d1..145638b6b7 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,41 +4,41 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(o){function f(n){if(!n||ie.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ee(t))&&ee(e);return e?n==e||ee(n)==e:Z(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?je(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; -if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(ct(n)?n.indexOf(t,e):Ot(n,t,e)):P(n,function(n){return++ru&&(u=o) -}}else t=!t&&ct(n)?J:G.createCallback(t,e),ht(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function dt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=qt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -if(typeof u!="number")var i=je(n),u=i.length;return t=G.createCallback(t,r,4),ht(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=It(n,t),n[r]===t?r:-1; -for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=G.createCallback(r,o));++iOt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function St(n){for(var t=-1,e=n?mt(dt(n,"length")):0,r=qt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,je=ve?function(n){return it(n)?ve(n):[]}:V,we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=ut(we);return Mt&&i&&typeof ae=="function"&&(Bt=$t(ae,o)),Dt=8==he(_+"08")?he:function(n,t){return he(ct(n)?n.replace(k,""):n,t||0) -},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=ne.apply(Lt,me.call(arguments,1)),r=e.length,u=qt(r);++t++l&&(i=n.apply(f,o)),c=oe(u,t),i}},G.defaults=M,G.defer=Bt,G.delay=function(n,t){var r=me.call(arguments,2); -return oe(function(){n.apply(e,r)},t)},G.difference=wt,G.filter=gt,G.flatten=xt,G.forEach=ht,G.forIn=K,G.forOwn=P,G.functions=rt,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),ht(n,function(n,e,u){e=Ht(t(n,e,u)),(re.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return nt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; -n:for(;++uOt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=H(t[v])))(c))continue n;i.push(c)}}return i},G.invert=ut,G.invoke=function(n,t){var e=me.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=qt(typeof a=="number"?a:0);return ht(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},G.keys=je,G.map=bt,G.max=mt,G.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); -return re.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},G.merge=lt,G.min=function(n,t,e){var r=1/0,u=r;if(!t&&ke(n)){e=-1;for(var a=n.length;++eOt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e; -return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=je(n),r=e.length,u=qt(r);++targuments.length)if(u)e=[];else{var a=n&&n.constructor;e=it(a&&a.prototype)?ce(a&&a.prototype):{}}return(u?each:P)(n,function(n,r,u){return t(e,n,r,u)}),e},G.union=function(n){return ke(n)||(arguments[0]=n?me.call(n):Lt),Nt(ne.apply(Lt,arguments))},G.uniq=Nt,G.unzip=St,G.values=pt,G.where=gt,G.without=function(n){return wt(n,me.call(arguments,1)) -},G.wrap=function(n,t){return function(){var e=[n];return ue.apply(e,arguments),t.apply(this,e)}},G.zip=function(n){return n?St(arguments):[]},G.zipObject=At,G.collect=bt,G.drop=Et,G.each=ht,G.extend=U,G.methods=rt,G.object=At,G.select=gt,G.tail=Et,G.unique=Nt,Rt(G),G.chain=G,G.prototype.chain=function(){return this},G.clone=et,G.cloneDeep=function(n,t,e){return et(n,r,t,e)},G.contains=st,G.escape=function(n){return n==u?"":Ht(n).replace(w,X)},G.every=vt,G.find=yt,G.findIndex=function(n,t,e){var r=-1,u=n?n.length:0; -for(t=G.createCallback(t,e);++re?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Rt,G.noConflict=function(){return o._=Wt,this},G.parseInt=Dt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},G.reduce=_t,G.reduceRight=kt,G.result=function(n,t){var r=n?n[t]:e;return ot(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:je(n).length -},G.some=jt,G.sortedIndex=It,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=je(i),i=pt(i),f=0,c=u.interpolate||j,l="__p+='",c=Gt((u.escape||j).source+"|"+c.source+"|"+(c===d?b:j).source+"|"+(u.evaluate||j).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(C,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; -try{var p=Kt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Ht(n).replace(h,tt)},G.uniqueId=function(n){var t=++c;return Ht(n==u?"":n)+t},G.all=vt,G.any=jt,G.detect=yt,G.foldl=_t,G.foldr=kt,G.include=st,G.inject=_t,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ue.apply(t,arguments),n.apply(G,t)})}),G.first=Ct,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; -for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return nt(n,ge(0,a-r))}},G.take=Ct,G.head=Ct,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Ht(this.__wrapped__)},G.prototype.value=Tt,G.prototype.valueOf=Tt,ht(["join","pop","shift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),ht(["push","reverse","sort","unshift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ht(["concat","slice","splice"],function(n){var t=Lt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments))}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),j=/($^)/,w=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Error]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; -T[A]=a,T[O]=T[E]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z})(this); \ No newline at end of file +;!function(n){function t(o){function f(n){if(!n||ae.call(n)!=$)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ne(t))&&ne(e);return e?n==e||ne(n)==e:Y(n)}function z(n,t,e){if(!n||!T[typeof n])return n;t=t&&typeof e=="undefined"?t:V.createCallback(t,e);for(var r=-1,u=T[typeof n]?_e(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; +if(ne?0:e);++re?se(0,u+e):e)||0,typeof u=="number"?o=-1<(ft(n)?n.indexOf(t,e):xt(n,t,e)):z(n,function(n){return++ru&&(u=o) +}}else t=!t&&ft(n)?H:V.createCallback(t,e),yt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function mt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Tt(r);++earguments.length;t=V.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=_e(n),u=i.length;return t=V.createCallback(t,r,4),yt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function kt(n,t,e){var r;t=V.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?se(0,u+e):e||0)-1;else if(e)return r=Et(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=V.createCallback(r,o));++ixt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function Nt(n){for(var t=-1,e=n?bt(mt(n,"length")):0,r=Tt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:V}},X.prototype=V.prototype;var de=fe,_e=pe?function(n){return ot(n)?pe(n):[]}:U,ke={"&":"&","<":"<",">":">",'"':""","'":"'"},we=rt(ke);return Pt&&i&&typeof re=="function"&&($t=At(re,o)),qt=8==ge(_+"08")?ge:function(n,t){return ge(ft(n)?n.replace(k,""):n,t||0) +},V.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},V.assign=M,V.at=function(n){for(var t=-1,e=Yt.apply(Ht,he.call(arguments,1)),r=e.length,u=Tt(r);++t++l&&(i=n.apply(f,o)),c=ue(u,t),i}},V.defaults=K,V.defer=$t,V.delay=function(n,t){var r=he.call(arguments,2); +return ue(function(){n.apply(e,r)},t)},V.difference=wt,V.filter=vt,V.flatten=jt,V.forEach=yt,V.forIn=P,V.forOwn=z,V.functions=et,V.groupBy=function(n,t,e){var r={};return t=V.createCallback(t,e),yt(n,function(n,e,u){e=Vt(t(n,e,u)),(te.call(r,e)?r[e]:r[e]=[]).push(n)}),r},V.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=V.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return Z(n,0,ve(se(0,a-r),a))},V.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; +n:for(;++uxt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=G(t[v])))(c))continue n;i.push(c)}}return i},V.invert=rt,V.invoke=function(n,t){var e=he.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Tt(typeof a=="number"?a:0);return yt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},V.keys=_e,V.map=ht,V.max=bt,V.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); +return te.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},V.merge=ct,V.min=function(n,t,e){var r=1/0,u=r;if(!t&&de(n)){e=-1;for(var a=n.length;++ext(a,e))&&(u[e]=n)}),u},V.once=function(n){var t,e; +return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},V.pairs=function(n){for(var t=-1,e=_e(n),r=e.length,u=Tt(r);++te?se(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r; +return-1},V.mixin=Ft,V.noConflict=function(){return o._=Lt,this},V.parseInt=qt,V.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=ye();return n%1||t%1?n+ve(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},V.reduce=dt,V.reduceRight=_t,V.result=function(n,t){var r=n?n[t]:e;return at(r)?n[t]():r},V.runInContext=t,V.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:_e(n).length},V.some=kt,V.sortedIndex=Et,V.template=function(n,t,u){var a=V.templateSettings; +n||(n=""),u=K({},u,a);var o,i=K({},u.imports,a.imports),a=_e(i),i=lt(i),f=0,c=u.interpolate||w,l="__p+='",c=Ut((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(j,Q),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; +try{var p=zt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},V.unescape=function(n){return n==u?"":Vt(n).replace(h,nt)},V.uniqueId=function(n){var t=++c;return Vt(n==u?"":n)+t},V.all=st,V.any=kt,V.detect=gt,V.foldl=dt,V.foldr=_t,V.include=pt,V.inject=dt,z(V,function(n,t){V.prototype[t]||(V.prototype[t]=function(){var t=[this.__wrapped__];return ee.apply(t,arguments),n.apply(V,t)})}),V.first=Ct,V.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; +for(t=V.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Z(n,se(0,a-r))}},V.take=Ct,V.head=Ct,z(V,function(n,t){V.prototype[t]||(V.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new X(r)})}),V.VERSION="1.2.1",V.prototype.toString=function(){return Vt(this.__wrapped__)},V.prototype.value=Rt,V.prototype.valueOf=Rt,yt(["join","pop","shift"],function(n){var t=Ht[n];V.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),yt(["push","reverse","sort","unshift"],function(n){var t=Ht[n];V.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),yt(["concat","slice","splice"],function(n){var t=Ht[n];V.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments))}}),V}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Function]",A="[object Number]",$="[object Object]",B="[object RegExp]",F="[object String]",R={}; +R[S]=a,R[O]=R[E]=R[I]=R[N]=R[A]=R[$]=R[B]=R[F]=r;var T={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=D, define(function(){return D})):o&&!o.nodeType?i?(i.exports=D)._=D:o._=D:n._=D}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 26cf100deb..55f792e3ec 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -105,7 +105,6 @@ /** Used for `Array` and `Object` method references */ var arrayProto = Array.prototype, - errorProto = Error.prototype, objectProto = Object.prototype, stringProto = String.prototype; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index f51d4be4b4..ab0b810c9d 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,7 +4,7 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;(function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(nt||typeof n=="undefined")return 1;if(n$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Rt.fastBind||wt&&2"']/g,nt=/['\n\r\t\u2028\u2029\\]/g,tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Number]",it="[object Object]",at="[object RegExp]",ft="[object String]",ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},pt=Array.prototype,J=Object.prototype,st=n._,vt=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,ht=n.clearTimeout,yt=pt.concat,mt=Math.floor,_t=J.hasOwnProperty,bt=pt.push,dt=n.setTimeout,jt=J.toString,wt=vt.test(wt=jt.bind)&&wt,At=vt.test(At=Object.create)&&At,xt=vt.test(xt=Array.isArray)&&xt,Ot=n.isFinite,Et=n.isNaN,St=vt.test(St=Object.keys)&&St,Nt=Math.max,Bt=Math.min,Ft=Math.random,kt=pt.slice,J=vt.test(n.attachEvent),qt=wt&&!/\n|true/.test(wt+J),Rt={}; -(function(){var n={0:1,length:1};Rt.fastBind=wt&&!qt,Rt.spliceObjects=(pt.splice.call(n,0,1),!n[0])})(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},At||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,l(arguments)||(l=function(n){return n?_t.call(n,"callee"):!1});var Dt=xt||function(n){return n?typeof n=="object"&&jt.call(n)==rt:!1},xt=function(n){var t,r=[];if(!n||!ct[typeof n])return r; +!function(){var n={0:1,length:1};Rt.fastBind=wt&&!qt,Rt.spliceObjects=(pt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},At||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,l(arguments)||(l=function(n){return n?_t.call(n,"callee"):!1});var Dt=xt||function(n){return n?typeof n=="object"&&jt.call(n)==rt:!1},xt=function(n){var t,r=[];if(!n||!ct[typeof n])return r; for(t in n)_t.call(n,t)&&r.push(t);return r},Mt=St?function(n){return _(n)?St(n):[]}:xt,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=g(Tt),It=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},zt=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(_t.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==jt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 }},t.bind=P,t.bindAll=function(n){for(var t=1 ## `Arrays` -* [`chain.compact`](#_compactarray) -* [`chain.difference`](#_differencearray--array1-array2-) -* [`chain.drop`](#_restarray--callbackn1-thisarg) -* [`chain.findIndex`](#_findindexarray--callbackidentity-thisarg) -* [`chain.first`](#_firstarray--callbackn-thisarg) -* [`chain.flatten`](#_flattenarray--isshallowfalse-callbackidentity-thisarg) -* [`chain.head`](#_firstarray--callbackn-thisarg) -* [`chain.indexOf`](#_indexofarray-value--fromindex0) -* [`chain.initial`](#_initialarray--callbackn1-thisarg) -* [`chain.intersection`](#_intersectionarray1-array2-) -* [`chain.last`](#_lastarray--callbackn-thisarg) -* [`chain.lastIndexOf`](#_lastindexofarray-value--fromindexarraylength-1) -* [`chain.object`](#_zipobjectkeys--values) -* [`chain.range`](#_rangestart0-end--step1) -* [`chain.rest`](#_restarray--callbackn1-thisarg) -* [`chain.sortedIndex`](#_sortedindexarray-value--callbackidentity-thisarg) -* [`chain.tail`](#_restarray--callbackn1-thisarg) -* [`chain.take`](#_firstarray--callbackn-thisarg) -* [`chain.union`](#_unionarray1-array2-) -* [`chain.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg) -* [`chain.unique`](#_uniqarray--issortedfalse-callbackidentity-thisarg) -* [`chain.unzip`](#_unziparray) -* [`chain.without`](#_withoutarray--value1-value2-) -* [`chain.zip`](#_ziparray1-array2-) -* [`chain.zipObject`](#_zipobjectkeys--values) +* [`_.compact`](#_compactarray) +* [`_.difference`](#_differencearray--array1-array2-) +* [`_.drop`](#_restarray--callbackn1-thisarg) +* [`_.findIndex`](#_findindexarray--callbackidentity-thisarg) +* [`_.first`](#_firstarray--callbackn-thisarg) +* [`_.flatten`](#_flattenarray--isshallowfalse-callbackidentity-thisarg) +* [`_.head`](#_firstarray--callbackn-thisarg) +* [`_.indexOf`](#_indexofarray-value--fromindex0) +* [`_.initial`](#_initialarray--callbackn1-thisarg) +* [`_.intersection`](#_intersectionarray1-array2-) +* [`_.last`](#_lastarray--callbackn-thisarg) +* [`_.lastIndexOf`](#_lastindexofarray-value--fromindexarraylength-1) +* [`_.object`](#_zipobjectkeys--values) +* [`_.range`](#_rangestart0-end--step1) +* [`_.rest`](#_restarray--callbackn1-thisarg) +* [`_.sortedIndex`](#_sortedindexarray-value--callbackidentity-thisarg) +* [`_.tail`](#_restarray--callbackn1-thisarg) +* [`_.take`](#_firstarray--callbackn-thisarg) +* [`_.union`](#_unionarray1-array2-) +* [`_.uniq`](#_uniqarray--issortedfalse-callbackidentity-thisarg) +* [`_.unique`](#_uniqarray--issortedfalse-callbackidentity-thisarg) +* [`_.unzip`](#_unziparray) +* [`_.without`](#_withoutarray--value1-value2-) +* [`_.zip`](#_ziparray1-array2-) +* [`_.zipObject`](#_zipobjectkeys--values) @@ -38,11 +38,12 @@ ## `Chaining` -* [`chain`](#_value) -* [`chain.tap`](#_tapvalue-interceptor) -* [`chain.prototype.toString`](#_prototypetostring) -* [`chain.prototype.value`](#_prototypevalueof) -* [`chain.prototype.valueOf`](#_prototypevalueof) +* [`_`](#_value) +* [`_.chain`](#_value) +* [`_.tap`](#_tapvalue-interceptor) +* [`_.prototype.toString`](#_prototypetostring) +* [`_.prototype.value`](#_prototypevalueof) +* [`_.prototype.valueOf`](#_prototypevalueof) @@ -50,38 +51,38 @@ ## `Collections` -* [`chain.all`](#_everycollection--callbackidentity-thisarg) -* [`chain.any`](#_somecollection--callbackidentity-thisarg) -* [`chain.at`](#_atcollection--index1-index2-) -* [`chain.collect`](#_mapcollection--callbackidentity-thisarg) -* [`chain.contains`](#_containscollection-target--fromindex0) -* [`chain.countBy`](#_countbycollection--callbackidentity-thisarg) -* [`chain.detect`](#_findcollection--callbackidentity-thisarg) -* [`chain.each`](#_foreachcollection--callbackidentity-thisarg) -* [`chain.every`](#_everycollection--callbackidentity-thisarg) -* [`chain.filter`](#_filtercollection--callbackidentity-thisarg) -* [`chain.find`](#_findcollection--callbackidentity-thisarg) -* [`chain.foldl`](#_reducecollection--callbackidentity-accumulator-thisarg) -* [`chain.foldr`](#_reducerightcollection--callbackidentity-accumulator-thisarg) -* [`chain.forEach`](#_foreachcollection--callbackidentity-thisarg) -* [`chain.groupBy`](#_groupbycollection--callbackidentity-thisarg) -* [`chain.include`](#_containscollection-target--fromindex0) -* [`chain.inject`](#_reducecollection--callbackidentity-accumulator-thisarg) -* [`chain.invoke`](#_invokecollection-methodname--arg1-arg2-) -* [`chain.map`](#_mapcollection--callbackidentity-thisarg) -* [`chain.max`](#_maxcollection--callbackidentity-thisarg) -* [`chain.min`](#_mincollection--callbackidentity-thisarg) -* [`chain.pluck`](#_pluckcollection-property) -* [`chain.reduce`](#_reducecollection--callbackidentity-accumulator-thisarg) -* [`chain.reduceRight`](#_reducerightcollection--callbackidentity-accumulator-thisarg) -* [`chain.reject`](#_rejectcollection--callbackidentity-thisarg) -* [`chain.select`](#_filtercollection--callbackidentity-thisarg) -* [`chain.shuffle`](#_shufflecollection) -* [`chain.size`](#_sizecollection) -* [`chain.some`](#_somecollection--callbackidentity-thisarg) -* [`chain.sortBy`](#_sortbycollection--callbackidentity-thisarg) -* [`chain.toArray`](#_toarraycollection) -* [`chain.where`](#_wherecollection-properties) +* [`_.all`](#_everycollection--callbackidentity-thisarg) +* [`_.any`](#_somecollection--callbackidentity-thisarg) +* [`_.at`](#_atcollection--index1-index2-) +* [`_.collect`](#_mapcollection--callbackidentity-thisarg) +* [`_.contains`](#_containscollection-target--fromindex0) +* [`_.countBy`](#_countbycollection--callbackidentity-thisarg) +* [`_.detect`](#_findcollection--callbackidentity-thisarg) +* [`_.each`](#_foreachcollection--callbackidentity-thisarg) +* [`_.every`](#_everycollection--callbackidentity-thisarg) +* [`_.filter`](#_filtercollection--callbackidentity-thisarg) +* [`_.find`](#_findcollection--callbackidentity-thisarg) +* [`_.foldl`](#_reducecollection--callbackidentity-accumulator-thisarg) +* [`_.foldr`](#_reducerightcollection--callbackidentity-accumulator-thisarg) +* [`_.forEach`](#_foreachcollection--callbackidentity-thisarg) +* [`_.groupBy`](#_groupbycollection--callbackidentity-thisarg) +* [`_.include`](#_containscollection-target--fromindex0) +* [`_.inject`](#_reducecollection--callbackidentity-accumulator-thisarg) +* [`_.invoke`](#_invokecollection-methodname--arg1-arg2-) +* [`_.map`](#_mapcollection--callbackidentity-thisarg) +* [`_.max`](#_maxcollection--callbackidentity-thisarg) +* [`_.min`](#_mincollection--callbackidentity-thisarg) +* [`_.pluck`](#_pluckcollection-property) +* [`_.reduce`](#_reducecollection--callbackidentity-accumulator-thisarg) +* [`_.reduceRight`](#_reducerightcollection--callbackidentity-accumulator-thisarg) +* [`_.reject`](#_rejectcollection--callbackidentity-thisarg) +* [`_.select`](#_filtercollection--callbackidentity-thisarg) +* [`_.shuffle`](#_shufflecollection) +* [`_.size`](#_sizecollection) +* [`_.some`](#_somecollection--callbackidentity-thisarg) +* [`_.sortBy`](#_sortbycollection--callbackidentity-thisarg) +* [`_.toArray`](#_toarraycollection) +* [`_.where`](#_wherecollection-properties) @@ -89,21 +90,21 @@ ## `Functions` -* [`chain.after`](#_aftern-func) -* [`chain.bind`](#_bindfunc--thisarg-arg1-arg2-) -* [`chain.bindAll`](#_bindallobject--methodname1-methodname2-) -* [`chain.bindKey`](#_bindkeyobject-key--arg1-arg2-) -* [`chain.compose`](#_composefunc1-func2-) -* [`chain.createCallback`](#_createcallbackfuncidentity-thisarg-argcount3) -* [`chain.debounce`](#_debouncefunc-wait-options) -* [`chain.defer`](#_deferfunc--arg1-arg2-) -* [`chain.delay`](#_delayfunc-wait--arg1-arg2-) -* [`chain.memoize`](#_memoizefunc--resolver) -* [`chain.once`](#_oncefunc) -* [`chain.partial`](#_partialfunc--arg1-arg2-) -* [`chain.partialRight`](#_partialrightfunc--arg1-arg2-) -* [`chain.throttle`](#_throttlefunc-wait-options) -* [`chain.wrap`](#_wrapvalue-wrapper) +* [`_.after`](#_aftern-func) +* [`_.bind`](#_bindfunc--thisarg-arg1-arg2-) +* [`_.bindAll`](#_bindallobject--methodname1-methodname2-) +* [`_.bindKey`](#_bindkeyobject-key--arg1-arg2-) +* [`_.compose`](#_composefunc1-func2-) +* [`_.createCallback`](#_createcallbackfuncidentity-thisarg-argcount3) +* [`_.debounce`](#_debouncefunc-wait-options) +* [`_.defer`](#_deferfunc--arg1-arg2-) +* [`_.delay`](#_delayfunc-wait--arg1-arg2-) +* [`_.memoize`](#_memoizefunc--resolver) +* [`_.once`](#_oncefunc) +* [`_.partial`](#_partialfunc--arg1-arg2-) +* [`_.partialRight`](#_partialrightfunc--arg1-arg2-) +* [`_.throttle`](#_throttlefunc-wait-options) +* [`_.wrap`](#_wrapvalue-wrapper) @@ -111,41 +112,42 @@ ## `Objects` -* [`chain.assign`](#_assignobject--source1-source2--callback-thisarg) -* [`chain.clone`](#_clonevalue--deepfalse-callback-thisarg) -* [`chain.cloneDeep`](#_clonedeepvalue--callback-thisarg) -* [`chain.defaults`](#_defaultsobject--source1-source2-) -* [`chain.extend`](#_assignobject--source1-source2--callback-thisarg) -* [`chain.findKey`](#_findkeyobject--callbackidentity-thisarg) -* [`chain.forIn`](#_forinobject--callbackidentity-thisarg) -* [`chain.forOwn`](#_forownobject--callbackidentity-thisarg) -* [`chain.functions`](#_functionsobject) -* [`chain.has`](#_hasobject-property) -* [`chain.invert`](#_invertobject) -* [`chain.isArguments`](#_isargumentsvalue) -* [`chain.isArray`](#_isarrayvalue) -* [`chain.isBoolean`](#_isbooleanvalue) -* [`chain.isDate`](#_isdatevalue) -* [`chain.isElement`](#_iselementvalue) -* [`chain.isEmpty`](#_isemptyvalue) -* [`chain.isEqual`](#_isequala-b--callback-thisarg) -* [`chain.isFinite`](#_isfinitevalue) -* [`chain.isFunction`](#_isfunctionvalue) -* [`chain.isNaN`](#_isnanvalue) -* [`chain.isNull`](#_isnullvalue) -* [`chain.isNumber`](#_isnumbervalue) -* [`chain.isObject`](#_isobjectvalue) -* [`chain.isPlainObject`](#_isplainobjectvalue) -* [`chain.isRegExp`](#_isregexpvalue) -* [`chain.isString`](#_isstringvalue) -* [`chain.isUndefined`](#_isundefinedvalue) -* [`chain.keys`](#_keysobject) -* [`chain.merge`](#_mergeobject--source1-source2--callback-thisarg) -* [`chain.methods`](#_functionsobject) -* [`chain.omit`](#_omitobject-callback-prop1-prop2--thisarg) -* [`chain.pairs`](#_pairsobject) -* [`chain.pick`](#_pickobject-callback-prop1-prop2--thisarg) -* [`chain.values`](#_valuesobject) +* [`_.assign`](#_assignobject--source1-source2--callback-thisarg) +* [`_.clone`](#_clonevalue--deepfalse-callback-thisarg) +* [`_.cloneDeep`](#_clonedeepvalue--callback-thisarg) +* [`_.defaults`](#_defaultsobject--source1-source2-) +* [`_.extend`](#_assignobject--source1-source2--callback-thisarg) +* [`_.findKey`](#_findkeyobject--callbackidentity-thisarg) +* [`_.forIn`](#_forinobject--callbackidentity-thisarg) +* [`_.forOwn`](#_forownobject--callbackidentity-thisarg) +* [`_.functions`](#_functionsobject) +* [`_.has`](#_hasobject-property) +* [`_.invert`](#_invertobject) +* [`_.isArguments`](#_isargumentsvalue) +* [`_.isArray`](#_isarrayvalue) +* [`_.isBoolean`](#_isbooleanvalue) +* [`_.isDate`](#_isdatevalue) +* [`_.isElement`](#_iselementvalue) +* [`_.isEmpty`](#_isemptyvalue) +* [`_.isEqual`](#_isequala-b--callback-thisarg) +* [`_.isFinite`](#_isfinitevalue) +* [`_.isFunction`](#_isfunctionvalue) +* [`_.isNaN`](#_isnanvalue) +* [`_.isNull`](#_isnullvalue) +* [`_.isNumber`](#_isnumbervalue) +* [`_.isObject`](#_isobjectvalue) +* [`_.isPlainObject`](#_isplainobjectvalue) +* [`_.isRegExp`](#_isregexpvalue) +* [`_.isString`](#_isstringvalue) +* [`_.isUndefined`](#_isundefinedvalue) +* [`_.keys`](#_keysobject) +* [`_.merge`](#_mergeobject--source1-source2--callback-thisarg) +* [`_.methods`](#_functionsobject) +* [`_.omit`](#_omitobject-callback-prop1-prop2--thisarg) +* [`_.pairs`](#_pairsobject) +* [`_.pick`](#_pickobject-callback-prop1-prop2--thisarg) +* [`_.transform`](#_transformcollection--callbackidentity-accumulator-thisarg) +* [`_.values`](#_valuesobject) @@ -153,17 +155,18 @@ ## `Utilities` -* [`chain.escape`](#_escapestring) -* [`chain.identity`](#_identityvalue) -* [`chain.mixin`](#_mixinobject) -* [`chain.noConflict`](#_noconflict) -* [`chain.parseInt`](#_parseintvalue--radix) -* [`chain.random`](#_randommin0-max1) -* [`chain.result`](#_resultobject-property) -* [`chain.template`](#_templatetext-data-options) -* [`chain.times`](#_timesn-callback--thisarg) -* [`chain.unescape`](#_unescapestring) -* [`chain.uniqueId`](#_uniqueidprefix) +* [`_.escape`](#_escapestring) +* [`_.identity`](#_identityvalue) +* [`_.mixin`](#_mixinobject) +* [`_.noConflict`](#_noconflict) +* [`_.parseInt`](#_parseintvalue--radix) +* [`_.random`](#_randommin0-max1) +* [`_.result`](#_resultobject-property) +* [`_.runInContext`](#_runincontextcontextwindow) +* [`_.template`](#_templatetext-data-options) +* [`_.times`](#_timesn-callback--thisarg) +* [`_.unescape`](#_unescapestring) +* [`_.uniqueId`](#_uniqueidprefix) @@ -179,11 +182,11 @@ ## `Properties` -* [`chain.VERSION`](#_version) -* [`enumErrorProps`](#enumerrorprops) +* [`_.VERSION`](#_version) * [`_.support`](#_support) * [`_.support.argsClass`](#_supportargsclass) * [`_.support.argsObject`](#_supportargsobject) +* [`_.support.enumErrorProps`](#_supportenumerrorprops) * [`_.support.enumPrototypes`](#_supportenumprototypes) * [`_.support.fastBind`](#_supportfastbind) * [`_.support.nonEnumArgs`](#_supportnonenumargs) @@ -213,8 +216,8 @@ -### `chain.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3339 "View in source") [Ⓣ][1] +### `_.compact(array)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3410 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -237,8 +240,8 @@ _.compact([0, 1, false, 2, '', 3]); -### `chain.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3369 "View in source") [Ⓣ][1] +### `_.difference(array [, array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3440 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -262,8 +265,8 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); -### `chain.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3405 "View in source") [Ⓣ][1] +### `_.findIndex(array [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3476 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -290,8 +293,8 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { -### `chain.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3475 "View in source") [Ⓣ][1] +### `_.first(array [, callback|n, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3546 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -350,8 +353,8 @@ _.first(food, { 'type': 'fruit' }); -### `chain.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3537 "View in source") [Ⓣ][1] +### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3608 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -393,8 +396,8 @@ _.flatten(stooges, 'quotes'); -### `chain.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3590 "View in source") [Ⓣ][1] +### `_.indexOf(array, value [, fromIndex=0])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3661 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -425,8 +428,8 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); -### `chain.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3664 "View in source") [Ⓣ][1] +### `_.initial(array [, callback|n=1, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3735 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -482,8 +485,8 @@ _.initial(food, { 'type': 'vegetable' }); -### `chain.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3698 "View in source") [Ⓣ][1] +### `_.intersection([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3769 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -506,8 +509,8 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); -### `chain.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3790 "View in source") [Ⓣ][1] +### `_.last(array [, callback|n, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3861 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -563,8 +566,8 @@ _.last(food, { 'type': 'vegetable' }); -### `chain.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3831 "View in source") [Ⓣ][1] +### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3902 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -592,8 +595,8 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); -### `chain.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3872 "View in source") [Ⓣ][1] +### `_.range([start=0], end [, step=1])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3943 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -630,8 +633,8 @@ _.range(0); -### `chain.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3951 "View in source") [Ⓣ][1] +### `_.rest(array [, callback|n=1, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4022 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -690,8 +693,8 @@ _.rest(food, { 'type': 'fruit' }); -### `chain.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4015 "View in source") [Ⓣ][1] +### `_.sortedIndex(array, value [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4086 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -739,8 +742,8 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { -### `chain.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4047 "View in source") [Ⓣ][1] +### `_.union([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4118 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -763,8 +766,8 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); -### `chain.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4097 "View in source") [Ⓣ][1] +### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -810,8 +813,8 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); -### `chain.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4155 "View in source") [Ⓣ][1] +### `_.unzip(array)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4226 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -834,8 +837,8 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); -### `chain.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4181 "View in source") [Ⓣ][1] +### `_.without(array [, value1, value2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4252 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -859,8 +862,8 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); -### `chain.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4201 "View in source") [Ⓣ][1] +### `_.zip([array1, array2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4272 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -883,8 +886,8 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); -### `chain.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4223 "View in source") [Ⓣ][1] +### `_.zipObject(keys [, values=[]])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4294 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -918,8 +921,64 @@ _.zipObject(['moe', 'larry'], [30, 40]); -### `chain.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5297 "View in source") [Ⓣ][1] +### `_(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L309 "View in source") [Ⓣ][1] + +Creates a `lodash` object, which wraps the given `value`, to enable method chaining. + +In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
+`concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, and `unshift` + +Chaining is supported in custom builds as long as the `value` method is implicitly or explicitly included in the build. + +The chainable wrapper functions are:
+`after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, `compose`, `concat`, `countBy`, `createCallback`, `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forIn`, `forOwn`, `functions`, `groupBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`, `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, and `zip` + +The non-chainable wrapper functions are:
+`clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`, `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, `template`, `unescape`, `uniqueId`, and `value` + +The wrapper functions `first` and `last` return wrapped values when `n` is passed, otherwise they return unwrapped values. + +#### Aliases +*chain* + +#### Arguments +1. `value` *(Mixed)*: The value to wrap in a `lodash` instance. + +#### Returns +*(Object)*: Returns a `lodash` instance. + +#### Example +```js +var wrapped = _([1, 2, 3]); + +// returns an unwrapped value +wrapped.reduce(function(sum, num) { + return sum + num; +}); +// => 6 + +// returns a wrapped value +var squares = wrapped.map(function(num) { + return num * num; +}); + +_.isArray(squares); +// => false + +_.isArray(squares.value()); +// => true +``` + +* * * + + + + + + +### `_.tap(value, interceptor)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5368 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -948,8 +1007,8 @@ _([1, 2, 3, 4]) -### `chain.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5314 "View in source") [Ⓣ][1] +### `_.prototype.toString()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5385 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -969,8 +1028,8 @@ _([1, 2, 3]).toString(); -### `chain.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5331 "View in source") [Ⓣ][1] +### `_.prototype.valueOf()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5402 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1000,8 +1059,8 @@ _([1, 2, 3]).valueOf(); -### `chain.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2328 "View in source") [Ⓣ][1] +### `_.at(collection [, index1, index2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2399 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1028,8 +1087,8 @@ _.at(['moe', 'larry', 'curly'], 0, 2); -### `chain.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2370 "View in source") [Ⓣ][1] +### `_.contains(collection, target [, fromIndex=0])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2441 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1066,8 +1125,8 @@ _.contains('curly', 'ur'); -### `chain.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2424 "View in source") [Ⓣ][1] +### `_.countBy(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2495 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1102,8 +1161,8 @@ _.countBy(['one', 'two', 'three'], 'length'); -### `chain.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2476 "View in source") [Ⓣ][1] +### `_.every(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2547 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1148,8 +1207,8 @@ _.every(stooges, { 'age': 50 }); -### `chain.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2537 "View in source") [Ⓣ][1] +### `_.filter(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2608 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1194,8 +1253,8 @@ _.filter(food, { 'type': 'fruit' }); -### `chain.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2604 "View in source") [Ⓣ][1] +### `_.find(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2675 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1243,8 +1302,8 @@ _.find(food, 'organic'); -### `chain.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2651 "View in source") [Ⓣ][1] +### `_.forEach(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2722 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1275,8 +1334,8 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); -### `chain.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2701 "View in source") [Ⓣ][1] +### `_.groupBy(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1312,8 +1371,8 @@ _.groupBy(['one', 'two', 'three'], 'length'); -### `chain.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2734 "View in source") [Ⓣ][1] +### `_.invoke(collection, methodName [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2805 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1341,8 +1400,8 @@ _.invoke([123, 456], String.prototype.split, ''); -### `chain.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2786 "View in source") [Ⓣ][1] +### `_.map(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2857 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1386,8 +1445,8 @@ _.map(stooges, 'name'); -### `chain.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2843 "View in source") [Ⓣ][1] +### `_.max(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2914 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1428,8 +1487,8 @@ _.max(stooges, 'age'); -### `chain.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2912 "View in source") [Ⓣ][1] +### `_.min(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2983 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1470,8 +1529,8 @@ _.min(stooges, 'age'); -### `chain.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2962 "View in source") [Ⓣ][1] +### `_.pluck(collection, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3033 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1500,8 +1559,8 @@ _.pluck(stooges, 'name'); -### `chain.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2994 "View in source") [Ⓣ][1] +### `_.reduce(collection [, callback=identity, accumulator, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3065 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1538,8 +1597,8 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { -### `chain.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3037 "View in source") [Ⓣ][1] +### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3108 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1569,8 +1628,8 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); -### `chain.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3097 "View in source") [Ⓣ][1] +### `_.reject(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3168 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1612,8 +1671,8 @@ _.reject(food, { 'type': 'fruit' }); -### `chain.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3118 "View in source") [Ⓣ][1] +### `_.shuffle(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3189 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1636,8 +1695,8 @@ _.shuffle([1, 2, 3, 4, 5, 6]); -### `chain.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3151 "View in source") [Ⓣ][1] +### `_.size(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3222 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1666,8 +1725,8 @@ _.size('curly'); -### `chain.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3198 "View in source") [Ⓣ][1] +### `_.some(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3269 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1712,8 +1771,8 @@ _.some(food, { 'type': 'meat' }); -### `chain.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3254 "View in source") [Ⓣ][1] +### `_.sortBy(collection [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3325 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1749,8 +1808,8 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); -### `chain.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3289 "View in source") [Ⓣ][1] +### `_.toArray(collection)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3360 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1773,8 +1832,8 @@ Converts the `collection` to an array. -### `chain.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3321 "View in source") [Ⓣ][1] +### `_.where(collection, properties)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3392 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1810,8 +1869,8 @@ _.where(stooges, { 'age': 40 }); -### `chain.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4263 "View in source") [Ⓣ][1] +### `_.after(n, func)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4334 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1838,8 +1897,8 @@ _.forEach(notes, function(note) { -### `chain.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4296 "View in source") [Ⓣ][1] +### `_.bind(func [, thisArg, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4367 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1869,8 +1928,8 @@ func(); -### `chain.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4327 "View in source") [Ⓣ][1] +### `_.bindAll(object [, methodName1, methodName2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4398 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1900,8 +1959,8 @@ jQuery('#docs').on('click', view.onClick); -### `chain.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4373 "View in source") [Ⓣ][1] +### `_.bindKey(object, key [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4444 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -1941,8 +2000,8 @@ func(); -### `chain.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4396 "View in source") [Ⓣ][1] +### `_.compose([func1, func2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4467 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -1968,8 +2027,8 @@ welcome('moe'); -### `chain.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4455 "View in source") [Ⓣ][1] +### `_.createCallback([func=identity, thisArg, argCount=3])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4526 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2022,8 +2081,8 @@ _.toLookup(stooges, 'name'); -### `chain.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4531 "View in source") [Ⓣ][1] +### `_.debounce(func, wait, options)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4602 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2055,8 +2114,8 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { -### `chain.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4581 "View in source") [Ⓣ][1] +### `_.defer(func [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4652 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2080,8 +2139,8 @@ _.defer(function() { alert('deferred'); }); -### `chain.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4607 "View in source") [Ⓣ][1] +### `_.delay(func, wait [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4678 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2107,8 +2166,8 @@ _.delay(log, 1000, 'logged later'); -### `chain.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4631 "View in source") [Ⓣ][1] +### `_.memoize(func [, resolver])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4702 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2133,8 +2192,8 @@ var fibonacci = _.memoize(function(n) { -### `chain.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4661 "View in source") [Ⓣ][1] +### `_.once(func)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4732 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2159,8 +2218,8 @@ initialize(); -### `chain.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4696 "View in source") [Ⓣ][1] +### `_.partial(func [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4767 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2186,8 +2245,8 @@ hi('moe'); -### `chain.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4727 "View in source") [Ⓣ][1] +### `_.partialRight(func [, arg1, arg2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4798 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2223,8 +2282,8 @@ options.imports -### `chain.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4760 "View in source") [Ⓣ][1] +### `_.throttle(func, wait, options)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4831 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2255,8 +2314,8 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { -### `chain.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4825 "View in source") [Ⓣ][1] +### `_.wrap(value, wrapper)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4896 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2291,8 +2350,8 @@ hello(); -### `chain.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1134 "View in source") [Ⓣ][1] +### `_.assign(object [, source1, source2, ..., callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1155 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2329,8 +2388,8 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); -### `chain.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1189 "View in source") [Ⓣ][1] +### `_.clone(value [, deep=false, callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1210 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2376,8 +2435,8 @@ clone.childNodes.length; -### `chain.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1314 "View in source") [Ⓣ][1] +### `_.cloneDeep(value [, callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1335 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2422,8 +2481,8 @@ clone.node == view.node; -### `chain.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1338 "View in source") [Ⓣ][1] +### `_.defaults(object [, source1, source2, ...])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1359 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2448,8 +2507,8 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); -### `chain.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1360 "View in source") [Ⓣ][1] +### `_.findKey(object [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1381 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2476,8 +2535,8 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { -### `chain.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1401 "View in source") [Ⓣ][1] +### `_.forIn(object [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1422 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2512,8 +2571,8 @@ _.forIn(new Dog('Dagny'), function(value, key) { -### `chain.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1426 "View in source") [Ⓣ][1] +### `_.forOwn(object [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1447 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2540,8 +2599,8 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { -### `chain.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1443 "View in source") [Ⓣ][1] +### `_.functions(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1464 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2567,8 +2626,8 @@ _.functions(_); -### `chain.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1468 "View in source") [Ⓣ][1] +### `_.has(object, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1489 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2592,8 +2651,8 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); -### `chain.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1485 "View in source") [Ⓣ][1] +### `_.invert(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1506 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2616,8 +2675,8 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); -### `chain.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L997 "View in source") [Ⓣ][1] +### `_.isArguments(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1018 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2643,8 +2702,8 @@ _.isArguments([1, 2, 3]); -### `chain.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1023 "View in source") [Ⓣ][1] +### `_.isArray(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1044 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2670,8 +2729,8 @@ _.isArray([1, 2, 3]); -### `chain.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1511 "View in source") [Ⓣ][1] +### `_.isBoolean(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1532 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2694,8 +2753,8 @@ _.isBoolean(null); -### `chain.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1528 "View in source") [Ⓣ][1] +### `_.isDate(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1549 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2718,8 +2777,8 @@ _.isDate(new Date); -### `chain.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1545 "View in source") [Ⓣ][1] +### `_.isElement(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1566 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2742,8 +2801,8 @@ _.isElement(document.body); -### `chain.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1570 "View in source") [Ⓣ][1] +### `_.isEmpty(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1591 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2772,8 +2831,8 @@ _.isEmpty(''); -### `chain.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1629 "View in source") [Ⓣ][1] +### `_.isEqual(a, b [, callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1650 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2817,8 +2876,8 @@ _.isEqual(words, otherWords, function(a, b) { -### `chain.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1810 "View in source") [Ⓣ][1] +### `_.isFinite(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1831 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2855,8 +2914,8 @@ _.isFinite(Infinity); -### `chain.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1827 "View in source") [Ⓣ][1] +### `_.isFunction(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1848 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2879,8 +2938,8 @@ _.isFunction(_); -### `chain.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1890 "View in source") [Ⓣ][1] +### `_.isNaN(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1911 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2914,8 +2973,8 @@ _.isNaN(undefined); -### `chain.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1912 "View in source") [Ⓣ][1] +### `_.isNull(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1933 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -2941,8 +3000,8 @@ _.isNull(undefined); -### `chain.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1929 "View in source") [Ⓣ][1] +### `_.isNumber(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1950 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -2965,8 +3024,8 @@ _.isNumber(8.4 * 5); -### `chain.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1857 "View in source") [Ⓣ][1] +### `_.isObject(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1878 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -2995,8 +3054,8 @@ _.isObject(1); -### `chain.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1957 "View in source") [Ⓣ][1] +### `_.isPlainObject(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1978 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3030,8 +3089,8 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); -### `chain.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1982 "View in source") [Ⓣ][1] +### `_.isRegExp(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2003 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3054,8 +3113,8 @@ _.isRegExp(/moe/); -### `chain.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1999 "View in source") [Ⓣ][1] +### `_.isString(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2020 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3078,8 +3137,8 @@ _.isString('moe'); -### `chain.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2016 "View in source") [Ⓣ][1] +### `_.isUndefined(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2037 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3102,8 +3161,8 @@ _.isUndefined(void 0); -### `chain.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1056 "View in source") [Ⓣ][1] +### `_.keys(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1077 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3126,8 +3185,8 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); -### `chain.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2075 "View in source") [Ⓣ][1] +### `_.merge(object [, source1, source2, ..., callback, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2096 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3182,8 +3241,8 @@ _.merge(food, otherFood, function(a, b) { -### `chain.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2184 "View in source") [Ⓣ][1] +### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2205 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3213,8 +3272,8 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { -### `chain.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2218 "View in source") [Ⓣ][1] +### `_.pairs(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2239 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3237,8 +3296,8 @@ _.pairs({ 'moe': 30, 'larry': 40 }); -### `chain.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2256 "View in source") [Ⓣ][1] +### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2277 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3268,8 +3327,45 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { -### `chain.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2293 "View in source") [Ⓣ][1] +### `_.transform(collection [, callback=identity, accumulator, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2331 "View in source") [Ⓣ][1] + +Transforms an `object` to an new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback`is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. + +#### Arguments +1. `collection` *(Array|Object)*: The collection to iterate over. +2. `[callback=identity]` *(Function)*: The function called per iteration. +3. `[accumulator]` *(Mixed)*: The custom accumulator value. +4. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. + +#### Returns +*(Mixed)*: Returns the accumulated value. + +#### Example +```js +var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { + num *= num; + if (num % 2) { + return result.push(num) < 3; + } +}); +// => [1, 9, 25] + +var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { + result[key] = num * 3; +}); +// => { 'a': 3, 'b': 6, 'c': 9 } +``` + +* * * + + + + + + +### `_.values(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2364 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3299,8 +3395,8 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); -### `chain.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4849 "View in source") [Ⓣ][1] +### `_.escape(string)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4920 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3323,8 +3419,8 @@ _.escape('Moe, Larry & Curly'); -### `chain.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4867 "View in source") [Ⓣ][1] +### `_.identity(value)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4938 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3348,8 +3444,8 @@ moe === _.identity(moe); -### `chain.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4893 "View in source") [Ⓣ][1] +### `_.mixin(object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4964 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3378,8 +3474,8 @@ _('moe').capitalize(); -### `chain.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4922 "View in source") [Ⓣ][1] +### `_.noConflict()` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4993 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3398,8 +3494,8 @@ var lodash = _.noConflict(); -### `chain.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4946 "View in source") [Ⓣ][1] +### `_.parseInt(value [, radix])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5017 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3425,8 +3521,8 @@ _.parseInt('08'); -### `chain.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4969 "View in source") [Ⓣ][1] +### `_.random([min=0, max=1])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5040 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3453,8 +3549,8 @@ _.random(5); -### `chain.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5013 "View in source") [Ⓣ][1] +### `_.result(object, property)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5084 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3488,8 +3584,26 @@ _.result(object, 'stuff'); -### `chain.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5097 "View in source") [Ⓣ][1] +### `_.runInContext([context=window])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L150 "View in source") [Ⓣ][1] + +Create a new `lodash` function using the given `context` object. + +#### Arguments +1. `[context=window]` *(Object)*: The context object. + +#### Returns +*(Function)*: Returns the `lodash` function. + +* * * + + + + + + +### `_.template(text, data, options)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5168 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3570,8 +3684,8 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ -### `chain.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5222 "View in source") [Ⓣ][1] +### `_.times(n, callback [, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5293 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3602,8 +3716,8 @@ _.times(3, function(n) { this.cast(n); }, mage); -### `chain.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5249 "View in source") [Ⓣ][1] +### `_.unescape(string)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5320 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3626,8 +3740,8 @@ _.unescape('Moe, Larry & Curly'); -### `chain.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5269 "View in source") [Ⓣ][1] +### `_.uniqueId([prefix])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5340 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3661,7 +3775,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L504 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L505 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3679,8 +3793,8 @@ A reference to the `lodash` function. -### `chain.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5507 "View in source") [Ⓣ][1] +### `_.VERSION` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5582 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3689,18 +3803,6 @@ A reference to the `lodash` function. - - -### `enumErrorProps` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L356 "View in source") [Ⓣ][1] - -*(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* - -* * * - - - - ### `_.support` @@ -3737,10 +3839,22 @@ A reference to the `lodash` function. + + +### `_.support.enumErrorProps` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L357 "View in source") [Ⓣ][1] + +*(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* + +* * * + + + + ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L369 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L370 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3754,7 +3868,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L377 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L378 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3766,7 +3880,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L394 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L395 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3778,7 +3892,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L405 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L406 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3792,7 +3906,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L385 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L386 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3804,7 +3918,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L419 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L420 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3818,7 +3932,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L430 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L431 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3832,7 +3946,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L456 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L457 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3844,7 +3958,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L464 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L465 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3856,7 +3970,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L472 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L473 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3868,7 +3982,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L480 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L481 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3880,7 +3994,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L488 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L489 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -3892,7 +4006,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L496 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L497 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. diff --git a/vendor/benchmark.js/README.md b/vendor/benchmark.js/README.md index d2a03e3fe6..cb10e88eae 100644 --- a/vendor/benchmark.js/README.md +++ b/vendor/benchmark.js/README.md @@ -15,7 +15,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best ## Support -Benchmark.js has been tested in at least Chrome 5~26, Firefox 2~20, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. +Benchmark.js has been tested in at least Chrome 5~26, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. ## Installation and usage diff --git a/vendor/benchmark.js/benchmark.js b/vendor/benchmark.js/benchmark.js index 4a48ab9b5a..cb22503dff 100644 --- a/vendor/benchmark.js/benchmark.js +++ b/vendor/benchmark.js/benchmark.js @@ -1675,7 +1675,7 @@ // start timer 't#.start(d#);' + // execute `deferred.fn` and return a dummy object - '}d#.fn();return{}' + '}d#.fn();return{uid:"${uid}"}' : 'var r#,s#,m#=this,f#=m#.fn,i#=m#.count,n#=t#.ns;${setup}\n${begin};' + 'while(i#--){${fn}\n}${end};${teardown}\nreturn{elapsed:r#,uid:"${uid}"}' diff --git a/vendor/docdown/src/DocDown/Generator.php b/vendor/docdown/src/DocDown/Generator.php index 691d92e92b..285a925282 100644 --- a/vendor/docdown/src/DocDown/Generator.php +++ b/vendor/docdown/src/DocDown/Generator.php @@ -321,9 +321,7 @@ public function generate() { $api[$member] = $entry; foreach ($entry->getAliases() as $alias) { - $api[$member] = $alias; - $alias->static = array(); - $alias->plugin = array(); + $api[$member]->static[] = $alias; } } else if ($entry->isStatic()) { diff --git a/vendor/platform.js/README.md b/vendor/platform.js/README.md index a1f06caffd..53ef14fc3f 100644 --- a/vendor/platform.js/README.md +++ b/vendor/platform.js/README.md @@ -18,7 +18,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best ## Support -Platform.js has been tested in at least Chrome 5~26, Firefox 2~20, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. +Platform.js has been tested in at least Chrome 5~26, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. ## Installation and usage diff --git a/vendor/requirejs/require.js b/vendor/requirejs/require.js index 062516acd9..2109a25149 100644 --- a/vendor/requirejs/require.js +++ b/vendor/requirejs/require.js @@ -1,5 +1,5 @@ /** vim: et:ts=4:sw=4:sts=4 - * @license RequireJS 2.1.5 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. + * @license RequireJS 2.1.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details */ @@ -12,7 +12,7 @@ var requirejs, require, define; (function (global) { var req, s, head, baseElement, dataMain, src, interactiveScript, currentlyAddingScript, mainScript, subPath, - version = '2.1.5', + version = '2.1.6', commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, jsSuffixRegExp = /\.js$/, @@ -22,7 +22,7 @@ var requirejs, require, define; hasOwn = op.hasOwnProperty, ap = Array.prototype, apsp = ap.splice, - isBrowser = !!(typeof window !== 'undefined' && navigator && document), + isBrowser = !!(typeof window !== 'undefined' && navigator && window.document), isWebWorker = !isBrowser && typeof importScripts !== 'undefined', //PS3 indicates loaded and complete, but need to wait for complete //specifically. Sequence is 'loading', 'loaded', execution, @@ -134,6 +134,10 @@ var requirejs, require, define; return document.getElementsByTagName('script'); } + function defaultOnError(err) { + throw err; + } + //Allow getting a global that expressed in //dot notation, like 'a.b.c'. function getGlobal(value) { @@ -500,7 +504,12 @@ var requirejs, require, define; fn(defined[id]); } } else { - getModule(depMap).on(name, fn); + mod = getModule(depMap); + if (mod.error && name === 'error') { + fn(mod.error); + } else { + mod.on(name, fn); + } } } @@ -571,7 +580,13 @@ var requirejs, require, define; id: mod.map.id, uri: mod.map.url, config: function () { - return (config.config && getOwn(config.config, mod.map.id)) || {}; + var c, + pkg = getOwn(config.pkgs, mod.map.id); + // For packages, only support config targeted + // at the main module. + c = pkg ? getOwn(config.config, mod.map.id + '/' + pkg.main) : + getOwn(config.config, mod.map.id); + return c || {}; }, exports: defined[mod.map.id] }); @@ -840,8 +855,13 @@ var requirejs, require, define; if (this.depCount < 1 && !this.defined) { if (isFunction(factory)) { //If there is an error listener, favor passing - //to that instead of throwing an error. - if (this.events.error) { + //to that instead of throwing an error. However, + //only do it for define()'d modules. require + //errbacks should not be called for failures in + //their callbacks (#699). However if a global + //onError is set, use that. + if ((this.events.error && this.map.isDefine) || + req.onError !== defaultOnError) { try { exports = context.execCb(id, factory, depExports, exports); } catch (e) { @@ -869,8 +889,8 @@ var requirejs, require, define; if (err) { err.requireMap = this.map; - err.requireModules = [this.map.id]; - err.requireType = 'define'; + err.requireModules = this.map.isDefine ? [this.map.id] : null; + err.requireType = this.map.isDefine ? 'define' : 'require'; return onError((this.error = err)); } @@ -1093,7 +1113,7 @@ var requirejs, require, define; })); if (this.errback) { - on(depMap, 'error', this.errback); + on(depMap, 'error', bind(this, this.errback)); } } @@ -1605,7 +1625,7 @@ var requirejs, require, define; }, /** - * Executes a module callack function. Broken out as a separate function + * Executes a module callback function. Broken out as a separate function * solely to allow the build system to sequence the files in the built * layer in the right sequence. * @@ -1643,7 +1663,7 @@ var requirejs, require, define; onScriptError: function (evt) { var data = getScriptData(evt); if (!hasPathFallback(data.id)) { - return onError(makeError('scripterror', 'Script error', evt, [data.id])); + return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id])); } } }; @@ -1772,9 +1792,7 @@ var requirejs, require, define; * function. Intercept/override it if you want custom error handling. * @param {Error} err the error object. */ - req.onError = function (err) { - throw err; - }; + req.onError = defaultOnError; /** * Does the request to load a module for the browser case. @@ -1906,24 +1924,31 @@ var requirejs, require, define; //baseUrl, if it is not already set. dataMain = script.getAttribute('data-main'); if (dataMain) { + //Preserve dataMain in case it is a path (i.e. contains '?') + mainScript = dataMain; + //Set final baseUrl if there is not already an explicit one. if (!cfg.baseUrl) { //Pull off the directory of data-main for use as the //baseUrl. - src = dataMain.split('/'); + src = mainScript.split('/'); mainScript = src.pop(); subPath = src.length ? src.join('/') + '/' : './'; cfg.baseUrl = subPath; - dataMain = mainScript; } - //Strip off any trailing .js since dataMain is now + //Strip off any trailing .js since mainScript is now //like a module name. - dataMain = dataMain.replace(jsSuffixRegExp, ''); + mainScript = mainScript.replace(jsSuffixRegExp, ''); + + //If mainScript is still a path, fall back to dataMain + if (req.jsExtRegExp.test(mainScript)) { + mainScript = dataMain; + } //Put the data-main script in the files to load. - cfg.deps = cfg.deps ? cfg.deps.concat(dataMain) : [dataMain]; + cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript]; return true; } @@ -1951,12 +1976,13 @@ var requirejs, require, define; //This module may not have dependencies if (!isArray(deps)) { callback = deps; - deps = []; + deps = null; } //If no name, and callback is a function, then figure out if it a //CommonJS thing with dependencies. - if (!deps.length && isFunction(callback)) { + if (!deps && isFunction(callback)) { + deps = []; //Remove comments from the callback string, //look for require calls, and pull them into the dependencies, //but only if there are function args. diff --git a/vendor/underscore/underscore-min.js b/vendor/underscore/underscore-min.js index 603aeb330c..9e669d307c 100644 --- a/vendor/underscore/underscore-min.js +++ b/vendor/underscore/underscore-min.js @@ -3,4 +3,4 @@ // (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc. // (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Underscore may be freely distributed under the MIT license. -(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,d=e.filter,m=e.every,g=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.4";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},w.find=w.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:m&&n.every===m?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:g&&n.some===g?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2),e=w.isFunction(t);return w.map(n,function(n){return(e?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t,r){return w.isEmpty(t)?r?void 0:[]:w[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.findWhere=function(n,t){return w.where(n,t,!0)},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var k=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=k(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.indexi;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(c.apply(e,arguments))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){for(var n=o.call(arguments),t=w.max(w.pluck(n,"length")),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.unzip=function(n){var t=w.max(w.pluck(n,"length"));return w.times(t,w.partial(w.pluck,n))},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i};var M=function(){};w.bind=function(n,t){var r,e;if(n.bind===j&&j)return j.apply(n,o.call(arguments,1));if(!w.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));M.prototype=n.prototype;var u=new M;M.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},w.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},w.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw Error("bindAll must be passed function names");return A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t,r){var e,u,i,a,o=0,c=function(){o=new Date,i=null,a=n.apply(e,u)};return function(){var l=new Date;o||r!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(i),i=null,o=l,a=n.apply(e,u)):i||(i=setTimeout(c,f)),a}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&t.push(r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var I=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=I(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&I(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return I(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),"function"!=typeof/./&&(w.isFunction=function(n){return"function"==typeof n}),w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return n===void 0},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var S={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};S.unescape=w.invert(S.escape);var T={escape:RegExp("["+w.keys(S.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(S.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return S[n][t]})}}),w.result=function(n,t){if(null==n)return void 0;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=++N+"";return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){var e;r=w.defaults({},r,w.templateSettings);var u=RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(z,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,w);var c=function(n){return e.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},w.chain=function(n){return w(n).chain()};var D=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this); \ No newline at end of file +(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,d=e.filter,m=e.every,g=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.4";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},w.find=w.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:m&&n.every===m?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:g&&n.some===g?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2),e=w.isFunction(t);return w.map(n,function(n){return(e?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t,r){return w.isEmpty(t)?r?void 0:[]:w[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.findWhere=function(n,t){return w.where(n,t,!0)},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var F=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=F(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.indexi;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)||w.isArguments(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(w.flatten(arguments,!0))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){return w.unzip(o.call(arguments))},w.unzip=function(n){for(var t=w.max(w.pluck(n,"length").concat(0)),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i};var M=function(){};w.bind=function(n,t){var r,e;if(n.bind===j&&j)return j.apply(n,o.call(arguments,1));if(!w.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));M.prototype=n.prototype;var u=new M;M.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},w.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},w.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw Error("bindAll must be passed function names");return A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t,r){var e,u,i,a,o=0,c=function(){o=new Date,i=null,a=n.apply(e,u)};return function(){var l=new Date;o||r!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(i),i=null,o=l,a=n.apply(e,u)):i||(i=setTimeout(c,f)),a}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&t.push(r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var I=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=I(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&I(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return I(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),"function"!=typeof/./&&(w.isFunction=function(n){return"function"==typeof n}),w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return n===void 0},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var S={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};S.unescape=w.invert(S.escape);var T={escape:RegExp("["+w.keys(S.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(S.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return S[n][t]})}}),w.result=function(n,t){if(null==n)return void 0;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=++N+"";return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){var e;r=w.defaults({},r,w.templateSettings);var u=RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(z,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,w);var c=function(n){return e.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},w.chain=function(n){return w(n).chain()};var D=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this); \ No newline at end of file diff --git a/vendor/underscore/underscore.js b/vendor/underscore/underscore.js index 7b116b1042..b01e3c91aa 100644 --- a/vendor/underscore/underscore.js +++ b/vendor/underscore/underscore.js @@ -365,7 +365,7 @@ return low; }; - // Safely convert anything iterable into a real, live array. + // Safely create a real, live array from anything iterable. _.toArray = function(obj) { if (!obj) return []; if (_.isArray(obj)) return slice.call(obj); @@ -425,7 +425,7 @@ // Internal implementation of a recursive `flatten` function. var flatten = function(input, shallow, output) { each(input, function(value) { - if (_.isArray(value)) { + if (_.isArray(value) || _.isArguments(value)) { shallow ? push.apply(output, value) : flatten(value, shallow, output); } else { output.push(value); @@ -468,7 +468,7 @@ // Produce an array that contains the union: each distinct element from all of // the passed-in arrays. _.union = function() { - return _.uniq(concat.apply(ArrayProto, arguments)); + return _.uniq(_.flatten(arguments, true)); }; // Produce an array that contains every item shared between all the @@ -492,13 +492,7 @@ // Zip together multiple lists into a single array -- elements that share // an index go together. _.zip = function() { - var args = slice.call(arguments); - var length = _.max(_.pluck(args, 'length')); - var results = new Array(length); - for (var i = 0; i < length; i++) { - results[i] = _.pluck(args, "" + i); - } - return results; + return _.unzip(slice.call(arguments)); }; // The inverse operation to `_.zip`. If given an array of pairs it @@ -507,9 +501,13 @@ // three element array and so on. For example, `_.unzip` given // `[['a',1],['b',2],['c',3]]` returns the array // [['a','b','c'],[1,2,3]]. - _.unzip = function(tuples) { - var maxLen = _.max(_.pluck(tuples, "length")) - return _.times(maxLen, _.partial(_.pluck, tuples)); + _.unzip = function(list) { + var length = _.max(_.pluck(list, "length").concat(0)); + var results = new Array(length); + for (var i = 0; i < length; i++) { + results[i] = _.pluck(list, '' + i); + } + return results; }; // Converts lists into objects. Pass either a single array of `[key, value]` From 14a447b3d8376169200d6c437330aa2a398a12b8 Mon Sep 17 00:00:00 2001 From: Kit Cambridge Date: Sun, 19 May 2013 14:14:33 -0700 Subject: [PATCH 046/117] Ensure that the `javaOptions` are set correctly, as `exec` is asynchronous. Previously, the `java` command would execute on the next tick and update the `javaOptions` array, which could occur prior to the invocation of the Closure Compiler on the current tick. This has now been refactored into a separate `getJavaOptions` function, which passes the `javaOptions` array to a callback. `getJavaOptions` is defined lazily; after the first invocation, the options are cached and passed to all subsequent callbacks. The callbacks are invoked on the next tick for compatibility with `exec`. Former-commit-id: 89ca63c9edb3df3d4fcbbaa64e06075495febfd0 --- build/minify.js | 126 +++++++++++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 54 deletions(-) diff --git a/build/minify.js b/build/minify.js index 31ed8f89ec..4d9c8997f1 100755 --- a/build/minify.js +++ b/build/minify.js @@ -60,15 +60,30 @@ }()); /** - * Java command-line options used for faster minification. + * Retrieves the Java command-line options used for faster minification by + * the Closure Compiler, invoking the `callback` when finished. Subsequent + * invocations will lazily return the original options. The callback is + * invoked with one argument: `(javaOptions)`. + * * See https://code.google.com/p/closure-compiler/wiki/FAQ#What_are_the_recommended_Java_VM_command-line_options?. + * + * @param {Function} callback The function called once the options have + * been retrieved. */ - var javaOptions = []; - cp.exec('java -version -client -d32', function(error) { - if (!error && process.platform != 'win32') { - javaOptions.push('-client', '-d32'); - } - }); + function getJavaOptions(callback) { + var javaOptions = []; + cp.exec('java -version -client -d32', function(error) { + if (!error && process.platform != 'win32') { + javaOptions.push('-client', '-d32'); + } + getJavaOptions = function getJavaOptions(callback) { + process.nextTick(function () { + callback(javaOptions); + }); + }; + callback(javaOptions); + }); + } /** The Closure Compiler optimization modes */ var optimizationModes = { @@ -386,57 +401,60 @@ if (isMapped) { options.push('--create_source_map=' + mapPath, '--source_map_format=V3'); } - var compiler = cp.spawn('java', javaOptions.concat('-jar', closurePath, options)); - if (!this.isSilent) { - console.log('Compressing ' + path.basename(outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...'); - } - var error = ''; - compiler.stderr.on('data', function(data) { - error += data; - }); + getJavaOptions(function onJavaOptions(javaOptions) { + var compiler = cp.spawn('java', javaOptions.concat('-jar', closurePath, options)); + if (!this.isSilent) { + console.log('Compressing ' + path.basename(outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...'); + } - var output = ''; - compiler.stdout.on('data', function(data) { - output += data; - }); + var error = ''; + compiler.stderr.on('data', function(data) { + error += data; + }); - compiler.on('exit', function(status) { - // `status` contains the process exit code - if (status) { - var exception = new Error(error); - exception.status = status; - } - // restore IIFE and move exposed vars inside the IIFE - if (hasIIFE && isAdvanced) { - output = output - .replace(/__iife__\(/, '(') - .replace(/,\s*this\)([\s;]*(\n\/\/.+)?)$/, '(this))$1') - .replace(/^((?:var (?:\w+=(?:!0|!1|null)[,;])+)?)([\s\S]*?function[^{]+{)/, '$2$1'); - } - // inject "use strict" directive - if (isStrict) { - output = output.replace(/^[\s\S]*?function[^{]+{/, '$&"use strict";'); - } - // restore copyright header - if (license) { - output = license + output; - } - if (isMapped) { - var mapOutput = fs.readFileSync(mapPath, 'utf8'); - fs.unlinkSync(mapPath); - output = output.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + sourceMapURL) + '\n*/'; - - mapOutput = JSON.parse(mapOutput); - mapOutput.file = path.basename(outputPath); - mapOutput.sources = [path.basename(filePath)]; - mapOutput = JSON.stringify(mapOutput, null, 2); - } - callback(exception, output, mapOutput); - }); + var output = ''; + compiler.stdout.on('data', function(data) { + output += data; + }); + + compiler.on('exit', function(status) { + // `status` contains the process exit code + if (status) { + var exception = new Error(error); + exception.status = status; + } + // restore IIFE and move exposed vars inside the IIFE + if (hasIIFE && isAdvanced) { + output = output + .replace(/__iife__\(/, '(') + .replace(/,\s*this\)([\s;]*(\n\/\/.+)?)$/, '(this))$1') + .replace(/^((?:var (?:\w+=(?:!0|!1|null)[,;])+)?)([\s\S]*?function[^{]+{)/, '$2$1'); + } + // inject "use strict" directive + if (isStrict) { + output = output.replace(/^[\s\S]*?function[^{]+{/, '$&"use strict";'); + } + // restore copyright header + if (license) { + output = license + output; + } + if (isMapped) { + var mapOutput = fs.readFileSync(mapPath, 'utf8'); + fs.unlinkSync(mapPath); + output = output.replace(/[\s;]*$/, '\n/*\n//@ sourceMappingURL=' + sourceMapURL) + '\n*/'; + + mapOutput = JSON.parse(mapOutput); + mapOutput.file = path.basename(outputPath); + mapOutput.sources = [path.basename(filePath)]; + mapOutput = JSON.stringify(mapOutput, null, 2); + } + callback(exception, output, mapOutput); + }); - // proxy the standard input to the Closure Compiler - compiler.stdin.end(source); + // proxy the standard input to the Closure Compiler + compiler.stdin.end(source); + }.bind(this)); } /** From 16242f98ce67315bc6a22e4bec1df7190fc47e0d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 14:23:35 -0700 Subject: [PATCH 047/117] Ensure `each` is converted to `forEach` when used in a ternary operation. Former-commit-id: ff42e367f9987726fd561037337081c63c7a5100 --- build.js | 1 + dist/lodash.compat.js | 2 +- dist/lodash.compat.min.js | 2 +- dist/lodash.js | 2 +- dist/lodash.min.js | 2 +- lodash.js | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build.js b/build.js index 3639599813..5667f5dbe9 100755 --- a/build.js +++ b/build.js @@ -2806,6 +2806,7 @@ .replace(matchFunction(source, 'each'), '') .replace(/^ *lodash\._each *=.+\n/gm, '') .replace(/\beach(?=\(collection)/g, 'forOwn') + .replace(/(\?\s*)each(?=\s*:)/g, '$1forEach') .replace(/\beach(?=\(\[)/g, 'forEach'); } // modify `_.contains`, `_.every`, `_.find`, and `_.some` to use the private `indicatorObject` diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 69093708a2..a9e9aa053f 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -1266,7 +1266,7 @@ stackB.push(result); // recursively populate clone (susceptible to call stack limits) - (isArr ? forEach : forOwn)(value, function(objValue, key) { + (isArr ? each : forOwn)(value, function(objValue, key) { result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); }); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 93f23c31ab..5282039bf2 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -9,7 +9,7 @@ return a||(n=t[i]),r.length&&(e=e.length?(e=mr.call(e),c?e.concat(r):r.concat(e) var u=[];if(wr.enumPrototypes&&u.push('!(E&&m=="prototype")'),wr.enumErrorProps&&u.push('!(D&&(m=="message"||m=="name"))'),t.i&&t.j)e+="var A=-1,B=z[typeof r]?t(r):[],s=B.length;while(++Ak;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; e+="}"}return(t.b||wr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(A,Kt,tr,Z,Er,it,Sr,a,Mt,$,Cr,z,Ut,or)}function J(n){return at(n)?cr(n):{}}function K(n){return"\\"+q[n]}function M(n){return Ir[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function Q(){}function W(n){var t=!1;if(!n||or.call(n)!=N||!wr.argsClass&&Z(n))return t;var r=n.constructor;return(ut(r)?r instanceof r:wr.nodeClass||!U(n))?wr.ownLast?(zr(n,function(n,r,e){return t=tr.call(e,r),!1 }),!0===t):(zr(n,function(n,r){t=r}),!1===t||tr.call(n,t)):t}function X(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=zt(0>r?0:r);++ee?se(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r; diff --git a/lodash.js b/lodash.js index 0815e46d37..57b247b72f 100644 --- a/lodash.js +++ b/lodash.js @@ -1284,7 +1284,7 @@ stackB.push(result); // recursively populate clone (susceptible to call stack limits) - (isArr ? forEach : forOwn)(value, function(objValue, key) { + (isArr ? each : forOwn)(value, function(objValue, key) { result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); }); From e7bad106632a8d5b1d40f8cbe85395be4fec47cc Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 14:28:23 -0700 Subject: [PATCH 048/117] Ensure mobile builds pass unit tests. Former-commit-id: 31b4eb76c90f375069ef4a73aa7e3fdbcbda069d --- build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.js b/build.js index 5667f5dbe9..a551a105f6 100755 --- a/build.js +++ b/build.js @@ -3158,7 +3158,7 @@ if (_.size(source.match(/\bfreeExports\b/g)) < 2) { source = removeVar(source, 'freeExports'); } - if (!/^ *support\.(?:skipErrorProps|nonEnumShadows) *=/m.test(source)) { + if (!/^ *support\.(?:enumErrorProps|nonEnumShadows) *=/m.test(source)) { source = removeVar(source, 'Error'); source = removeVar(source, 'errorProto'); source = removeFromCreateIterator(source, 'errorClass'); From 010c26e7168d42ae4c7ea4b917809d46423150f4 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 19 May 2013 19:21:11 -0700 Subject: [PATCH 049/117] Replace `cachedContains` with `createCache` and further optimize linear array searches. Former-commit-id: bfe905985c9125cbadfcf111ffd97b6f8ecdd58d --- lodash.js | 112 +++++++++++++++++++++++++++++++++------------------ perf/perf.js | 52 +++++++++++++++++++++++- 2 files changed, 122 insertions(+), 42 deletions(-) diff --git a/lodash.js b/lodash.js index 57b247b72f..8a7ff787d3 100644 --- a/lodash.js +++ b/lodash.js @@ -33,7 +33,7 @@ var keyPrefix = +new Date + ''; /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 200; + var largeArraySize = 75; /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, @@ -662,26 +662,72 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - function cachedContains(array) { - var length = array.length, - isLarge = length >= largeArraySize; - - if (isLarge) { - var cache = {}, - index = -1; + function createCache(array) { + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; + + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; - while (++index < length) { - var key = keyPrefix + array[index]; - (cache[key] || (cache[key] = [])).push(array[index]); + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? indexOf(cache[key], value) > -1 : false) + : !!cache[key]; } - return function(value) { - if (isLarge) { - var key = keyPrefix + value; - return cache[key] && indexOf(cache[key], value) > -1; + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } } + } + + function simpleContains(value) { return indexOf(array, value) > -1; } + + function simplePush(value) { + array.push(value); + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'push': simplePush, 'contains' : simpleContains }; } /** @@ -3441,7 +3487,7 @@ var index = -1, length = array ? array.length : 0, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - contains = cachedContains(flattened), + contains = createCache(flattened).contains, result = []; while (++index < length) { @@ -3769,29 +3815,21 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = { '0': {} }, + cache = createCache([]), + caches = {}, index = -1, length = array ? array.length : 0, isLarge = length >= largeArraySize, - result = [], - seen = result; + result = []; outer: while (++index < length) { var value = array[index]; - if (isLarge) { - var key = keyPrefix + value; - var inited = cache[0][key] - ? !(seen = cache[0][key]) - : (seen = cache[0][key] = []); - } - if (inited || indexOf(seen, value) < 0) { - if (isLarge) { - seen.push(value); - } + if (!cache.contains(value)) { var argsIndex = argsLength; + cache.push(value); while (--argsIndex) { - if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) { + if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) { continue outer; } } @@ -4179,26 +4217,20 @@ } // init value cache for large arrays var isLarge = !isSorted && length >= largeArraySize; - if (isLarge) { - var cache = {}; - } if (callback != null) { seen = []; callback = lodash.createCallback(callback, thisArg); } + if (isLarge) { + seen = createCache([]); + } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; - if (isLarge) { - var key = keyPrefix + computed; - var inited = cache[key] - ? !(seen = cache[key]) - : (seen = cache[key] = []); - } if (isSorted ? !index || seen[seen.length - 1] !== computed - : inited || indexOf(seen, computed) < 0 + : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); diff --git a/perf/perf.js b/perf/perf.js index dd27c2ce2a..cfcfeedbf5 100644 --- a/perf/perf.js +++ b/perf/perf.js @@ -775,6 +775,18 @@ ) ); + suites.push( + Benchmark.Suite('`_.difference` iterating 75 elements') + .add(buildName, { + 'fn': 'lodash.difference(seventyFiveValues, seventyFiveValues2)', + 'teardown': 'function multiArrays(){}' + }) + .add(otherName, { + 'fn': '_.difference(seventyFiveValues, seventyFiveValues2)', + 'teardown': 'function multiArrays(){}' + }) + ); + suites.push( Benchmark.Suite('`_.difference` iterating 200 elements') .add(buildName, { @@ -1076,6 +1088,18 @@ ) ); + suites.push( + Benchmark.Suite('`_.intersection` iterating 75 elements') + .add(buildName, { + 'fn': 'lodash.intersection(seventyFiveValues, seventyFiveValues2)', + 'teardown': 'function multiArrays(){}' + }) + .add(otherName, { + 'fn': '_.intersection(seventyFiveValues, seventyFiveValues2)', + 'teardown': 'function multiArrays(){}' + }) + ); + suites.push( Benchmark.Suite('`_.intersection` iterating 200 elements') .add(buildName, { @@ -1731,11 +1755,23 @@ suites.push( Benchmark.Suite('`_.union` iterating an array of 75 elements') .add(buildName, { - 'fn': 'lodash.union(fiftyValues, twentyFiveValues2)', + 'fn': 'lodash.union(twentyFiveValues, fiftyValues2)', 'teardown': 'function multiArrays(){}' }) .add(otherName, { - 'fn': '_.union(fiftyValues, twentyFiveValues2)', + 'fn': '_.union(twentyFiveValues, fiftyValues2)', + 'teardown': 'function multiArrays(){}' + }) + ); + + suites.push( + Benchmark.Suite('`_.union` iterating an array of 200 elements') + .add(buildName, { + 'fn': 'lodash.union(oneHundredValues, oneHundredValues2)', + 'teardown': 'function multiArrays(){}' + }) + .add(otherName, { + 'fn': '_.union(oneHundredValues, oneHundredValues2)', 'teardown': 'function multiArrays(){}' }) ); @@ -1766,6 +1802,18 @@ ) ); + suites.push( + Benchmark.Suite('`_.uniq` iterating an array of 75 elements') + .add(buildName, { + 'fn': 'lodash.uniq(twentyFiveValues.concat(fiftyValues2))', + 'teardown': 'function multiArrays(){}' + }) + .add(otherName, { + 'fn': '_.uniq(twentyFiveValues.concat(fiftyValues2))', + 'teardown': 'function multiArrays(){}' + }) + ); + suites.push( Benchmark.Suite('`_.uniq` iterating an array of 200 elements') .add(buildName, { From 242e8a3bd682003a46cda0762b7f3f9593f07340 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 20 May 2013 08:44:12 -0700 Subject: [PATCH 050/117] Fix typo left out of the "legacy include=defer" patch. Former-commit-id: cf8f3e072534a925bdf6a0ebdee65d1280f7d29e --- build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.js b/build.js index a551a105f6..e677ca85f2 100755 --- a/build.js +++ b/build.js @@ -2000,7 +2000,7 @@ // replace `_.isPlainObject` with `shimIsPlainObject` source = source.replace( matchFunction(source, 'isPlainObject').replace(/[\s\S]+?var isPlainObject *= */, ''), - matchFunction(source, 'shimIsPlainObject').replace(/[\s\S]+?function shimIsPlainObject/, 'function').replace(/\s*$/, '') + matchFunction(source, 'shimIsPlainObject').replace(/[\s\S]+?function shimIsPlainObject/, 'function').replace(/\s*$/, ';\n') ); source = removeFunction(source, 'shimIsPlainObject'); From 01621f75b6dd285ac07bca88c5bf1edffc5525b5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 20 May 2013 09:20:51 -0700 Subject: [PATCH 051/117] Avoid binding functions in `_.createCallback` if they don't reference `this`. Former-commit-id: d491414e7e1536d3241a607ba07120f629ff2410 --- build.js | 3 ++ lodash.js | 42 ++++++++++-------- test/test-build.js | 106 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 116 insertions(+), 35 deletions(-) diff --git a/build.js b/build.js index e677ca85f2..b862eb6e0f 100755 --- a/build.js +++ b/build.js @@ -1385,6 +1385,9 @@ function removeRunInContext(source) { source = removeVar(source, 'contextProps'); + // replace reference in `reThis` assignment + source = source.replace(/\btest\(runInContext\)/, 'test(function() { return this; })'); + // remove function scaffolding, leaving most of its content source = source.replace(matchFunction(source, 'runInContext'), function(match) { return match diff --git a/lodash.js b/lodash.js index 8a7ff787d3..e00d471183 100644 --- a/lodash.js +++ b/lodash.js @@ -55,6 +55,9 @@ /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to detect functions containing a `this` reference */ + var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis; + /** Used to detect and test whitespace */ var whitespace = ( // whitespace @@ -188,6 +191,7 @@ clearTimeout = context.clearTimeout, concat = arrayProto.concat, floor = Math.floor, + fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, @@ -4578,27 +4582,27 @@ return result; }; } - if (typeof thisArg != 'undefined') { - if (argCount === 1) { - return function(value) { - return func.call(thisArg, value); - }; - } - if (argCount === 2) { - return function(a, b) { - return func.call(thisArg, a, b); - }; - } - if (argCount === 4) { - return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return function(value, index, collection) { - return func.call(thisArg, value, index, collection); + if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) { + return func; + } + if (argCount === 1) { + return function(value) { + return func.call(thisArg, value); + }; + } + if (argCount === 2) { + return function(a, b) { + return func.call(thisArg, a, b); }; } - return func; + if (argCount === 4) { + return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + } + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; } /** diff --git a/test/test-build.js b/test/test-build.js index e97e501257..fe94670230 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -1129,6 +1129,80 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('exclude command'); + + (function() { + var commands = [ + 'exclude', + 'minus' + ]; + + commands.forEach(function(command) { + asyncTest('`lodash ' + command + '=runInContext`', function() { + var start = _.after(2, _.once(QUnit.start)); + + build(['-s', command + '=runInContext'], function(data) { + var basename = path.basename(data.outputPath, '.js'), + context = createContext(), + source = data.source; + + vm.runInContext(data.source, context); + + var lodash = context._, + array = [0]; + + var actual = lodash.map(array, function() { + return String(this[0]); + }, array); + + deepEqual(actual, ['0'], basename); + equal('runInContext' in lodash, false, basename); + start(); + }); + }); + + asyncTest('`lodash ' + command + '=mixin`', function() { + var start = _.after(2, _.once(QUnit.start)); + + build(['-s', command + '=mixin'], function(data) { + var basename = path.basename(data.outputPath, '.js'), + context = createContext(), + source = data.source; + + vm.runInContext(data.source, context); + var lodash = context._; + + var actual = lodash([1, 2, 3]) + .map(function(num) { return num * num; }) + .value(); + + deepEqual(actual, [1, 4, 9], basename); + equal('mixin' in lodash, false, basename); + start(); + }); + }); + + asyncTest('`lodash ' + command + '=value`', function() { + var start = _.after(2, _.once(QUnit.start)); + + build(['-s', command + '=value'], function(data) { + var basename = path.basename(data.outputPath, '.js'), + context = createContext(), + source = data.source; + + vm.runInContext(data.source, context); + var lodash = context._; + + strictEqual(lodash([1]), undefined, basename); + deepEqual(_.keys(lodash.prototype), [], basename); + start(); + }); + }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('exports command'); (function() { @@ -1440,19 +1514,19 @@ var command = origCommand; if (index == 1) { - if (/legacy|mobile/.test(command)) { + if (/\b(?:legacy|mobile)\b/.test(command)) { return; } command = 'mobile ' + command; } else if (index == 2) { - if (/legacy|modern/.test(command)) { + if (/\b(?:legacy|modern)\b/.test(command)) { return; } command = 'modern ' + command; } else if (index == 3) { - if (/category|legacy|underscore/.test(command)) { + if (/\b(?:category|legacy|underscore)\b/.test(command)) { return; } command = 'underscore ' + command; @@ -1464,8 +1538,8 @@ var methodNames, basename = path.basename(data.outputPath, '.js'), context = createContext(), - isBackbone = /backbone/.test(command), - isUnderscore = isBackbone || /underscore/.test(command), + isBackbone = /\bbackbone\b/.test(command), + isUnderscore = isBackbone || /\bunderscore\b/.test(command), exposeAssign = !isUnderscore, exposeZipObject = !isUnderscore; @@ -1475,11 +1549,11 @@ console.log(e); } // add method names explicitly - if (/include/.test(command)) { - methodNames = command.match(/include=(\S*)/)[1].split(/, */); + if (/\binclude=/.test(command)) { + methodNames = command.match(/\binclude=(\S*)/)[1].split(/, */); } // add method names required by Backbone and Underscore builds - if (/backbone/.test(command) && !methodNames) { + if (/\bbackbone\b/.test(command) && !methodNames) { methodNames = backboneDependencies.slice(); } if (isUnderscore) { @@ -1490,20 +1564,20 @@ methodNames = underscoreMethods.slice(); } } - if (/category/.test(command)) { - methodNames = (methodNames || []).concat(command.match(/category=(\S*)/)[1].split(/, */).map(capitalize)); + if (/\bcategory=/.test(command)) { + methodNames = (methodNames || []).concat(command.match(/\bcategory=(\S*)/)[1].split(/, */).map(capitalize)); } if (!methodNames) { methodNames = lodashMethods.slice(); } - if (/plus/.test(command)) { - methodNames = methodNames.concat(command.match(/plus=(\S*)/)[1].split(/, */)); + if (/\bplus=/.test(command)) { + methodNames = methodNames.concat(command.match(/\bplus=(\S*)/)[1].split(/, */)); } - if (/minus/.test(command)) { - methodNames = _.without.apply(_, [methodNames].concat(expandMethodNames(command.match(/minus=(\S*)/)[1].split(/, */)))); + if (/\bminus=/.test(command)) { + methodNames = _.without.apply(_, [methodNames].concat(expandMethodNames(command.match(/\bminus=(\S*)/)[1].split(/, */)))); } - if (/exclude/.test(command)) { - methodNames = _.without.apply(_, [methodNames].concat(expandMethodNames(command.match(/exclude=(\S*)/)[1].split(/, */)))); + if (/\bexclude=/.test(command)) { + methodNames = _.without.apply(_, [methodNames].concat(expandMethodNames(command.match(/\bexclude=(\S*)/)[1].split(/, */)))); } // expand categories to real method names From 355b2f09bf6ca7a930c2c06345f253cb343fd17b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 20 May 2013 22:10:11 -0700 Subject: [PATCH 052/117] Make `getDependants` work with an array of method names. Former-commit-id: 55f3721735d93e95da10bb3367f8478d861e683c --- build.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/build.js b/build.js index b862eb6e0f..c8e6a38229 100755 --- a/build.js +++ b/build.js @@ -714,17 +714,20 @@ } /** - * Gets an array of depenants for a method by a given name. + * Gets an array of depenants for the given method name(s). * * @private - * @param {String} methodName The method name. + * @param {String} methodName A method name or array of method names. * @returns {Array} Returns an array of method dependants. */ function getDependants(methodName) { - // iterate over the `dependencyMap`, adding the names of methods that - // have `methodName` as a dependency + // iterate over the `dependencyMap`, adding names of methods + // that have the `methodName` as a dependency + var methodNames = _.isArray(methodName) ? methodName : [methodName]; return _.reduce(dependencyMap, function(result, dependencies, otherName) { - if (_.contains(dependencies, methodName)) { + if (_.some(methodNames, function(methodName) { + return _.contains(dependencies, methodName); + })) { result.push(otherName); } return result; @@ -737,13 +740,12 @@ * plus any additional detected sub-dependencies. * * @private - * @param {Array|String} methodName A single method name or array of - * dependencies to query. + * @param {Array|String} methodName A method name or array of dependencies to query. * @param- {Object} [stackA=[]] Internally used track queried methods. * @returns {Array} Returns an array of method dependencies. */ function getDependencies(methodName, stack) { - var dependencies = Array.isArray(methodName) ? methodName : dependencyMap[methodName]; + var dependencies = _.isArray(methodName) ? methodName : dependencyMap[methodName]; if (!dependencies) { return []; } From 25a1d74627967709d9ca2de7dc1dff3fa0864852 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 20 May 2013 22:52:34 -0700 Subject: [PATCH 053/117] Update test/underscore.html and test/backbone.html to account for `chain` existing in Lo-Dash. Former-commit-id: f815e7a3ac6e9cc6c048eab82acc32e462dbb021 --- test/backbone.html | 7 ------- test/underscore.html | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/test/backbone.html b/test/backbone.html index 13d283975e..462c0e50d9 100644 --- a/test/backbone.html +++ b/test/backbone.html @@ -33,13 +33,6 @@

Test

'debounce': lodash.debounce, 'defer': lodash.defer }); - if (!_.chain) { - _.mixin({ - 'chain': function(value) { - return new _(value); - } - }); - } diff --git a/test/underscore.html b/test/underscore.html index e93f26d98c..5fd8e650b4 100644 --- a/test/underscore.html +++ b/test/underscore.html @@ -34,7 +34,7 @@ push = arrayProto.push, slice = arrayProto.slice; - if (_.chain) { + if (_.chain().__chain__) { return; } _.mixin = function(object) { From 32f0ebbe6177040a846dc42e39cfb8e87f3427e3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 20 May 2013 22:53:27 -0700 Subject: [PATCH 054/117] Avoid issues with Titanium, `clearTimeout`, and an `undefined` timer id. Former-commit-id: 18813fcebbab5185164c236a647b0b6436d495ff --- build.js | 6 +++--- lodash.js | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build.js b/build.js index c8e6a38229..eedbff1fa1 100755 --- a/build.js +++ b/build.js @@ -2210,7 +2210,7 @@ ' var args,', ' result,', ' thisArg,', - ' timeoutId;', + ' timeoutId = null;', '', ' function delayed() {', ' timeoutId = null;', @@ -2567,8 +2567,8 @@ ' var args,', ' result,', ' thisArg,', - ' timeoutId,', - ' lastCalled = 0;', + ' lastCalled = 0,', + ' timeoutId = null;', '', ' function trailingCall() {', ' lastCalled = new Date;', diff --git a/lodash.js b/lodash.js index e00d471183..6de91505d0 100644 --- a/lodash.js +++ b/lodash.js @@ -4639,8 +4639,8 @@ var args, result, thisArg, - timeoutId, callCount = 0, + timeoutId = null, trailing = true; function delayed() { @@ -4660,6 +4660,9 @@ return function() { args = arguments; thisArg = this; + + // avoid issues with Titanium and `undefined` timeout ids + // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); if (leading && ++callCount < 2) { @@ -4868,9 +4871,9 @@ var args, result, thisArg, - timeoutId, lastCalled = 0, leading = true, + timeoutId = null, trailing = true; function trailingCall() { From 1bb0b58ccec1f047ebaca2f7e58fd586abd3cfb3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 20 May 2013 22:57:31 -0700 Subject: [PATCH 055/117] Rename `cachedContains` reference in build.js to `createCache`. Former-commit-id: 3b8cee53f3b7cadc5350c4261794cec72e704427 --- build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.js b/build.js index eedbff1fa1..94f145c81f 100755 --- a/build.js +++ b/build.js @@ -2699,7 +2699,7 @@ source = source.replace(/lodash\.support *= */, ''); // remove large array optimizations - source = removeFunction(source, 'cachedContains'); + source = removeFunction(source, 'createCache'); // replace `slice` with `nativeSlice.call` source = removeFunction(source, 'slice'); From 9d5290de914023a762cd8da4d58994fc0565a67d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 20 May 2013 22:58:08 -0700 Subject: [PATCH 056/117] Rebuild docs and files. Former-commit-id: 00c9d39304630bf650d7f1c80496c383cdac0ba7 --- dist/lodash.compat.js | 161 +++++++++++++--------- dist/lodash.compat.min.js | 85 ++++++------ dist/lodash.js | 161 +++++++++++++--------- dist/lodash.min.js | 77 +++++------ dist/lodash.underscore.js | 50 +++---- dist/lodash.underscore.min.js | 58 ++++---- doc/README.md | 250 +++++++++++++++++----------------- 7 files changed, 463 insertions(+), 379 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index a9e9aa053f..4c77260c85 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -34,7 +34,7 @@ var keyPrefix = +new Date + ''; /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 200; + var largeArraySize = 75; /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, @@ -56,6 +56,9 @@ /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to detect functions containing a `this` reference */ + var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis; + /** Used to detect and test whitespace */ var whitespace = ( // whitespace @@ -189,6 +192,7 @@ clearTimeout = context.clearTimeout, concat = arrayProto.concat, floor = Math.floor, + fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, @@ -646,26 +650,72 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - function cachedContains(array) { - var length = array.length, - isLarge = length >= largeArraySize; - - if (isLarge) { - var cache = {}, - index = -1; + function createCache(array) { + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; + + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; - while (++index < length) { - var key = keyPrefix + array[index]; - (cache[key] || (cache[key] = [])).push(array[index]); + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? indexOf(cache[key], value) > -1 : false) + : !!cache[key]; } - return function(value) { - if (isLarge) { - var key = keyPrefix + value; - return cache[key] && indexOf(cache[key], value) > -1; + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } } + } + + function simpleContains(value) { return indexOf(array, value) > -1; } + + function simplePush(value) { + array.push(value); + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'push': simplePush, 'contains' : simpleContains }; } /** @@ -3423,7 +3473,7 @@ var index = -1, length = array ? array.length : 0, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - contains = cachedContains(flattened), + contains = createCache(flattened).contains, result = []; while (++index < length) { @@ -3751,29 +3801,21 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = { '0': {} }, + cache = createCache([]), + caches = {}, index = -1, length = array ? array.length : 0, isLarge = length >= largeArraySize, - result = [], - seen = result; + result = []; outer: while (++index < length) { var value = array[index]; - if (isLarge) { - var key = keyPrefix + value; - var inited = cache[0][key] - ? !(seen = cache[0][key]) - : (seen = cache[0][key] = []); - } - if (inited || indexOf(seen, value) < 0) { - if (isLarge) { - seen.push(value); - } + if (!cache.contains(value)) { var argsIndex = argsLength; + cache.push(value); while (--argsIndex) { - if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) { + if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) { continue outer; } } @@ -4161,26 +4203,20 @@ } // init value cache for large arrays var isLarge = !isSorted && length >= largeArraySize; - if (isLarge) { - var cache = {}; - } if (callback != null) { seen = []; callback = lodash.createCallback(callback, thisArg); } + if (isLarge) { + seen = createCache([]); + } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; - if (isLarge) { - var key = keyPrefix + computed; - var inited = cache[key] - ? !(seen = cache[key]) - : (seen = cache[key] = []); - } if (isSorted ? !index || seen[seen.length - 1] !== computed - : inited || indexOf(seen, computed) < 0 + : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); @@ -4528,27 +4564,27 @@ return result; }; } - if (typeof thisArg != 'undefined') { - if (argCount === 1) { - return function(value) { - return func.call(thisArg, value); - }; - } - if (argCount === 2) { - return function(a, b) { - return func.call(thisArg, a, b); - }; - } - if (argCount === 4) { - return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return function(value, index, collection) { - return func.call(thisArg, value, index, collection); + if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) { + return func; + } + if (argCount === 1) { + return function(value) { + return func.call(thisArg, value); }; } - return func; + if (argCount === 2) { + return function(a, b) { + return func.call(thisArg, a, b); + }; + } + if (argCount === 4) { + return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + } + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; } /** @@ -4585,8 +4621,8 @@ var args, result, thisArg, - timeoutId, callCount = 0, + timeoutId = null, trailing = true; function delayed() { @@ -4606,6 +4642,9 @@ return function() { args = arguments; thisArg = this; + + // avoid issues with Titanium and `undefined` timeout ids + // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); if (leading && ++callCount < 2) { @@ -4814,9 +4853,9 @@ var args, result, thisArg, - timeoutId, lastCalled = 0, leading = true, + timeoutId = null, trailing = true; function trailingCall() { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 5282039bf2..fe35378b67 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,45 +4,46 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Er(n)&&tr.call(n,"__wrapped__")?n:new V(n)}function R(n){var t=n.length,r=t>=l;if(r)for(var e={},u=-1;++ut||typeof n=="undefined")return 1;if(nk;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; -e+="}"}return(t.b||wr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(A,Kt,tr,Z,Er,it,Sr,a,Mt,$,Cr,z,Ut,or)}function J(n){return at(n)?cr(n):{}}function K(n){return"\\"+q[n]}function M(n){return Ir[n]}function U(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function V(n){this.__wrapped__=n}function Q(){}function W(n){var t=!1;if(!n||or.call(n)!=N||!wr.argsClass&&Z(n))return t;var r=n.constructor;return(ut(r)?r instanceof r:wr.nodeClass||!U(n))?wr.ownLast?(zr(n,function(n,r,e){return t=tr.call(e,r),!1 -}),!0===t):(zr(n,function(n,r){t=r}),!1===t||tr.call(n,t)):t}function X(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=zt(0>r?0:r);++er?vr(0,u+r):r)||0,typeof u=="number"?a=-1<(it(n)?n.indexOf(t,r):jt(n,t,r)):Ar(n,function(n){return++eu&&(u=i)}}else t=!t&&it(n)?T:a.createCallback(t,r),Ar(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n) -});return u}function mt(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Er(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Sr(n),o=c.length;else wr.unindexedChars&&it(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),gt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function bt(n,t,r){var e; -if(t=a.createCallback(t,r),Er(n)){r=-1;for(var u=n.length;++rr?vr(0,u+r):r||0)-1;else if(r)return e=xt(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])=l;if(s)var v={};for(null!=e&&(p=[],e=a.createCallback(e,u));++ojt(p,g))&&((e||s)&&p.push(g),f.push(u))}return f}function Ot(n){for(var t=-1,r=n?yt(qr(n,"length")):0,e=zt(0>r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var jr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Br=rt(Ir),Nr=H(jr,{h:jr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Pr=H(jr),zr=H(kr,xr,{i:!1}),Fr=H(kr,xr); -ut(/x/)&&(ut=function(n){return typeof n=="function"&&or.call(n)==I});var $r=nr?function(n){if(!n||or.call(n)!=N||!wr.argsClass&&Z(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=nr(t))&&nr(r);return r?n==r||nr(n)==r:W(n)}:W,qr=ht;br&&u&&typeof ur=="function"&&(It=At(ur,e));var Dr=8==hr(m+"08")?hr:function(n,t){return hr(it(n)?n.replace(d,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Nr,a.at=function(n){var t=-1,r=Yt.apply(Jt,mr.call(arguments,1)),e=r.length,u=zt(e); -for(wr.unindexedChars&&it(n)&&(n=n.split(""));++t++c&&(a=n.apply(o,u)),i=ar(e,t),a}},a.defaults=Pr,a.defer=It,a.delay=function(n,t){var e=mr.call(arguments,2);return ar(function(){n.apply(r,e)},t)},a.difference=_t,a.filter=st,a.flatten=wt,a.forEach=gt,a.forIn=zr,a.forOwn=Fr,a.functions=tt,a.groupBy=function(n,t,r){var e={}; -return t=a.createCallback(t,r),gt(n,function(n,r,u){r=Gt(t(n,r,u)),(tr.call(e,r)?e[r]:e[r]=[]).push(n)}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return X(n,0,gr(vr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e={0:{}},u=-1,a=n?n.length:0,o=a>=l,i=[],f=i;n:for(;++ujt(f,p)){o&&f.push(p); -for(var v=r;--v;)if(!(e[v]||(e[v]=R(t[v])))(p))continue n;i.push(p)}}return i},a.invert=rt,a.invoke=function(n,t){var r=mr.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=zt(typeof a=="number"?a:0);return gt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},a.keys=Sr,a.map=ht,a.max=yt,a.memoize=function(n,t){function r(){var e=r.cache,u=c+(t?t.apply(this,arguments):arguments[0]);return tr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},a.merge=ct,a.min=function(n,t,r){var e=1/0,u=e; -if(!t&&Er(n)){r=-1;for(var o=n.length;++rjt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Sr(n),e=r.length,u=zt(e);++tr?vr(0,e+r):gr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Nt,a.noConflict=function(){return e._=Vt,this},a.parseInt=Dr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=yr();return n%1||t%1?n+gr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+Zt(r*(t-n+1))},a.reduce=mt,a.reduceRight=dt,a.result=function(n,t){var e=n?n[t]:r; -return ut(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Sr(n).length},a.some=bt,a.sortedIndex=xt,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Pr({},e,u);var o,i=Pr({},e.imports,u.imports),u=Sr(i),i=lt(i),c=0,l=e.interpolate||b,v="__p+='",l=Lt((e.escape||b).source+"|"+l.source+"|"+(l===y?g:b).source+"|"+(e.evaluate||b).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),v+=n.slice(c,i).replace(C,K),r&&(v+="'+__e("+r+")+'"),a&&(o=!0,v+="';"+a+";__p+='"),e&&(v+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t -}),v+="';\n",l=e=e.variable,l||(e="obj",v="with("+e+"){"+v+"}"),v=(o?v.replace(f,""):v).replace(p,"$1").replace(s,"$1;"),v="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+v+"return __p}";try{var h=qt(u,"return "+v).apply(r,i)}catch(m){throw m.source=v,m}return t?h(t):(h.source=v,h)},a.unescape=function(n){return null==n?"":Gt(n).replace(v,Y)},a.uniqueId=function(n){var t=++o;return Gt(null==n?"":n)+t -},a.all=pt,a.any=bt,a.detect=vt,a.foldl=mt,a.foldr=dt,a.include=ft,a.inject=mt,Fr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return rr.apply(t,arguments),n.apply(a,t)})}),a.first=Ct,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return X(n,vr(0,u-e))}},a.take=Ct,a.head=Ct,Fr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); -return null==t||r&&typeof t!="function"?e:new V(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Gt(this.__wrapped__)},a.prototype.value=Pt,a.prototype.valueOf=Pt,Ar(["join","pop","shift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Ar(["push","reverse","sort","unshift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ar(["concat","slice","splice"],function(n){var t=Jt[n];a.prototype[n]=function(){return new V(t.apply(this.__wrapped__,arguments)) -}}),wr.spliceObjects||Ar(["pop","shift","splice"],function(n){var t=Jt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new V(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=200,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,v=/&(?:amp|lt|gt|quot|#39);/g,g=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",d=RegExp("^["+m+"]*0+(?=.$)"),b=/($^)/,_=/[&<>"']/g,C=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),j="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),x="[object Arguments]",E="[object Array]",O="[object Boolean]",S="[object Date]",A="[object Error]",I="[object Function]",B="[object Number]",N="[object Object]",P="[object RegExp]",z="[object String]",F={}; -F[I]=!1,F[x]=F[E]=F[O]=F[S]=F[B]=F[N]=F[P]=F[z]=!0;var $={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=D, define(function(){return D})):e&&!e.nodeType?u?(u.exports=D)._=D:e._=D:n._=D}(this); \ No newline at end of file +;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Sr(n)&&er.call(n,"__wrapped__")?n:new Q(n)}function T(n){function t(n){var t=typeof n;if("boolean"==t||null==n)return s[n];var r=s[t]||(t="object",p),e="number"==t?n:l+n;return"object"==t?r[e]?-1=c,p={},s={"false":!1,"function":!1,"null":!1,number:{},object:p,string:{},"true":!1,undefined:!1};if(f){for(;++ot||typeof n=="undefined")return 1;if(nk;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; +e+="}"}return(t.b||kr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Mt,er,nt,Sr,lt,Ir,a,Ut,q,wr,F,Vt,lr)}function K(n){return ot(n)?fr(n):{}}function M(n){return"\\"+D[n]}function U(n){return Nr[n]}function V(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function Q(n){this.__wrapped__=n}function W(){}function X(n){var t=!1;if(!n||lr.call(n)!=P||!kr.argsClass&&nt(n))return t;var r=n.constructor;return(at(r)?r instanceof r:kr.nodeClass||!V(n))?kr.ownLast?($r(n,function(n,r,e){return t=er.call(e,r),!1 +}),!0===t):($r(n,function(n,r){t=r}),!1===t||er.call(n,t)):t}function Y(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Ft(0>r?0:r);++er?hr(0,u+r):r)||0,typeof u=="number"?a=-1<(lt(n)?n.indexOf(t,r):kt(n,t,r)):Br(n,function(n){return++eu&&(u=i)}}else t=!t&<(n)?L:a.createCallback(t,r),Br(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n) +});return u}function dt(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Sr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var l=Ir(n),o=l.length;else kr.unindexedChars&<(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),ht(n,function(n,e,a){e=l?l[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function _t(n,t,r){var e; +if(t=a.createCallback(t,r),Sr(n)){r=-1;for(var u=n.length;++rr?hr(0,u+r):r||0)-1;else if(r)return e=Et(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])=c;for(null!=e&&(f=[],e=a.createCallback(e,u)),p&&(f=T([]));++or?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var xr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Pr=et(Nr),zr=J(xr,{h:xr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Fr=J(xr),$r=J(Er,Or,{i:!1}),qr=J(Er,Or); +at(/x/)&&(at=function(n){return typeof n=="function"&&lr.call(n)==B});var Dr=rr?function(n){if(!n||lr.call(n)!=P||!kr.argsClass&&nt(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=rr(t))&&rr(r);return r?n==r||rr(n)==r:X(n)}:X,Rr=yt;Cr&&u&&typeof or=="function"&&(Bt=It(or,e));var Tr=8==mr(d+"08")?mr:function(n,t){return mr(lt(n)?n.replace(b,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=zr,a.at=function(n){var t=-1,r=Zt.apply(Kt,br.call(arguments,1)),e=r.length,u=Ft(e); +for(kr.unindexedChars&<(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),l=ir(e,t),a}},a.defaults=Fr,a.defer=Bt,a.delay=function(n,t){var e=br.call(arguments,2);return ir(function(){n.apply(r,e)},t)},a.difference=Ct,a.filter=gt,a.flatten=wt,a.forEach=ht,a.forIn=$r,a.forOwn=qr,a.functions=rt,a.groupBy=function(n,t,r){var e={}; +return t=a.createCallback(t,r),ht(n,function(n,r,u){r=Ht(t(n,r,u)),(er.call(e,r)?e[r]:e[r]=[]).push(n)}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return Y(n,0,yr(hr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=T([]),u={},a=-1,o=n?n.length:0,i=[];n:for(;++akt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Ir(n),e=r.length,u=Ft(e);++tr?hr(0,e+r):yr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Pt,a.noConflict=function(){return e._=Qt,this},a.parseInt=Tr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=dr();return n%1||t%1?n+yr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+nr(r*(t-n+1))},a.reduce=dt,a.reduceRight=bt,a.result=function(n,t){var e=n?n[t]:r; +return at(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ir(n).length},a.some=_t,a.sortedIndex=Et,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Fr({},e,u);var o,i=Fr({},e.imports,u.imports),u=Ir(i),i=ft(i),l=0,c=e.interpolate||_,g="__p+='",c=Gt((e.escape||_).source+"|"+c.source+"|"+(c===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(c,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(l,i).replace(j,M),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),l=i+t.length,t +}),g+="';\n",c=e=e.variable,c||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(c?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Dt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Ht(n).replace(g,Z)},a.uniqueId=function(n){var t=++o;return Ht(null==n?"":n)+t +},a.all=st,a.any=_t,a.detect=vt,a.foldl=dt,a.foldr=bt,a.include=pt,a.inject=dt,qr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ur.apply(t,arguments),n.apply(a,t)})}),a.first=jt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Y(n,hr(0,u-e))}},a.take=jt,a.head=jt,qr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); +return null==t||r&&typeof t!="function"?e:new Q(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Ht(this.__wrapped__)},a.prototype.value=zt,a.prototype.valueOf=zt,Br(["join","pop","shift"],function(n){var t=Kt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Br(["push","reverse","sort","unshift"],function(n){var t=Kt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Br(["concat","slice","splice"],function(n){var t=Kt[n];a.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments)) +}}),kr.spliceObjects||Br(["pop","shift","splice"],function(n){var t=Kt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new Q(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},l=+new Date+"",c=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),E="[object Arguments]",O="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; +$[B]=!1,$[E]=$[O]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 4001c35fef..dc0889f243 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -34,7 +34,7 @@ var keyPrefix = +new Date + ''; /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 200; + var largeArraySize = 75; /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, @@ -56,6 +56,9 @@ /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to detect functions containing a `this` reference */ + var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis; + /** Used to detect and test whitespace */ var whitespace = ( // whitespace @@ -181,6 +184,7 @@ clearTimeout = context.clearTimeout, concat = arrayProto.concat, floor = Math.floor, + fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, @@ -376,26 +380,72 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - function cachedContains(array) { - var length = array.length, - isLarge = length >= largeArraySize; - - if (isLarge) { - var cache = {}, - index = -1; + function createCache(array) { + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; + + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; - while (++index < length) { - var key = keyPrefix + array[index]; - (cache[key] || (cache[key] = [])).push(array[index]); + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? indexOf(cache[key], value) > -1 : false) + : !!cache[key]; } - return function(value) { - if (isLarge) { - var key = keyPrefix + value; - return cache[key] && indexOf(cache[key], value) > -1; + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } } + } + + function simpleContains(value) { return indexOf(array, value) > -1; } + + function simplePush(value) { + array.push(value); + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'push': simplePush, 'contains' : simpleContains }; } /** @@ -3099,7 +3149,7 @@ var index = -1, length = array ? array.length : 0, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - contains = cachedContains(flattened), + contains = createCache(flattened).contains, result = []; while (++index < length) { @@ -3427,29 +3477,21 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = { '0': {} }, + cache = createCache([]), + caches = {}, index = -1, length = array ? array.length : 0, isLarge = length >= largeArraySize, - result = [], - seen = result; + result = []; outer: while (++index < length) { var value = array[index]; - if (isLarge) { - var key = keyPrefix + value; - var inited = cache[0][key] - ? !(seen = cache[0][key]) - : (seen = cache[0][key] = []); - } - if (inited || indexOf(seen, value) < 0) { - if (isLarge) { - seen.push(value); - } + if (!cache.contains(value)) { var argsIndex = argsLength; + cache.push(value); while (--argsIndex) { - if (!(cache[argsIndex] || (cache[argsIndex] = cachedContains(args[argsIndex])))(value)) { + if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) { continue outer; } } @@ -3837,26 +3879,20 @@ } // init value cache for large arrays var isLarge = !isSorted && length >= largeArraySize; - if (isLarge) { - var cache = {}; - } if (callback != null) { seen = []; callback = lodash.createCallback(callback, thisArg); } + if (isLarge) { + seen = createCache([]); + } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; - if (isLarge) { - var key = keyPrefix + computed; - var inited = cache[key] - ? !(seen = cache[key]) - : (seen = cache[key] = []); - } if (isSorted ? !index || seen[seen.length - 1] !== computed - : inited || indexOf(seen, computed) < 0 + : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); @@ -4204,27 +4240,27 @@ return result; }; } - if (typeof thisArg != 'undefined') { - if (argCount === 1) { - return function(value) { - return func.call(thisArg, value); - }; - } - if (argCount === 2) { - return function(a, b) { - return func.call(thisArg, a, b); - }; - } - if (argCount === 4) { - return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return function(value, index, collection) { - return func.call(thisArg, value, index, collection); + if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) { + return func; + } + if (argCount === 1) { + return function(value) { + return func.call(thisArg, value); }; } - return func; + if (argCount === 2) { + return function(a, b) { + return func.call(thisArg, a, b); + }; + } + if (argCount === 4) { + return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + } + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; } /** @@ -4261,8 +4297,8 @@ var args, result, thisArg, - timeoutId, callCount = 0, + timeoutId = null, trailing = true; function delayed() { @@ -4282,6 +4318,9 @@ return function() { args = arguments; thisArg = this; + + // avoid issues with Titanium and `undefined` timeout ids + // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); if (leading && ++callCount < 2) { @@ -4490,9 +4529,9 @@ var args, result, thisArg, - timeoutId, lastCalled = 0, leading = true, + timeoutId = null, trailing = true; function trailingCall() { diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 0323bf35fa..2d198d4dd8 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,41 +4,42 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(o){function f(n){if(!n||ae.call(n)!=$)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ne(t))&&ne(e);return e?n==e||ne(n)==e:Y(n)}function z(n,t,e){if(!n||!T[typeof n])return n;t=t&&typeof e=="undefined"?t:V.createCallback(t,e);for(var r=-1,u=T[typeof n]?_e(n):[],o=u.length;++r=s;if(e)for(var r={},u=-1;++ut||typeof n=="undefined")return 1; -if(ne?0:e);++re?se(0,u+e):e)||0,typeof u=="number"?o=-1<(ft(n)?n.indexOf(t,e):xt(n,t,e)):z(n,function(n){return++ru&&(u=o) -}}else t=!t&&ft(n)?H:V.createCallback(t,e),yt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function mt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Tt(r);++earguments.length;t=V.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -if(typeof u!="number")var i=_e(n),u=i.length;return t=V.createCallback(t,r,4),yt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function kt(n,t,e){var r;t=V.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?se(0,u+e):e||0)-1;else if(e)return r=Et(n,t),n[r]===t?r:-1;for(;++r>>1,e(n[r])=s;if(v)var g={};for(r!=u&&(l=[],r=V.createCallback(r,o));++ixt(l,y))&&((r||v)&&l.push(y),c.push(o))}return c}function Nt(n){for(var t=-1,e=n?bt(mt(n,"length")):0,r=Tt(0>e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:V}},X.prototype=V.prototype;var de=fe,_e=pe?function(n){return ot(n)?pe(n):[]}:U,ke={"&":"&","<":"<",">":">",'"':""","'":"'"},we=rt(ke);return Pt&&i&&typeof re=="function"&&($t=At(re,o)),qt=8==ge(_+"08")?ge:function(n,t){return ge(ft(n)?n.replace(k,""):n,t||0) -},V.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},V.assign=M,V.at=function(n){for(var t=-1,e=Yt.apply(Ht,he.call(arguments,1)),r=e.length,u=Tt(r);++t++l&&(i=n.apply(f,o)),c=ue(u,t),i}},V.defaults=K,V.defer=$t,V.delay=function(n,t){var r=he.call(arguments,2); -return ue(function(){n.apply(e,r)},t)},V.difference=wt,V.filter=vt,V.flatten=jt,V.forEach=yt,V.forIn=P,V.forOwn=z,V.functions=et,V.groupBy=function(n,t,e){var r={};return t=V.createCallback(t,e),yt(n,function(n,e,u){e=Vt(t(n,e,u)),(te.call(r,e)?r[e]:r[e]=[]).push(n)}),r},V.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=V.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return Z(n,0,ve(se(0,a-r),a))},V.intersection=function(n){var t=arguments,e=t.length,r={0:{}},u=-1,a=n?n.length:0,o=a>=s,i=[],f=i; -n:for(;++uxt(f,c)){o&&f.push(c);for(var v=e;--v;)if(!(r[v]||(r[v]=G(t[v])))(c))continue n;i.push(c)}}return i},V.invert=rt,V.invoke=function(n,t){var e=he.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Tt(typeof a=="number"?a:0);return yt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},V.keys=_e,V.map=ht,V.max=bt,V.memoize=function(n,t){function e(){var r=e.cache,u=p+(t?t.apply(this,arguments):arguments[0]); -return te.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},V.merge=ct,V.min=function(n,t,e){var r=1/0,u=r;if(!t&&de(n)){e=-1;for(var a=n.length;++ext(a,e))&&(u[e]=n)}),u},V.once=function(n){var t,e; -return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},V.pairs=function(n){for(var t=-1,e=_e(n),r=e.length,u=Tt(r);++te?se(0,r+e):ve(e,r-1))+1);r--;)if(n[r]===t)return r; -return-1},V.mixin=Ft,V.noConflict=function(){return o._=Lt,this},V.parseInt=qt,V.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=ye();return n%1||t%1?n+ve(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},V.reduce=dt,V.reduceRight=_t,V.result=function(n,t){var r=n?n[t]:e;return at(r)?n[t]():r},V.runInContext=t,V.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:_e(n).length},V.some=kt,V.sortedIndex=Et,V.template=function(n,t,u){var a=V.templateSettings; -n||(n=""),u=K({},u,a);var o,i=K({},u.imports,a.imports),a=_e(i),i=lt(i),f=0,c=u.interpolate||w,l="__p+='",c=Ut((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(j,Q),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; -try{var p=zt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},V.unescape=function(n){return n==u?"":Vt(n).replace(h,nt)},V.uniqueId=function(n){var t=++c;return Vt(n==u?"":n)+t},V.all=st,V.any=kt,V.detect=gt,V.foldl=dt,V.foldr=_t,V.include=pt,V.inject=dt,z(V,function(n,t){V.prototype[t]||(V.prototype[t]=function(){var t=[this.__wrapped__];return ee.apply(t,arguments),n.apply(V,t)})}),V.first=Ct,V.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; -for(t=V.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return Z(n,se(0,a-r))}},V.take=Ct,V.head=Ct,z(V,function(n,t){V.prototype[t]||(V.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new X(r)})}),V.VERSION="1.2.1",V.prototype.toString=function(){return Vt(this.__wrapped__)},V.prototype.value=Rt,V.prototype.valueOf=Rt,yt(["join","pop","shift"],function(n){var t=Ht[n];V.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),yt(["push","reverse","sort","unshift"],function(n){var t=Ht[n];V.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),yt(["concat","slice","splice"],function(n){var t=Ht[n];V.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments))}}),V}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=200,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",k=RegExp("^["+_+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,x="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),O="[object Arguments]",E="[object Array]",I="[object Boolean]",N="[object Date]",S="[object Function]",A="[object Number]",$="[object Object]",B="[object RegExp]",F="[object String]",R={}; -R[S]=a,R[O]=R[E]=R[I]=R[N]=R[A]=R[$]=R[B]=R[F]=r;var T={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},D=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=D, define(function(){return D})):o&&!o.nodeType?i?(i.exports=D)._=D:o._=D:n._=D}(this); \ No newline at end of file +;!function(n){function t(o){function f(n){if(!n||ie.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ee(t))&&ee(e);return e?n==e||ee(n)==e:Z(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?je(n):[],o=u.length;++r=s,g={},y={"false":a,"function":a,"null":a,number:{},object:g,string:{},"true":a,undefined:a};if(v){for(;++ct||typeof n=="undefined")return 1;if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(ct(n)?n.indexOf(t,e):Ot(n,t,e)):P(n,function(n){return++ru&&(u=o) +}}else t=!t&&ct(n)?J:G.createCallback(t,e),ht(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function dt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=qt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=je(n),u=i.length;return t=G.createCallback(t,r,4),ht(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=St(n,t),n[r]===t?r:-1; +for(;++r>>1,e(n[r])=s;for(r!=u&&(l=[],r=G.createCallback(r,o)),p&&(l=H([]));++ie?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,je=ve?function(n){return it(n)?ve(n):[]}:V,we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=ut(we);return Kt&&i&&typeof ae=="function"&&(Bt=$t(ae,o)),Dt=8==he(k+"08")?he:function(n,t){return he(ct(n)?n.replace(j,""):n,t||0) +},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=Zt.apply(Jt,me.call(arguments,1)),r=e.length,u=qt(r);++t++l&&(f=n.apply(c,i)),p=oe(o,t),f}},G.defaults=M,G.defer=Bt,G.delay=function(n,t){var r=me.call(arguments,2); +return oe(function(){n.apply(e,r)},t)},G.difference=wt,G.filter=gt,G.flatten=xt,G.forEach=ht,G.forIn=K,G.forOwn=P,G.functions=rt,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),ht(n,function(n,e,u){e=Gt(t(n,e,u)),(re.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return nt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=H([]),u={},a=-1,o=n?n.length:0,i=[]; +n:for(;++aOt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e) +}},G.pairs=function(n){for(var t=-1,e=je(n),r=e.length,u=qt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Rt,G.noConflict=function(){return o._=Qt,this},G.parseInt=Dt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0; +var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ne(e*(t-n+1))},G.reduce=_t,G.reduceRight=kt,G.result=function(n,t){var r=n?n[t]:e;return ot(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:je(n).length},G.some=jt,G.sortedIndex=St,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=je(i),i=pt(i),f=0,c=u.interpolate||w,l="__p+='",c=Vt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g"); +n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Pt(a,"return "+l).apply(e,i) +}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Gt(n).replace(h,tt)},G.uniqueId=function(n){var t=++c;return Gt(n==u?"":n)+t},G.all=vt,G.any=jt,G.detect=yt,G.foldl=_t,G.foldr=kt,G.include=st,G.inject=_t,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ue.apply(t,arguments),n.apply(G,t)})}),G.first=Ct,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++ +}else if(r=t,r==u||e)return n[a-1];return nt(n,ge(0,a-r))}},G.take=Ct,G.head=Ct,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Gt(this.__wrapped__)},G.prototype.value=Tt,G.prototype.valueOf=Tt,ht(["join","pop","shift"],function(n){var t=Jt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),ht(["push","reverse","sort","unshift"],function(n){var t=Jt[n]; +G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ht(["concat","slice","splice"],function(n){var t=Jt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments))}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; +T[A]=a,T[E]=T[S]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 55f792e3ec..9fc89d6a2b 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -34,7 +34,7 @@ var keyPrefix = +new Date + ''; /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 200; + var largeArraySize = 75; /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, @@ -56,6 +56,9 @@ /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; + /** Used to detect functions containing a `this` reference */ + var reThis = (reThis = /\bthis\b/) && reThis.test(function() { return this; }) && reThis; + /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -123,6 +126,7 @@ clearTimeout = window.clearTimeout, concat = arrayProto.concat, floor = Math.floor, + fnToString = Function.prototype.toString, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, @@ -3477,27 +3481,27 @@ return result; }; } - if (typeof thisArg != 'undefined') { - if (argCount === 1) { - return function(value) { - return func.call(thisArg, value); - }; - } - if (argCount === 2) { - return function(a, b) { - return func.call(thisArg, a, b); - }; - } - if (argCount === 4) { - return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return function(value, index, collection) { - return func.call(thisArg, value, index, collection); + if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) { + return func; + } + if (argCount === 1) { + return function(value) { + return func.call(thisArg, value); }; } - return func; + if (argCount === 2) { + return function(a, b) { + return func.call(thisArg, a, b); + }; + } + if (argCount === 4) { + return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + } + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; } /** @@ -3534,7 +3538,7 @@ var args, result, thisArg, - timeoutId; + timeoutId = null; function delayed() { timeoutId = null; @@ -3717,8 +3721,8 @@ var args, result, thisArg, - timeoutId, - lastCalled = 0; + lastCalled = 0, + timeoutId = null; function trailingCall() { lastCalled = new Date; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index ab0b810c9d..2e4e043098 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,32 +4,32 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function B(n,t){var r=-1,e=n?n.length:0; -if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Mt(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; -t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Nt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Rt.fastBind||wt&&2"']/g,nt=/['\n\r\t\u2028\u2029\\]/g,tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Number]",it="[object Object]",at="[object RegExp]",ft="[object String]",ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},lt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},pt=Array.prototype,J=Object.prototype,st=n._,vt=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,ht=n.clearTimeout,yt=pt.concat,mt=Math.floor,_t=J.hasOwnProperty,bt=pt.push,dt=n.setTimeout,jt=J.toString,wt=vt.test(wt=jt.bind)&&wt,At=vt.test(At=Object.create)&&At,xt=vt.test(xt=Array.isArray)&&xt,Ot=n.isFinite,Et=n.isNaN,St=vt.test(St=Object.keys)&&St,Nt=Math.max,Bt=Math.min,Ft=Math.random,kt=pt.slice,J=vt.test(n.attachEvent),qt=wt&&!/\n|true/.test(wt+J),Rt={}; -!function(){var n={0:1,length:1};Rt.fastBind=wt&&!qt,Rt.spliceObjects=(pt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},At||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,l(arguments)||(l=function(n){return n?_t.call(n,"callee"):!1});var Dt=xt||function(n){return n?typeof n=="object"&&jt.call(n)==rt:!1},xt=function(n){var t,r=[];if(!n||!ct[typeof n])return r; -for(t in n)_t.call(n,t)&&r.push(t);return r},Mt=St?function(n){return _(n)?St(n):[]}:xt,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=g(Tt),It=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},zt=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(_t.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==jt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=g,t.invoke=function(n,t){var r=kt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Mt,t.map=S,t.max=N,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return _t.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) -}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Mt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Nt(0,e+r):Bt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=st,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Ft();return n%1||t%1?n+Bt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+mt(r*(t-n+1)) -},t.reduce=F,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Mt(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Y).source+"|"+(e.interpolate||Y).source+"|"+(e.evaluate||Y).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(nt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t -}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(c){throw c.source=i,c}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,c)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=F,t.foldr=k,t.include=w,t.inject=F,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return kt.call(n,Nt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=pt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Rt.spliceObjects&&0===n.length&&delete n[0],this -}}),E(["concat","join","slice"],function(n){var r=pt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t}(this); \ No newline at end of file +;!function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; +if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=$t(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; +t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Bt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Mt.fastBind||xt&&2"']/g,tt=/['\n\r\t\u2028\u2029\\]/g,rt="[object Arguments]",et="[object Array]",ut="[object Boolean]",ot="[object Date]",it="[object Number]",at="[object Object]",ft="[object RegExp]",lt="[object String]",ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},pt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},st=Array.prototype,J=Object.prototype,vt=n._,ht=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,yt=n.clearTimeout,mt=st.concat,_t=Math.floor,bt=Function.prototype.toString,dt=J.hasOwnProperty,jt=st.push,wt=n.setTimeout,At=J.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Ft=n.isNaN,Nt=ht.test(Nt=Object.keys)&&Nt,Bt=Math.max,kt=Math.min,qt=Math.random,Rt=st.slice,J=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+J),Mt={}; +!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(st.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,c(arguments)||(c=function(n){return n?dt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==et:!1},Et=function(n){var t,r=[];if(!n||!ct[typeof n])return r; +for(t in n)dt.call(n,t)&&r.push(t);return r},$t=Nt?function(n){return _(n)?Nt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=h(It),Ct=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},Pt=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(dt.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=h,t.invoke=function(n,t){var r=Rt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=S,t.max=F,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return dt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) +}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?0:r);++tr?Bt(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=vt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+_t(r*(t-n+1)) +},t.reduce=B,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Z).source+"|"+(e.interpolate||Z).source+"|"+(e.evaluate||Z).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(tt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t +}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,l)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=B,t.foldr=k,t.include=w,t.inject=B,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Bt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=st[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this +}}),E(["concat","join","slice"],function(n){var r=st[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t}(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 89f5988916..2a13d5840d 100644 --- a/doc/README.md +++ b/doc/README.md @@ -217,7 +217,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3410 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3460 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -241,7 +241,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3440 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3490 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -266,7 +266,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3476 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3526 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -294,7 +294,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3546 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3596 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -354,7 +354,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3608 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3658 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -397,7 +397,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3661 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3711 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -429,7 +429,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3735 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3785 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -486,7 +486,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3769 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3819 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -510,7 +510,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3861 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3903 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -567,7 +567,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3902 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3944 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -596,7 +596,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3943 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3985 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -634,7 +634,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4022 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4064 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -694,7 +694,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4086 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4128 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -743,7 +743,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4118 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4160 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -767,7 +767,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4210 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -814,7 +814,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4226 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4262 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -838,7 +838,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4252 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4288 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -863,7 +863,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4272 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4308 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -887,7 +887,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4294 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4330 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -922,7 +922,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L309 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L313 "View in source") [Ⓣ][1] Creates a `lodash` object, which wraps the given `value`, to enable method chaining. @@ -978,7 +978,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5368 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5407 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1008,7 +1008,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5385 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5424 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1029,7 +1029,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5402 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5441 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1060,7 +1060,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2399 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2449 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1088,7 +1088,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2441 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2491 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1126,7 +1126,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2495 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2545 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1162,7 +1162,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2547 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2597 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1208,7 +1208,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2608 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2658 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1254,7 +1254,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2675 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2725 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1303,7 +1303,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2722 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1335,7 +1335,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2822 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1372,7 +1372,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2805 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2855 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1401,7 +1401,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2857 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2907 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1446,7 +1446,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2914 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2964 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1488,7 +1488,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2983 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3033 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1530,7 +1530,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3033 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1560,7 +1560,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3065 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3115 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1598,7 +1598,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3108 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3158 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1629,7 +1629,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3218 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1672,7 +1672,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3189 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3239 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1696,7 +1696,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3222 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3272 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1726,7 +1726,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3269 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3319 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1772,7 +1772,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3325 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3375 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1809,7 +1809,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3360 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3410 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1833,7 +1833,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3392 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3442 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1870,7 +1870,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4334 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4370 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1898,7 +1898,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4367 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4403 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1929,7 +1929,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4398 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4434 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1960,7 +1960,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4444 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4480 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2001,7 +2001,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4467 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4503 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2028,7 +2028,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4526 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4562 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2082,7 +2082,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4602 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4638 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2115,7 +2115,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4652 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4691 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2140,7 +2140,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4678 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4717 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2167,7 +2167,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4702 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4741 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2193,7 +2193,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4732 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4771 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2219,7 +2219,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4767 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4806 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2246,7 +2246,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4798 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4837 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2283,7 +2283,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4831 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4870 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2315,7 +2315,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4896 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4935 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2351,7 +2351,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1155 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1205 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2389,7 +2389,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1210 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1260 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2436,7 +2436,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1335 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1385 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2482,7 +2482,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1359 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1409 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2508,7 +2508,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1381 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1431 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2536,7 +2536,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1422 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1472 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2572,7 +2572,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1447 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1497 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2600,7 +2600,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1464 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1514 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2627,7 +2627,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1489 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1539 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2652,7 +2652,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1506 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2676,7 +2676,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1018 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1068 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2703,7 +2703,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1044 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1094 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2730,7 +2730,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1532 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1582 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2754,7 +2754,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1549 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1599 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2778,7 +2778,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1566 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1616 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2802,7 +2802,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1591 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1641 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2832,7 +2832,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1650 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1700 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2877,7 +2877,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1831 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1881 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2915,7 +2915,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1848 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1898 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2939,7 +2939,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1911 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1961 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2974,7 +2974,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1933 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1983 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3001,7 +3001,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1950 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2000 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3025,7 +3025,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1878 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1928 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3055,7 +3055,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1978 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2028 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3090,7 +3090,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2003 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2053 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3114,7 +3114,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2020 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2070 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3138,7 +3138,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2037 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2087 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3162,7 +3162,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1077 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1127 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3186,7 +3186,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2096 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2146 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3242,7 +3242,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2205 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2255 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3273,7 +3273,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2239 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2289 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3297,7 +3297,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2277 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2327 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3328,7 +3328,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2331 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2381 "View in source") [Ⓣ][1] Transforms an `object` to an new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback`is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3365,7 +3365,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2364 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2414 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3396,7 +3396,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4920 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4959 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3420,7 +3420,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4938 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4977 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3445,7 +3445,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4964 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5003 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3475,7 +3475,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4993 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5032 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3495,7 +3495,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5017 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5056 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3522,7 +3522,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5040 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5079 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3550,7 +3550,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5084 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5123 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3585,7 +3585,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L150 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L153 "View in source") [Ⓣ][1] Create a new `lodash` function using the given `context` object. @@ -3603,7 +3603,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5207 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3685,7 +3685,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5293 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5332 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3717,7 +3717,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5320 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5359 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3741,7 +3741,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5340 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5379 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3775,7 +3775,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L505 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L509 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3794,7 +3794,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5582 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5621 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3806,7 +3806,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L323 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L327 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3818,7 +3818,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L348 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L352 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3830,7 +3830,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L340 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L344 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3842,7 +3842,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L357 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L361 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -3854,7 +3854,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L370 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L374 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3868,7 +3868,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L378 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L382 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3880,7 +3880,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L395 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L399 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3892,7 +3892,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L406 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L410 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3906,7 +3906,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L386 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L390 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3918,7 +3918,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L420 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L424 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3932,7 +3932,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L431 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L435 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3946,7 +3946,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L457 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L461 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3958,7 +3958,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L465 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L469 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3970,7 +3970,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L473 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L477 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3982,7 +3982,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L481 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L485 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3994,7 +3994,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L489 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L493 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -4006,7 +4006,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L497 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L501 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. From 9ffcd382b4c102ae641f7b142775c0daf7214631 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 21 May 2013 00:30:49 -0700 Subject: [PATCH 057/117] Have build.js remove `createCache` if it's not called in the source. Former-commit-id: 399d1e19b96b2084cc8cd459d297129db1bda071 --- build.js | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/build.js b/build.js index 94f145c81f..ad07ea34e1 100755 --- a/build.js +++ b/build.js @@ -2698,9 +2698,6 @@ // unexpose `lodash.support` source = source.replace(/lodash\.support *= */, ''); - // remove large array optimizations - source = removeFunction(source, 'createCache'); - // replace `slice` with `nativeSlice.call` source = removeFunction(source, 'slice'); source = source.replace(/([^.])\bslice\(/g, '$1nativeSlice.call('); @@ -3118,10 +3115,7 @@ .replace(/(?:\s*\/\/.*)*\n( *)(?:each|forEach)\(\['[\s\S]+?\n\1}.+/g, '') .replace(/(?:\s*\/\/.*)*\n *lodash\.prototype.[\s\S]+?;/g, ''); } - if (!/\beach\(/.test(source)) { - source = source.replace(matchFunction(source, 'each'), ''); - } - if ((source.match(/\bcreateIterator\b/g) || []).length < 2) { + if (_.size(source.match(/\bcreateIterator\b/g)) < 2) { source = removeFunction(source, 'createIterator'); source = removeVar(source, 'defaultsIteratorOptions'); source = removeVar(source, 'eachIteratorOptions'); @@ -3130,6 +3124,24 @@ source = removeVar(source, 'templateIterator'); source = removeSupportNonEnumShadows(source); } + if (_.size(source.match(/\bcreateCache\b/g)) < 2) { + source = removeFunction(source, 'createCache'); + } + if (!/\beach\(/.test(source)) { + source = source.replace(matchFunction(source, 'each'), ''); + } + if (!/^ *support\.(?:enumErrorProps|nonEnumShadows) *=/m.test(source)) { + source = removeVar(source, 'Error'); + source = removeVar(source, 'errorProto'); + source = removeFromCreateIterator(source, 'errorClass'); + source = removeFromCreateIterator(source, 'errorProto'); + + // remove 'Error' from the `contextProps` array + source = source.replace(/^ *var contextProps *=[\s\S]+?;/m, function(match) { + return match.replace(/'Error', */, ''); + }); + } + // remove code used to resolve unneeded `support` properties source = source.replace(/^ *\(function[\s\S]+?\n(( *)var ctor *= *function[\s\S]+?(?:\n *for.+)+\n)([\s\S]+?)}\(1\)\);\n/m, function(match, setup, indent, body) { var modified = setup; @@ -3163,17 +3175,6 @@ if (_.size(source.match(/\bfreeExports\b/g)) < 2) { source = removeVar(source, 'freeExports'); } - if (!/^ *support\.(?:enumErrorProps|nonEnumShadows) *=/m.test(source)) { - source = removeVar(source, 'Error'); - source = removeVar(source, 'errorProto'); - source = removeFromCreateIterator(source, 'errorClass'); - source = removeFromCreateIterator(source, 'errorProto'); - - // remove 'Error' from the `contextProps` array - source = source.replace(/^ *var contextProps *=[\s\S]+?;/m, function(match) { - return match.replace(/'Error', */, ''); - }); - } debugSource = cleanupSource(source); source = cleanupSource(source); From f8e67b8e68e590295c68fe54d639cf2246a0d6b4 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 21 May 2013 08:42:13 -0700 Subject: [PATCH 058/117] Remove the binding optimization from all but the `modern` build. Former-commit-id: 1023ccc976e180425dabaa1b61e873e542aa3c2a --- build.js | 25 ++++++++++++++- dist/lodash.underscore.js | 6 +--- dist/lodash.underscore.min.js | 58 +++++++++++++++++------------------ 3 files changed, 54 insertions(+), 35 deletions(-) diff --git a/build.js b/build.js index ad07ea34e1..4faf7e4942 100755 --- a/build.js +++ b/build.js @@ -1095,6 +1095,26 @@ return source.replace(getCreateObjectFallback(source), ''); } + /** + * Removes the binding optimization from `source`. + * + * @private + * @param {String} source The source to process. + * @returns {String} Returns the modified source. + */ + function removeBindingOptimization(source) { + source = removeVar(source, 'fnToString'); + source = removeVar(source, 'reThis'); + + // remove `reThis` from `createCallback` + source = source.replace(matchFunction(source, 'createCallback'), function(match) { + return match.replace(/\s*\|\|\s*\(reThis[\s\S]+?\)\)\)/, ''); + }); + + return source; + } + + /** * Removes the `Object.keys` object iteration optimization from `source`. * @@ -1270,7 +1290,7 @@ // remove `support.nonEnumArgs` from `_.keys` source = source.replace(matchFunction(source, 'keys'), function(match) { return match - .replace(/(?:\s*\|\|\s*)?\(support\.nonEnumArgs[^)]+\)\)/, '') + .replace(/(?:\s*\|\|\s*)?\(support\.nonEnumArgs[\s\S]+?\)\)/, '') .replace(/\s*if *\(\s*\)[^}]+}/, ''); }); @@ -2044,6 +2064,9 @@ ].join('\n')); } } + if (isLegacy || isMobile || isUnderscore) { + source = removeBindingOptimization(source); + } if (isMobile || isUnderscore) { source = removeKeysOptimization(source); source = removeSetImmediate(source); diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 9fc89d6a2b..625d5b051b 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -56,9 +56,6 @@ /** Used to match "interpolate" template delimiters */ var reInterpolate = /<%=([\s\S]+?)%>/g; - /** Used to detect functions containing a `this` reference */ - var reThis = (reThis = /\bthis\b/) && reThis.test(function() { return this; }) && reThis; - /** Used to ensure capturing order of template delimiters */ var reNoMatch = /($^)/; @@ -126,7 +123,6 @@ clearTimeout = window.clearTimeout, concat = arrayProto.concat, floor = Math.floor, - fnToString = Function.prototype.toString, hasOwnProperty = objectProto.hasOwnProperty, push = arrayProto.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, @@ -3481,7 +3477,7 @@ return result; }; } - if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) { + if (typeof thisArg == 'undefined') { return func; } if (argCount === 1) { diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 2e4e043098..3df50eeb59 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,32 +4,32 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function N(n,t){var r=-1,e=n?n.length:0; -if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=$t(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; -t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Bt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Mt.fastBind||xt&&2"']/g,tt=/['\n\r\t\u2028\u2029\\]/g,rt="[object Arguments]",et="[object Array]",ut="[object Boolean]",ot="[object Date]",it="[object Number]",at="[object Object]",ft="[object RegExp]",lt="[object String]",ct={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},pt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},st=Array.prototype,J=Object.prototype,vt=n._,ht=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,yt=n.clearTimeout,mt=st.concat,_t=Math.floor,bt=Function.prototype.toString,dt=J.hasOwnProperty,jt=st.push,wt=n.setTimeout,At=J.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Ft=n.isNaN,Nt=ht.test(Nt=Object.keys)&&Nt,Bt=Math.max,kt=Math.min,qt=Math.random,Rt=st.slice,J=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+J),Mt={}; -!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(st.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,c(arguments)||(c=function(n){return n?dt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==et:!1},Et=function(n){var t,r=[];if(!n||!ct[typeof n])return r; -for(t in n)dt.call(n,t)&&r.push(t);return r},$t=Nt?function(n){return _(n)?Nt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=h(It),Ct=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},Pt=function(n,t){var r;if(!n||!ct[typeof n])return n;for(r in n)if(dt.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=h,t.invoke=function(n,t){var r=Rt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=S,t.max=F,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return dt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) -}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?0:r);++tr?Bt(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=vt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+_t(r*(t-n+1)) -},t.reduce=B,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Z).source+"|"+(e.interpolate||Z).source+"|"+(e.evaluate||Z).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(tt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t -}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,l)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=B,t.foldr=k,t.include=w,t.inject=B,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Bt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=st[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this -}}),E(["concat","join","slice"],function(n){var r=st[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t}(this); \ No newline at end of file +;!function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function B(n,t){var r=-1,e=n?n.length:0; +if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Mt(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; +t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Nt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Rt.fastBind||wt&&2"']/g,nt=/['\n\r\t\u2028\u2029\\]/g,tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Number]",it="[object Object]",at="[object RegExp]",ft="[object String]",lt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},ct={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},pt=Array.prototype,J=Object.prototype,st=n._,vt=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,ht=n.clearTimeout,yt=pt.concat,mt=Math.floor,_t=J.hasOwnProperty,bt=pt.push,dt=n.setTimeout,jt=J.toString,wt=vt.test(wt=jt.bind)&&wt,At=vt.test(At=Object.create)&&At,xt=vt.test(xt=Array.isArray)&&xt,Ot=n.isFinite,Et=n.isNaN,St=vt.test(St=Object.keys)&&St,Nt=Math.max,Bt=Math.min,Ft=Math.random,kt=pt.slice,J=vt.test(n.attachEvent),qt=wt&&!/\n|true/.test(wt+J),Rt={}; +!function(){var n={0:1,length:1};Rt.fastBind=wt&&!qt,Rt.spliceObjects=(pt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},At||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,c(arguments)||(c=function(n){return n?_t.call(n,"callee"):!1});var Dt=xt||function(n){return n?typeof n=="object"&&jt.call(n)==rt:!1},xt=function(n){var t,r=[];if(!n||!lt[typeof n])return r; +for(t in n)_t.call(n,t)&&r.push(t);return r},Mt=St?function(n){return _(n)?St(n):[]}:xt,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=g(Tt),It=function(n,t){var r;if(!n||!lt[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},zt=function(n,t){var r;if(!n||!lt[typeof n])return n;for(r in n)if(_t.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==jt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=g,t.invoke=function(n,t){var r=kt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Mt,t.map=S,t.max=N,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return _t.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) +}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Mt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Nt(0,e+r):Bt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=st,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Ft();return n%1||t%1?n+Bt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+mt(r*(t-n+1)) +},t.reduce=F,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Mt(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Y).source+"|"+(e.interpolate||Y).source+"|"+(e.evaluate||Y).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(nt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t +}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,l)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=F,t.foldr=k,t.include=w,t.inject=F,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return kt.call(n,Nt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=pt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Rt.spliceObjects&&0===n.length&&delete n[0],this +}}),E(["concat","join","slice"],function(n){var r=pt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t}(this); \ No newline at end of file From c6420a910d7e2d3ced3e80485e351d6c2e0c90cb Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 21 May 2013 09:14:37 -0700 Subject: [PATCH 059/117] Cleanup `getJavaOptions` in build/minify.js. Former-commit-id: 74a6ddf40eadcfd66c0da243d2496b45bc89d8a1 --- build/minify.js | 57 ++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/build/minify.js b/build/minify.js index 4d9c8997f1..b6c5d76542 100755 --- a/build/minify.js +++ b/build/minify.js @@ -59,32 +59,6 @@ }; }()); - /** - * Retrieves the Java command-line options used for faster minification by - * the Closure Compiler, invoking the `callback` when finished. Subsequent - * invocations will lazily return the original options. The callback is - * invoked with one argument: `(javaOptions)`. - * - * See https://code.google.com/p/closure-compiler/wiki/FAQ#What_are_the_recommended_Java_VM_command-line_options?. - * - * @param {Function} callback The function called once the options have - * been retrieved. - */ - function getJavaOptions(callback) { - var javaOptions = []; - cp.exec('java -version -client -d32', function(error) { - if (!error && process.platform != 'win32') { - javaOptions.push('-client', '-d32'); - } - getJavaOptions = function getJavaOptions(callback) { - process.nextTick(function () { - callback(javaOptions); - }); - }; - callback(javaOptions); - }); - } - /** The Closure Compiler optimization modes */ var optimizationModes = { 'simple': 'SIMPLE_OPTIMIZATIONS', @@ -350,6 +324,30 @@ }); } + /** + * Retrieves the Java command-line options used for faster minification by + * the Closure Compiler, invoking the `callback` when finished. Subsequent + * calls will lazily return the previously retrieved options. The `callback` + * is invoked with one argument; (options). + * + * See https://code.google.com/p/closure-compiler/wiki/FAQ#What_are_the_recommended_Java_VM_command-line_options?. + * + * @private + * @param {Function} callback The function called once the options have been retrieved. + */ + function getJavaOptions(callback) { + var result = []; + cp.exec('java -version -client -d32', function(error) { + if (!error && process.platform != 'win32') { + result.push('-client', '-d32'); + } + getJavaOptions = function(callback) { + _.defer(callback, result); + }; + callback(result); + }); + } + /** * Resolves the source map path from the given output path. * @@ -376,6 +374,7 @@ var filePath = this.filePath, isAdvanced = mode == 'advanced', isMapped = this.isMapped, + isSilent = this.isSilent, options = closureOptions.slice(), outputPath = this.outputPath, mapPath = getMapPath(outputPath), @@ -402,9 +401,9 @@ options.push('--create_source_map=' + mapPath, '--source_map_format=V3'); } - getJavaOptions(function onJavaOptions(javaOptions) { + getJavaOptions(function(javaOptions) { var compiler = cp.spawn('java', javaOptions.concat('-jar', closurePath, options)); - if (!this.isSilent) { + if (!isSilent) { console.log('Compressing ' + path.basename(outputPath, '.js') + ' using the Closure Compiler (' + mode + ')...'); } @@ -454,7 +453,7 @@ // proxy the standard input to the Closure Compiler compiler.stdin.end(source); - }.bind(this)); + }); } /** From d5459f59967645c31fb810139cc8453dca603dec Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 21 May 2013 10:46:07 -0700 Subject: [PATCH 060/117] Reduce test/test-build.js travis-ci time limit. Former-commit-id: c71f8dec6e7cbd81d8693bd52f1f2d0ef78149a7 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index a60089eef9..01fe2ef456 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ env: - TEST_COMMAND="phantomjs ./test/test.js ../dist/lodash.compat.min.js" - TEST_COMMAND="node ./test/test.js ../dist/lodash.js" - TEST_COMMAND="node ./test/test.js ../dist/lodash.min.js" - - TEST_COMMAND="node ./test/test-build.js --time-limit 49m30s" + - TEST_COMMAND="node ./test/test-build.js --time-limit 48m" git: depth: 1 branches: From e93e1ddeb9d7231bf21dfbedbe40033b3d4ebc41 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 23 May 2013 20:22:12 -0700 Subject: [PATCH 061/117] Add private function dependencies to help reduce dead code in non-minified builds and allow turning them into modules as part of the `modularize` build option. Former-commit-id: e9118c47ae2b66e86332a02b4279999b99b8c429 --- build.js | 315 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 199 insertions(+), 116 deletions(-) diff --git a/build.js b/build.js index 4faf7e4942..aa15dfc2f7 100755 --- a/build.js +++ b/build.js @@ -23,6 +23,9 @@ /** Shortcut used to push arrays of values to an array */ var push = arrayProto.push; + /** Used to create regexes that may detect multi-line comment blocks */ + var multilineComment = '(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n'; + /** Used to detect the Node.js executable in command-line arguments */ var reNode = RegExp('(?:^|' + path.sepEscaped + ')node(?:\\.exe)?$'); @@ -76,41 +79,41 @@ /** Used to track function dependencies */ var dependencyMap = { 'after': [], - 'assign': ['isArray', 'keys'], + 'assign': ['createIterator', 'isArguments', 'keys'], 'at': ['isString'], - 'bind': ['isFunction', 'isObject'], + 'bind': ['createBound'], 'bindAll': ['bind', 'functions'], - 'bindKey': ['isFunction', 'isObject'], - 'clone': ['assign', 'forEach', 'forOwn', 'isArray', 'isObject'], + 'bindKey': ['createBound'], + 'clone': ['assign', 'forEach', 'forOwn', 'isArray', 'isObject', 'isNode', 'slice'], 'cloneDeep': ['clone'], 'compact': [], 'compose': [], - 'contains': ['indexOf', 'isString'], + 'contains': ['basicEach', 'basicIndexOf', 'isString'], 'countBy': ['createCallback', 'forEach'], 'createCallback': ['identity', 'isEqual', 'keys'], 'debounce': ['isObject'], - 'defaults': ['isArray', 'keys'], + 'defaults': ['createIterator', 'isArguments', 'keys'], 'defer': ['bind'], 'delay': [], - 'difference': ['indexOf'], - 'escape': [], - 'every': ['createCallback', 'isArray'], - 'filter': ['createCallback', 'isArray'], - 'find': ['createCallback', 'forEach', 'isArray'], + 'difference': ['basicIndexOf', 'createCache'], + 'escape': ['escapeHtmlChar'], + 'every': ['basicEach', 'createCallback', 'isArray'], + 'filter': ['basicEach', 'createCallback', 'isArray'], + 'find': ['basicEach', 'createCallback', 'isArray'], 'findIndex': ['createCallback'], - 'findKey': ['createCallback'], - 'first': [], - 'flatten': ['createCallback', 'isArray'], - 'forEach': ['createCallback', 'isArguments', 'isArray', 'isString', 'keys'], - 'forIn': ['createCallback', 'isArguments'], - 'forOwn': ['createCallback', 'isArguments', 'keys'], + 'findKey': ['createCallback', 'forOwn'], + 'first': ['slice'], + 'flatten': ['isArray', 'overloadWrapper'], + 'forEach': ['basicEach', 'createCallback', 'isArguments', 'isArray', 'isString', 'keys'], + 'forIn': ['createCallback', 'createIterator', 'isArguments'], + 'forOwn': ['createCallback', 'createIterator', 'isArguments', 'keys'], 'functions': ['forIn', 'isFunction'], 'groupBy': ['createCallback', 'forEach'], 'has': [], 'identity': [], - 'indexOf': ['sortedIndex'], - 'initial': [], - 'intersection': ['indexOf'], + 'indexOf': ['basicIndexOf', 'sortedIndex'], + 'initial': ['slice'], + 'intersection': ['basicIndexOf', 'createCache'], 'invert': ['keys'], 'invoke': ['forEach'], 'isArguments': [], @@ -119,60 +122,60 @@ 'isDate': [], 'isElement': [], 'isEmpty': ['forOwn', 'isArguments', 'isFunction'], - 'isEqual': ['forIn', 'isArguments', 'isFunction'], + 'isEqual': ['forIn', 'isArguments', 'isFunction', 'isNode'], 'isFinite': [], 'isFunction': [], 'isNaN': ['isNumber'], 'isNull': [], 'isNumber': [], 'isObject': [], - 'isPlainObject': ['forIn', 'isArguments', 'isFunction'], + 'isPlainObject': ['isArguments', 'shimIsPlainObject'], 'isRegExp': [], 'isString': [], 'isUndefined': [], - 'keys': ['forOwn', 'isArguments', 'isObject'], - 'last': [], + 'keys': ['isArguments', 'isObject', 'shimKeys'], + 'last': ['slice'], 'lastIndexOf': [], - 'map': ['createCallback', 'isArray'], - 'max': ['createCallback', 'isArray', 'isString'], + 'map': ['basicEach', 'createCallback', 'isArray'], + 'max': ['basicEach', 'charAtCallback', 'createCallback', 'isArray', 'isString'], 'memoize': [], 'merge': ['forEach', 'forOwn', 'isArray', 'isObject', 'isPlainObject'], - 'min': ['createCallback', 'isArray', 'isString'], + 'min': ['basicEach', 'charAtCallback', 'createCallback', 'isArray', 'isString'], 'mixin': ['forEach', 'functions'], 'noConflict': [], - 'omit': ['forIn', 'indexOf'], + 'omit': ['basicIndexOf', 'forIn'], 'once': [], 'pairs': ['keys'], 'parseInt': ['isString'], - 'partial': ['isFunction', 'isObject'], - 'partialRight': ['isFunction', 'isObject'], + 'partial': ['createBound'], + 'partialRight': ['createBound'], 'pick': ['forIn', 'isObject'], 'pluck': ['map'], 'random': [], 'range': [], - 'reduce': ['createCallback', 'isArray'], + 'reduce': ['basicEach', 'createCallback', 'isArray'], 'reduceRight': ['createCallback', 'forEach', 'isString', 'keys'], 'reject': ['createCallback', 'filter'], - 'rest': [], + 'rest': ['slice'], 'result': ['isFunction'], 'runInContext': ['defaults', 'pick'], 'shuffle': ['forEach'], 'size': ['keys'], - 'some': ['createCallback', 'isArray'], - 'sortBy': ['createCallback', 'forEach'], + 'some': ['basicEach', 'createCallback', 'isArray'], + 'sortBy': ['compareAscending', 'createCallback', 'forEach'], 'sortedIndex': ['createCallback', 'identity'], 'tap': ['value'], - 'template': ['defaults', 'escape', 'keys', 'values'], + 'template': ['defaults', 'escape', 'escapeStringChar', 'keys', 'values'], 'throttle': ['isObject'], 'times': ['createCallback'], - 'toArray': ['isString', 'values'], - 'transform': ['createCallback', 'forOwn', 'isArray', 'isObject'], - 'unescape': [], + 'toArray': ['isString', 'slice', 'values'], + 'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'], + 'unescape': ['unescapeHtmlChar'], 'union': ['isArray', 'uniq'], - 'uniq': ['createCallback', 'indexOf'], + 'uniq': ['basicIndexOf', 'createCache', 'overloadWrapper'], 'uniqueId': [], 'unzip': ['max', 'pluck'], - 'value': ['forOwn', 'isArray'], + 'value': ['basicEach', 'forOwn', 'isArray', 'lodashWrapper'], 'values': ['keys'], 'where': ['filter'], 'without': ['difference'], @@ -180,6 +183,27 @@ 'zip': ['unzip'], 'zipObject': [], + // private methods + 'basicEach': ['createIterator', 'isArguments', 'isArray', 'isString', 'keys'], + 'basicIndexOf': [], + 'charAtCallback': [], + 'compareAscending': [], + 'createBound': ['createObject', 'isFunction', 'isObject'], + 'createCache': ['basicIndexOf'], + 'createIterator': ['iteratorTemplate'], + 'createObject': [ 'isObject', 'noop'], + 'escapeHtmlChar': [], + 'escapeStringChar': [], + 'iteratorTemplate': [], + 'isNode': [], + 'lodashWrapper': [], + 'noop': [], + 'overloadWrapper': ['createCallback'], + 'shimIsPlainObject': ['forIn', 'isArguments', 'isFunction', 'isNode'], + 'shimKeys': ['createIterator', 'isArguments'], + 'slice': [], + 'unescapeHtmlChar': [], + // method used by the `backbone` and `underscore` builds 'chain': ['value'], 'findWhere': ['find'] @@ -196,7 +220,9 @@ 'shadowedProps', 'top', 'useHas', - 'useKeys' + 'useKeys', + 'shimIsPlainObject', + 'shimKyes' ]; /** List of all methods */ @@ -292,6 +318,37 @@ 'node' ]; + /** List of valid method categories */ + var methodCategories = [ + 'Arrays', + 'Chaining', + 'Collections', + 'Functions', + 'Objects', + 'Utilities' + ]; + + /** List of private methods */ + var privateMethods = [ + 'basicEach', + 'basicIndex', + 'charAtCallback', + 'compareAscending', + 'createBound', + 'createCache', + 'createIterator', + 'escapeHtmlChar', + 'escapeStringChar', + 'isNode', + 'iteratorTemplate', + 'lodashWrapper', + 'overloadWrapper', + 'shimIsPlainObject', + 'shimKeys', + 'slice', + 'unescapeHtmlChar' + ] + /*--------------------------------------------------------------------------*/ /** @@ -396,7 +453,7 @@ ].join('\n')); // replace wrapper `Array` method assignments - source = source.replace(/^(?:(?: *\/\/.*\n)*(?: *if *\(.+\n)?( *)(each|forEach)\(\['[\s\S]+?\n\1}\);(?:\n *})?\n+)+/m, function(match, indent, funcName) { + source = source.replace(/^(?:(?: *\/\/.*\n)*(?: *if *\(.+\n)?( *)(basicEach|forEach)\(\['[\s\S]+?\n\1}\);(?:\n *})?\n+)+/m, function(match, indent, funcName) { return indent + [ '// add `Array` mutator functions to the wrapper', funcName + "(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {", @@ -576,7 +633,7 @@ * @returns {String} Returns the capitalized string. */ function capitalize(string) { - return string[0].toUpperCase() + string.toLowerCase().slice(1); + return string[0].toUpperCase() + string.slice(1); } /** @@ -917,8 +974,13 @@ */ function matchFunction(source, funcName) { var result = source.match(RegExp( - // match multi-line comment block - '(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n' + + multilineComment + + // match variable declarations with `createIterator` or `overloadWrapper` + '( *)var ' + funcName + ' *=.*?(?:createIterator\\([\\s\\S]+?|overloadWrapper\\([\\s\\S]+?\\n\\1})\\);\\n' + )); + + result || (result = source.match(RegExp( + multilineComment + // begin non-capturing group '( *)(?:' + // match a function declaration @@ -927,17 +989,15 @@ 'var ' + funcName + ' *=.*?function[\\s\\S]+?\\n\\1};' + // end non-capturing group ')\\n' - )); + ))); - // match variables that are explicitly defined as functions result || (result = source.match(RegExp( - // match multi-line comment block - '(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n' + - // match simple variable declarations and those with `createIterator` - ' *var ' + funcName + ' *=(?:.+?|.*?createIterator\\([\\s\\S]+?\\));\\n' + multilineComment + + // match simple variable declarations + '( *)var ' + funcName + ' *=.+?;\\n' ))); - return /@type +Function|function\s*\w*\(/.test(result) ? result[0] : ''; + return /@type +Function|\b(?:function\s*\w*|createIterator|overloadWrapper)\(/.test(result) ? result[0] : ''; } /** @@ -1025,7 +1085,7 @@ // remove function if (funcName == 'runInContext') { source = removeRunInContext(source, funcName); - } else if (funcName != 'each' && (snippet = matchFunction(source, funcName))) { + } else if ((snippet = matchFunction(source, funcName))) { source = source.replace(snippet, ''); } @@ -1453,8 +1513,7 @@ */ function removeSupportProp(source, propName) { return source.replace(RegExp( - // match multi-line comment block - '(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n' + + multilineComment + // match a `try` block '(?: *try\\b.+\\n)?' + // match the `support` property assignment @@ -1481,8 +1540,7 @@ source = removeFunction(source, varName); source = source.replace(RegExp( - // match multi-line comment block - '(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n' + + multilineComment + // match a variable declaration that's not part of a declaration list '( *)var ' + varName + ' *= *(?:.+?(?:;|&&\\n[^;]+;)|(?:\\w+\\(|{)[\\s\\S]+?\\n\\1.+?;)\\n|' + // match a variable in a declaration list @@ -1524,7 +1582,6 @@ return source; } - /** * Replaces the `support` object `propName` property value in `source` with `propValue`. * @@ -1830,7 +1887,7 @@ if (/^(category|exclude|include|minus|plus)=.+$/.test(value)) { var array = optionToArray(value); accumulator = _.union(accumulator, /^category=.*$/.test(value) - ? array.map(capitalize) + ? array.map(function(category) { return capitalize(category.toLowerCase()); }) : array.filter(function(category) { return /^[A-Z]/.test(category); }) ); } @@ -1848,7 +1905,12 @@ if (isModern) { dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); - if (!isMobile) { + if (isMobile) { + _.each(['assign', 'defaults'], function(methodName) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'keys'); + }); + } + else { _.each(['isEmpty', 'isEqual', 'isPlainObject', 'keys'], function(methodName) { dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isArguments'); }); @@ -1890,15 +1952,20 @@ } }); + _.each(['difference', 'intersection', 'uniq'], function(methodName) { + if (!useLodashMethod(methodName)) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'createCache'); + } + }); + _.each(['max', 'min'], function(methodName) { if (!useLodashMethod(methodName)) { - dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isArray', 'isString'); + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'charAtCallback', 'isArray', 'isString'); } }); dependencyMap.findWhere = ['where']; dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); - dependencyMap.value = _.without(dependencyMap.value, 'isArray'); } if (isModern || isUnderscore) { _.each(['at', 'forEach', 'toArray'], function(methodName) { @@ -2006,20 +2073,20 @@ }); // replace `createObject` and `isArguments` with their fallbacks - _.each({ - 'createObject': { 'get': getCreateObjectFallback, 'remove': removeCreateObjectFallback }, - 'isArguments': { 'get': getIsArgumentsFallback, 'remove': removeIsArgumentsFallback } - }, - function(util, methodName) { + _.each(['createObject', 'isArguments'], function(methodName) { + var capitalized = capitalize(methodName), + get = eval('get' + capitalized + 'Fallback'), + remove = eval('remove' + capitalized + 'Fallback'); + source = source.replace(matchFunction(source, methodName).replace(RegExp('[\\s\\S]+?function ' + methodName), ''), function() { - var snippet = util.get(source), + var snippet = get(source), body = snippet.match(RegExp(methodName + ' *= *function([\\s\\S]+?\\n *});'))[1], indent = getIndent(snippet); return body.replace(RegExp('^' + indent, 'gm'), indent.slice(0, -2)) + '\n'; }); - source = util.remove(source); + source = remove(source); }); // replace `_.isPlainObject` with `shimIsPlainObject` @@ -2098,7 +2165,7 @@ ' }', ' }', ' } else {', - ' each(collection, callback);', + ' basicEach(collection, callback);', ' }', ' return collection;', '}', @@ -2118,7 +2185,7 @@ ' }', ' } else {', ' result = [];', - ' each(collection, function(value, key, collection) {', + ' basicEach(collection, function(value, key, collection) {', ' result[++index] = callback(value, key, collection);', ' });', ' }', @@ -2149,7 +2216,7 @@ match = match.replace(/^( *)var noaccum\b/m, '$1if (!collection) return accumulator;\n$&'); } else if (/^(?:max|min)$/.test(methodName)) { - match = match.replace(/\beach\(/, 'forEach('); + match = match.replace(/\bbasicEach\(/, 'forEach('); if (!isUnderscore) { return match; } @@ -2215,10 +2282,10 @@ 'function contains(collection, target) {', ' var length = collection ? collection.length : 0,', ' result = false;', - " if (typeof length == 'number') {", - ' result = indexOf(collection, target) > -1;', + " if (length && typeof length == 'number') {", + ' result = basicIndexOf(collection, target) > -1;', ' } else {', - ' each(collection, function(value) {', + ' basicEach(collection, function(value) {', ' return !(result = value === target);', ' });', ' }', @@ -2289,7 +2356,7 @@ '', ' while (++index < length) {', ' var value = array[index];', - ' if (indexOf(flattened, value) < 0) {', + ' if (basicIndexOf(flattened, value) < 0) {', ' result.push(value);', ' }', ' }', @@ -2330,10 +2397,10 @@ ' outer:', ' while (++index < length) {', ' var value = array[index];', - ' if (indexOf(result, value) < 0) {', + ' if (basicIndexOf(result, value) < 0) {', ' var argsIndex = argsLength;', ' while (--argsIndex) {', - ' if (indexOf(args[argsIndex], value) < 0) {', + ' if (basicIndexOf(args[argsIndex], value) < 0) {', ' continue outer;', ' }', ' }', @@ -2487,7 +2554,7 @@ ' result = {};', '', ' forIn(object, function(value, key) {', - ' if (indexOf(props, key) < 0) {', + ' if (basicIndexOf(props, key) < 0) {', ' result[key] = value;', ' }', ' });', @@ -2671,7 +2738,7 @@ '', ' if (isSorted', ' ? !index || seen[seen.length - 1] !== computed', - ' : indexOf(seen, computed) < 0', + ' : basicIndexOf(seen, computed) < 0', ' ) {', ' if (callback) {', ' seen.push(computed);', @@ -2822,20 +2889,25 @@ if (isUnderscore ? !_.contains(plusMethods, 'chain') : _.contains(plusMethods, 'chain')) { source = addChainMethods(source); } - // replace `each` references with `forEach` and `forOwn` + // replace `basicEach` references with `forEach` and `forOwn` if ((isUnderscore || (isModern && !isMobile)) && - _.contains(buildMethods, 'forEach') && - (_.contains(buildMethods, 'forOwn') || !useLodashMethod('forOwn')) - ) { - source = source - .replace(matchFunction(source, 'each'), '') - .replace(/^ *lodash\._each *=.+\n/gm, '') - .replace(/\beach(?=\(collection)/g, 'forOwn') - .replace(/(\?\s*)each(?=\s*:)/g, '$1forEach') - .replace(/\beach(?=\(\[)/g, 'forEach'); + _.contains(buildMethods, 'forEach') && _.contains(buildMethods, 'forOwn')) { + source = removeFunction(source, 'basicEach'); + + // remove `lodash._basicEach` pseudo property + source = source.replace(/^ *lodash\._basicEach *=.+\n/m, ''); + + // replace `basicEach` with `_.forOwn` in "Collections" methods + source = source.replace(/\bbasicEach(?=\(collection)/g, 'forOwn'); + + // replace `basicEach` with `_.forEach` in the rest of the methods + source = source.replace(/(\?\s*)basicEach(?=\s*:)/g, '$1forEach'); + + // replace `basicEach` with `_.forEach` in the method assignment snippet + source = source.replace(/\bbasicEach(?=\(\[)/g, 'forEach'); } - // modify `_.contains`, `_.every`, `_.find`, and `_.some` to use the private `indicatorObject` - if (isUnderscore && (/\beach\(/.test(source) || !useLodashMethod('forOwn'))) { + // modify `_.contains`, `_.every`, `_.find`, `_.some`, and `_.transform` to use the private `indicatorObject` + if (isUnderscore && (/\bbasicEach\(/.test(source) || !useLodashMethod('forOwn'))) { source = source.replace(matchFunction(source, 'every'), function(match) { return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); }); @@ -2844,6 +2916,10 @@ return match.replace(/return false/, 'return indicatorObject'); }); + source = source.replace(matchFunction(source, 'transform'), function(match) { + return match.replace(/return callback[^)]+\)/, '$& && indicatorObject'); + }); + _.each(['contains', 'some'], function(methodName) { source = source.replace(matchFunction(source, methodName), function(match) { return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;'); @@ -2884,6 +2960,8 @@ /*----------------------------------------------------------------------*/ if (isModern || isUnderscore) { + source = removeFunction(source, 'createIterator'); + // inline all functions defined with `createIterator` _.functions(lodash).forEach(function(methodName) { // strip leading underscores to match pseudo private functions @@ -2898,9 +2976,9 @@ }); if (isUnderscore) { - // unexpose "exit early" feature of `each`, `_.forEach`, `_.forIn`, and `_.forOwn` - _.each(['each', 'forEach', 'forIn', 'forOwn'], function(methodName) { - if (methodName == 'each' || !useLodashMethod(methodName)) { + // unexpose "exit early" feature of `basicEach`, `_.forEach`, `_.forIn`, and `_.forOwn` + _.each(['basicEach', 'forEach', 'forIn', 'forOwn'], function(methodName) { + if (methodName == 'basicEach' || !useLodashMethod(methodName)) { source = source.replace(matchFunction(source, methodName), function(match) { return match.replace(/=== *false\)/g, '=== indicatorObject)'); }); @@ -2922,9 +3000,9 @@ if (!useLodashMethod('createCallback')) { source = source.replace(/\blodash\.(createCallback\()\b/g, '$1'); } - // remove chainability from `each` and `_.forEach` + // remove chainability from `basicEach` and `_.forEach` if (!useLodashMethod('forEach')) { - _.each(['each', 'forEach'], function(methodName) { + _.each(['basicEach', 'forEach'], function(methodName) { source = source.replace(matchFunction(source, methodName), function(match) { return match .replace(/\n *return .+?([};\s]+)$/, '$1') @@ -3039,6 +3117,14 @@ if (isRemoved(source, 'clone', 'isEqual', 'isPlainObject')) { source = removeSupportNodeClass(source); } + if (isRemoved(source, 'createIterator')) { + source = removeVar(source, 'defaultsIteratorOptions'); + source = removeVar(source, 'eachIteratorOptions'); + source = removeVar(source, 'forOwnIteratorOptions'); + source = removeVar(source, 'iteratorTemplate'); + source = removeVar(source, 'templateIterator'); + source = removeSupportNonEnumShadows(source); + } if (isRemoved(source, 'createIterator', 'bind', 'keys')) { source = removeSupportProp(source, 'fastBind'); source = removeVar(source, 'isV8'); @@ -3052,11 +3138,14 @@ if (isRemoved(source, 'defer')) { source = removeSetImmediate(source); } + if (isRemoved(source, 'escape', 'unescape')) { + source = removeVar(source, 'htmlEscapes'); + source = removeVar(source, 'htmlUnescapes'); + } if (isRemoved(source, 'invert')) { source = replaceVar(source, 'htmlUnescapes', "{'&':'&','<':'<','>':'>','"':'\"',''':\"'\"}"); } if (isRemoved(source, 'isArguments')) { - source = removeIsArgumentsFallback(source); source = replaceSupportProp(source, 'argsClass', 'true'); } if (isRemoved(source, 'isArguments', 'isEmpty')) { @@ -3064,9 +3153,7 @@ } if (isRemoved(source, 'isArray')) { source = removeVar(source, 'nativeIsArray'); - } - if (isRemoved(source, 'isFunction')) { - source = removeIsFunctionFallback(source); + source = removeIsArrayFallback(source); } if (isRemoved(source, 'isPlainObject')) { source = removeFunction(source, 'shimIsPlainObject'); @@ -3135,23 +3222,19 @@ // remove all `lodash.prototype` additions source = source .replace(/(?:\s*\/\/.*)*\n( *)forOwn\(lodash, *function\(func, *methodName\)[\s\S]+?\n\1}.+/g, '') - .replace(/(?:\s*\/\/.*)*\n( *)(?:each|forEach)\(\['[\s\S]+?\n\1}.+/g, '') + .replace(/(?:\s*\/\/.*)*\n( *)(?:basicEach|forEach)\(\['[\s\S]+?\n\1}.+/g, '') .replace(/(?:\s*\/\/.*)*\n *lodash\.prototype.[\s\S]+?;/g, ''); } - if (_.size(source.match(/\bcreateIterator\b/g)) < 2) { - source = removeFunction(source, 'createIterator'); - source = removeVar(source, 'defaultsIteratorOptions'); - source = removeVar(source, 'eachIteratorOptions'); - source = removeVar(source, 'forOwnIteratorOptions'); - source = removeVar(source, 'iteratorTemplate'); - source = removeVar(source, 'templateIterator'); - source = removeSupportNonEnumShadows(source); - } - if (_.size(source.match(/\bcreateCache\b/g)) < 2) { - source = removeFunction(source, 'createCache'); - } - if (!/\beach\(/.test(source)) { - source = source.replace(matchFunction(source, 'each'), ''); + + // remove method fallbacks + _.each(['createObject', 'isArguments', 'isArray', 'isFunction'], function(methodName) { + if (_.size(source.match(RegExp(methodName + '\\(', 'g'))) < 2) { + source = eval('remove' + capitalize(methodName) + 'Fallback')(source); + } + }); + + if (!/\bbasicEach\(/.test(source)) { + source = removeFunction(source, 'basicEach'); } if (!/^ *support\.(?:enumErrorProps|nonEnumShadows) *=/m.test(source)) { source = removeVar(source, 'Error'); From 6dc543ca187651a4493b517691df83c7caf4bfdb Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 23 May 2013 20:23:10 -0700 Subject: [PATCH 062/117] Rename internal `each` to `basicEach` and add internal `overloadWrapper` function. Former-commit-id: b12ea9977ab7b6da877aca5925a9fc59019bec93 --- lodash.js | 290 +++++++++++++++++++++++++++++------------------------- 1 file changed, 154 insertions(+), 136 deletions(-) diff --git a/lodash.js b/lodash.js index 6de91505d0..d34c622b3e 100644 --- a/lodash.js +++ b/lodash.js @@ -658,80 +658,25 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a function optimized to search large arrays for a given `value`, - * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. + * A basic version of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. * * @private * @param {Array} array The array to search. * @param {Mixed} value The value to search for. - * @returns {Boolean} Returns `true`, if `value` is found, else `false`. + * @param {Number} [fromIndex=0] The index to search from. + * @returns {Number} Returns the index of the matched value or `-1`. */ - function createCache(array) { - var bailout, - index = -1, - length = array.length, - isLarge = length >= largeArraySize, - objCache = {}; - - var caches = { - 'false': false, - 'function': false, - 'null': false, - 'number': {}, - 'object': objCache, - 'string': {}, - 'true': false, - 'undefined': false - }; - - function cacheContains(value) { - var type = typeof value; - if (type == 'boolean' || value == null) { - return caches[value]; - } - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; - - return type == 'object' - ? (cache[key] ? indexOf(cache[key], value) > -1 : false) - : !!cache[key]; - } - - function cachePush(value) { - var type = typeof value; - if (type == 'boolean' || value == null) { - caches[value] = true; - } else { - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; - - if (type == 'object') { - bailout = (cache[key] || (cache[key] = [])).push(value) == length; - } else { - cache[key] = true; - } - } - } - - function simpleContains(value) { - return indexOf(array, value) > -1; - } - - function simplePush(value) { - array.push(value); - } + function basicIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; - if (isLarge) { - while (++index < length) { - cachePush(array[index]); - } - if (bailout) { - isLarge = caches = objCache = null; + while (++index < length) { + if (array[index] === value) { + return index; } } - return isLarge - ? { 'contains': cacheContains, 'push': cachePush } - : { 'push': simplePush, 'contains' : simpleContains }; + return -1; } /** @@ -833,6 +778,86 @@ return bound; } + + /** + * Creates a function optimized to search large arrays for a given `value`, + * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. + * + * @private + * @param {Array} [array=[]] The array to search. + * @param {Mixed} value The value to search for. + * @returns {Boolean} Returns `true`, if `value` is found, else `false`. + */ + function createCache(array) { + array || (array = []); + + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; + + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; + + function basicContains(value) { + return basicIndexOf(array, value) > -1; + } + + function basicPush(value) { + array.push(value); + } + + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; + } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) + : !!cache[key]; + } + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } + } + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'contains': basicContains, 'push': basicPush }; + } + /** * Creates compiled iteration functions. * @@ -910,26 +935,26 @@ } /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. + * Used by `escape` to convert characters to HTML entities. * * @private * @param {String} match The matched character to escape. * @returns {String} Returns the escaped character. */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; + function escapeHtmlChar(match) { + return htmlEscapes[match]; } /** - * Used by `escape` to convert characters to HTML entities. + * Used by `template` to escape characters for inclusion in compiled + * string literals. * * @private * @param {String} match The matched character to escape. * @returns {String} Returns the escaped character. */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; + function escapeStringChar(match) { + return '\\' + stringEscapes[match]; } /** @@ -967,6 +992,29 @@ // no operation performed } + /** + * Creates a function that juggles arguments, allowing argument overloading + * for `_.flatten` and `_.uniq`, before passing them to the given `func`. + * + * @private + * @param {Function} func The function to wrap. + * @returns {Function} Returns the new function. + */ + function overloadWrapper(func) { + return function(array, flag, callback, thisArg) { + // juggle arguments + if (typeof flag != 'boolean' && flag != null) { + thisArg = callback; + callback = !(thisArg && thisArg[flag] === array) ? flag : undefined; + flag = false; + } + if (callback != null) { + callback = lodash.createCallback(callback, thisArg); + } + return func(array, flag, callback, thisArg); + }; + } + /** * A fallback implementation of `isPlainObject` which checks if a given `value` * is an object created by the `Object` constructor, assuming objects created @@ -1149,7 +1197,7 @@ * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array|Object|String} Returns `collection`. */ - var each = createIterator(eachIteratorOptions); + var basicEach = createIterator(eachIteratorOptions); /** * Used to convert characters to HTML entities: @@ -1334,7 +1382,7 @@ stackB.push(result); // recursively populate clone (susceptible to call stack limits) - (isArr ? each : forOwn)(value, function(objValue, key) { + (isArr ? basicEach : forOwn)(value, function(objValue, key) { result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); }); @@ -2264,7 +2312,7 @@ forIn(object, function(value, key, object) { if (isFunc ? !callback(value, key, object) - : indexOf(props, key) < 0 + : basicIndexOf(props, key) < 0 ) { result[key] = value; } @@ -2392,7 +2440,7 @@ accumulator = createObject(proto); } } - (isArr ? each : forOwn)(object, function(value, index, object) { + (isArr ? basicEach : forOwn)(object, function(value, index, object) { return callback(accumulator, value, index, object); }); return accumulator; @@ -2494,13 +2542,13 @@ result = false; fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; - if (typeof length == 'number') { + if (length && typeof length == 'number') { result = (isString(collection) ? collection.indexOf(target, fromIndex) - : indexOf(collection, target, fromIndex) + : basicIndexOf(collection, target, fromIndex) ) > -1; } else { - each(collection, function(value) { + basicEach(collection, function(value) { if (++index >= fromIndex) { return !(result = value === target); } @@ -2608,7 +2656,7 @@ } } } else { - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { return (result = !!callback(value, index, collection)); }); } @@ -2670,7 +2718,7 @@ } } } else { - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { if (callback(value, index, collection)) { result.push(value); } @@ -2737,7 +2785,7 @@ } } else { var result; - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { if (callback(value, index, collection)) { result = value; return false; @@ -2780,7 +2828,7 @@ } } } else { - each(collection, callback, thisArg); + basicEach(collection, callback, thisArg); } return collection; } @@ -2915,7 +2963,7 @@ result[index] = callback(collection[index], index, collection); } } else { - each(collection, function(value, key, collection) { + basicEach(collection, function(value, key, collection) { result[++index] = callback(value, key, collection); }); } @@ -2980,7 +3028,7 @@ ? charAtCallback : lodash.createCallback(callback, thisArg); - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { var current = callback(value, index, collection); if (current > computed) { computed = current; @@ -3049,7 +3097,7 @@ ? charAtCallback : lodash.createCallback(callback, thisArg); - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { var current = callback(value, index, collection); if (current < computed) { computed = current; @@ -3127,7 +3175,7 @@ accumulator = callback(accumulator, collection[index], index, collection); } } else { - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { accumulator = noaccum ? (noaccum = false, value) : callback(accumulator, value, index, collection) @@ -3330,7 +3378,7 @@ } } } else { - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { return !(result = callback(value, index, collection)); }); } @@ -3655,20 +3703,11 @@ * _.flatten(stooges, 'quotes'); * // => ['Oh, a wise guy, eh?', 'Poifect!', 'Spread out!', 'You knucklehead!'] */ - function flatten(array, isShallow, callback, thisArg) { + var flatten = overloadWrapper(function flatten(array, isShallow, callback) { var index = -1, length = array ? array.length : 0, result = []; - // juggle arguments - if (typeof isShallow != 'boolean' && isShallow != null) { - thisArg = callback; - callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined; - isShallow = false; - } - if (callback != null) { - callback = lodash.createCallback(callback, thisArg); - } while (++index < length) { var value = array[index]; if (callback) { @@ -3682,7 +3721,7 @@ } } return result; - } + }); /** * Gets the index at which the first occurrence of `value` is found using @@ -3709,21 +3748,14 @@ * // => 2 */ function indexOf(array, value, fromIndex) { - var index = -1, - length = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0) - 1; + var length = array ? array.length : 0; + fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); } else if (fromIndex) { - index = sortedIndex(array, value); + var index = sortedIndex(array, value); return array[index] === value ? index : -1; } - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; + return array ? basicIndexOf(array, value, fromIndex) : -1; } /** @@ -3819,7 +3851,7 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = createCache([]), + cache = createCache(), caches = {}, index = -1, length = array ? array.length : 0, @@ -4207,34 +4239,20 @@ * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ - function uniq(array, isSorted, callback, thisArg) { + var uniq = overloadWrapper(function(array, isSorted, callback) { var index = -1, length = array ? array.length : 0, + isLarge = !isSorted && length >= largeArraySize, result = [], - seen = result; + seen = isLarge ? createCache() : (callback ? [] : result); - // juggle arguments - if (typeof isSorted != 'boolean' && isSorted != null) { - thisArg = callback; - callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined; - isSorted = false; - } - // init value cache for large arrays - var isLarge = !isSorted && length >= largeArraySize; - if (callback != null) { - seen = []; - callback = lodash.createCallback(callback, thisArg); - } - if (isLarge) { - seen = createCache([]); - } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) + : (isLarge ? !seen.contains(computed) : basicIndexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); @@ -4243,7 +4261,7 @@ } } return result; - } + }); /** * The inverse of `_.zip`, this method splits groups of elements into arrays @@ -5626,7 +5644,7 @@ lodash.prototype.valueOf = wrapperValueOf; // add `Array` functions that return unwrapped values - each(['join', 'pop', 'shift'], function(methodName) { + basicEach(['join', 'pop', 'shift'], function(methodName) { var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return func.apply(this.__wrapped__, arguments); @@ -5634,7 +5652,7 @@ }); // add `Array` functions that return the wrapped value - each(['push', 'reverse', 'sort', 'unshift'], function(methodName) { + basicEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); @@ -5643,7 +5661,7 @@ }); // add `Array` functions that return new wrapped values - each(['concat', 'slice', 'splice'], function(methodName) { + basicEach(['concat', 'slice', 'splice'], function(methodName) { var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments)); @@ -5653,7 +5671,7 @@ // avoid array-like object bugs with `Array#shift` and `Array#splice` // in Firefox < 10 and IE < 9 if (!support.spliceObjects) { - each(['pop', 'shift', 'splice'], function(methodName) { + basicEach(['pop', 'shift', 'splice'], function(methodName) { var func = arrayProto[methodName], isSplice = methodName == 'splice'; @@ -5670,7 +5688,7 @@ } // add pseudo private property to be used and removed during the build process - lodash._each = each; + lodash._basicEach = basicEach; lodash._iteratorTemplate = iteratorTemplate; lodash._shimKeys = shimKeys; From 0efb4285c1f113cf646d6f0a6b1840a2c9a54716 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 23 May 2013 20:23:48 -0700 Subject: [PATCH 063/117] Make `capitalize` in test/test-build.js consistent with other areas. Former-commit-id: 2a4b6a2f394e474af2c3ca9376ec0ac2580e9bb9 --- test/test-build.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/test-build.js b/test/test-build.js index fe94670230..c1820730f4 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -334,7 +334,7 @@ * @returns {String} Returns the capitalized string. */ function capitalize(string) { - return string[0].toUpperCase() + string.toLowerCase().slice(1); + return string[0].toUpperCase() + string.slice(1); } /** @@ -1565,7 +1565,9 @@ } } if (/\bcategory=/.test(command)) { - methodNames = (methodNames || []).concat(command.match(/\bcategory=(\S*)/)[1].split(/, */).map(capitalize)); + methodNames = (methodNames || []).concat(command.match(/\bcategory=(\S*)/)[1].split(/, */).map(function(category) { + return capitalize(category.toLowerCase()); + })); } if (!methodNames) { methodNames = lodashMethods.slice(); From 5d583637c4bf0d9a825c6a1dbc1fc5ef5a87e1f4 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 24 May 2013 07:53:03 -0700 Subject: [PATCH 064/117] Clarify `_.uniq` doc example and rebuild files. [closes #282] Former-commit-id: b3ab9ae81af219dfb75b3f4339555530a6301f6e --- dist/lodash.compat.js | 297 ++++++++++++++++++---------------- dist/lodash.compat.min.js | 84 +++++----- dist/lodash.js | 263 ++++++++++++++++-------------- dist/lodash.min.js | 76 ++++----- dist/lodash.underscore.js | 177 ++++++++++++++++---- dist/lodash.underscore.min.js | 57 ++++--- doc/README.md | 220 ++++++++++++------------- lodash.js | 10 +- 8 files changed, 667 insertions(+), 517 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 4c77260c85..f5d596e89d 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -642,80 +642,25 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a function optimized to search large arrays for a given `value`, - * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. + * A basic version of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. * * @private * @param {Array} array The array to search. * @param {Mixed} value The value to search for. - * @returns {Boolean} Returns `true`, if `value` is found, else `false`. + * @param {Number} [fromIndex=0] The index to search from. + * @returns {Number} Returns the index of the matched value or `-1`. */ - function createCache(array) { - var bailout, - index = -1, - length = array.length, - isLarge = length >= largeArraySize, - objCache = {}; - - var caches = { - 'false': false, - 'function': false, - 'null': false, - 'number': {}, - 'object': objCache, - 'string': {}, - 'true': false, - 'undefined': false - }; - - function cacheContains(value) { - var type = typeof value; - if (type == 'boolean' || value == null) { - return caches[value]; - } - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; - - return type == 'object' - ? (cache[key] ? indexOf(cache[key], value) > -1 : false) - : !!cache[key]; - } - - function cachePush(value) { - var type = typeof value; - if (type == 'boolean' || value == null) { - caches[value] = true; - } else { - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; - - if (type == 'object') { - bailout = (cache[key] || (cache[key] = [])).push(value) == length; - } else { - cache[key] = true; - } - } - } - - function simpleContains(value) { - return indexOf(array, value) > -1; - } - - function simplePush(value) { - array.push(value); - } + function basicIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; - if (isLarge) { - while (++index < length) { - cachePush(array[index]); - } - if (bailout) { - isLarge = caches = objCache = null; + while (++index < length) { + if (array[index] === value) { + return index; } } - return isLarge - ? { 'contains': cacheContains, 'push': cachePush } - : { 'push': simplePush, 'contains' : simpleContains }; + return -1; } /** @@ -817,6 +762,85 @@ return bound; } + /** + * Creates a function optimized to search large arrays for a given `value`, + * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. + * + * @private + * @param {Array} [array=[]] The array to search. + * @param {Mixed} value The value to search for. + * @returns {Boolean} Returns `true`, if `value` is found, else `false`. + */ + function createCache(array) { + array || (array = []); + + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; + + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; + + function basicContains(value) { + return basicIndexOf(array, value) > -1; + } + + function basicPush(value) { + array.push(value); + } + + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; + } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) + : !!cache[key]; + } + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } + } + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'contains': basicContains, 'push': basicPush }; + } + /** * Creates compiled iteration functions. * @@ -892,26 +916,26 @@ } /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. + * Used by `escape` to convert characters to HTML entities. * * @private * @param {String} match The matched character to escape. * @returns {String} Returns the escaped character. */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; + function escapeHtmlChar(match) { + return htmlEscapes[match]; } /** - * Used by `escape` to convert characters to HTML entities. + * Used by `template` to escape characters for inclusion in compiled + * string literals. * * @private * @param {String} match The matched character to escape. * @returns {String} Returns the escaped character. */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; + function escapeStringChar(match) { + return '\\' + stringEscapes[match]; } /** @@ -949,6 +973,29 @@ // no operation performed } + /** + * Creates a function that juggles arguments, allowing argument overloading + * for `_.flatten` and `_.uniq`, before passing them to the given `func`. + * + * @private + * @param {Function} func The function to wrap. + * @returns {Function} Returns the new function. + */ + function overloadWrapper(func) { + return function(array, flag, callback, thisArg) { + // juggle arguments + if (typeof flag != 'boolean' && flag != null) { + thisArg = callback; + callback = !(thisArg && thisArg[flag] === array) ? flag : undefined; + flag = false; + } + if (callback != null) { + callback = lodash.createCallback(callback, thisArg); + } + return func(array, flag, callback, thisArg); + }; + } + /** * A fallback implementation of `isPlainObject` which checks if a given `value` * is an object created by the `Object` constructor, assuming objects created @@ -1131,7 +1178,7 @@ * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array|Object|String} Returns `collection`. */ - var each = createIterator(eachIteratorOptions); + var basicEach = createIterator(eachIteratorOptions); /** * Used to convert characters to HTML entities: @@ -1316,7 +1363,7 @@ stackB.push(result); // recursively populate clone (susceptible to call stack limits) - (isArr ? each : forOwn)(value, function(objValue, key) { + (isArr ? basicEach : forOwn)(value, function(objValue, key) { result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); }); @@ -2246,7 +2293,7 @@ forIn(object, function(value, key, object) { if (isFunc ? !callback(value, key, object) - : indexOf(props, key) < 0 + : basicIndexOf(props, key) < 0 ) { result[key] = value; } @@ -2374,7 +2421,7 @@ accumulator = createObject(proto); } } - (isArr ? each : forOwn)(object, function(value, index, object) { + (isArr ? basicEach : forOwn)(object, function(value, index, object) { return callback(accumulator, value, index, object); }); return accumulator; @@ -2476,13 +2523,13 @@ result = false; fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; - if (typeof length == 'number') { + if (length && typeof length == 'number') { result = (isString(collection) ? collection.indexOf(target, fromIndex) - : indexOf(collection, target, fromIndex) + : basicIndexOf(collection, target, fromIndex) ) > -1; } else { - each(collection, function(value) { + basicEach(collection, function(value) { if (++index >= fromIndex) { return !(result = value === target); } @@ -2590,7 +2637,7 @@ } } } else { - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { return (result = !!callback(value, index, collection)); }); } @@ -2652,7 +2699,7 @@ } } } else { - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { if (callback(value, index, collection)) { result.push(value); } @@ -2719,7 +2766,7 @@ } } else { var result; - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { if (callback(value, index, collection)) { result = value; return false; @@ -2762,7 +2809,7 @@ } } } else { - each(collection, callback, thisArg); + basicEach(collection, callback, thisArg); } return collection; } @@ -2897,7 +2944,7 @@ result[index] = callback(collection[index], index, collection); } } else { - each(collection, function(value, key, collection) { + basicEach(collection, function(value, key, collection) { result[++index] = callback(value, key, collection); }); } @@ -2962,7 +3009,7 @@ ? charAtCallback : lodash.createCallback(callback, thisArg); - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { var current = callback(value, index, collection); if (current > computed) { computed = current; @@ -3031,7 +3078,7 @@ ? charAtCallback : lodash.createCallback(callback, thisArg); - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { var current = callback(value, index, collection); if (current < computed) { computed = current; @@ -3109,7 +3156,7 @@ accumulator = callback(accumulator, collection[index], index, collection); } } else { - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { accumulator = noaccum ? (noaccum = false, value) : callback(accumulator, value, index, collection) @@ -3312,7 +3359,7 @@ } } } else { - each(collection, function(value, index, collection) { + basicEach(collection, function(value, index, collection) { return !(result = callback(value, index, collection)); }); } @@ -3637,20 +3684,11 @@ * _.flatten(stooges, 'quotes'); * // => ['Oh, a wise guy, eh?', 'Poifect!', 'Spread out!', 'You knucklehead!'] */ - function flatten(array, isShallow, callback, thisArg) { + var flatten = overloadWrapper(function flatten(array, isShallow, callback) { var index = -1, length = array ? array.length : 0, result = []; - // juggle arguments - if (typeof isShallow != 'boolean' && isShallow != null) { - thisArg = callback; - callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined; - isShallow = false; - } - if (callback != null) { - callback = lodash.createCallback(callback, thisArg); - } while (++index < length) { var value = array[index]; if (callback) { @@ -3664,7 +3702,7 @@ } } return result; - } + }); /** * Gets the index at which the first occurrence of `value` is found using @@ -3691,21 +3729,14 @@ * // => 2 */ function indexOf(array, value, fromIndex) { - var index = -1, - length = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0) - 1; + var length = array ? array.length : 0; + fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); } else if (fromIndex) { - index = sortedIndex(array, value); + var index = sortedIndex(array, value); return array[index] === value ? index : -1; } - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; + return array ? basicIndexOf(array, value, fromIndex) : -1; } /** @@ -3801,7 +3832,7 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = createCache([]), + cache = createCache(), caches = {}, index = -1, length = array ? array.length : 0, @@ -4150,7 +4181,7 @@ * Creates a duplicate-value-free version of the `array` using strict equality * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` * for `isSorted` will run a faster algorithm. If `callback` is passed, each - * element of `array` is passed through a `callback` before uniqueness is computed. + * element of `array` is passed through the `callback` before uniqueness is computed. * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is passed for `callback`, the created "_.pluck" style @@ -4179,44 +4210,30 @@ * _.uniq([1, 1, 2, 2, 3], true); * // => [1, 2, 3] * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return Math.floor(num); }); - * // => [1, 2, 3] + * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); + * // => ['A', 'b', 'C'] * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2, 3] + * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); + * // => [1, 2.5, 3] * * // using "_.pluck" callback shorthand * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ - function uniq(array, isSorted, callback, thisArg) { + var uniq = overloadWrapper(function(array, isSorted, callback) { var index = -1, length = array ? array.length : 0, + isLarge = !isSorted && length >= largeArraySize, result = [], - seen = result; + seen = isLarge ? createCache() : (callback ? [] : result); - // juggle arguments - if (typeof isSorted != 'boolean' && isSorted != null) { - thisArg = callback; - callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined; - isSorted = false; - } - // init value cache for large arrays - var isLarge = !isSorted && length >= largeArraySize; - if (callback != null) { - seen = []; - callback = lodash.createCallback(callback, thisArg); - } - if (isLarge) { - seen = createCache([]); - } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) + : (isLarge ? !seen.contains(computed) : basicIndexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); @@ -4225,7 +4242,7 @@ } } return result; - } + }); /** * The inverse of `_.zip`, this method splits groups of elements into arrays @@ -5608,7 +5625,7 @@ lodash.prototype.valueOf = wrapperValueOf; // add `Array` functions that return unwrapped values - each(['join', 'pop', 'shift'], function(methodName) { + basicEach(['join', 'pop', 'shift'], function(methodName) { var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return func.apply(this.__wrapped__, arguments); @@ -5616,7 +5633,7 @@ }); // add `Array` functions that return the wrapped value - each(['push', 'reverse', 'sort', 'unshift'], function(methodName) { + basicEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); @@ -5625,7 +5642,7 @@ }); // add `Array` functions that return new wrapped values - each(['concat', 'slice', 'splice'], function(methodName) { + basicEach(['concat', 'slice', 'splice'], function(methodName) { var func = arrayProto[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments)); @@ -5635,7 +5652,7 @@ // avoid array-like object bugs with `Array#shift` and `Array#splice` // in Firefox < 10 and IE < 9 if (!support.spliceObjects) { - each(['pop', 'shift', 'splice'], function(methodName) { + basicEach(['pop', 'shift', 'splice'], function(methodName) { var func = arrayProto[methodName], isSplice = methodName == 'splice'; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index fe35378b67..672016f21d 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,46 +4,46 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Sr(n)&&er.call(n,"__wrapped__")?n:new Q(n)}function T(n){function t(n){var t=typeof n;if("boolean"==t||null==n)return s[n];var r=s[t]||(t="object",p),e="number"==t?n:l+n;return"object"==t?r[e]?-1=c,p={},s={"false":!1,"function":!1,"null":!1,number:{},object:p,string:{},"true":!1,undefined:!1};if(f){for(;++ot||typeof n=="undefined")return 1;if(nk;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; -e+="}"}return(t.b||kr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Mt,er,nt,Sr,lt,Ir,a,Ut,q,wr,F,Vt,lr)}function K(n){return ot(n)?fr(n):{}}function M(n){return"\\"+D[n]}function U(n){return Nr[n]}function V(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function Q(n){this.__wrapped__=n}function W(){}function X(n){var t=!1;if(!n||lr.call(n)!=P||!kr.argsClass&&nt(n))return t;var r=n.constructor;return(at(r)?r instanceof r:kr.nodeClass||!V(n))?kr.ownLast?($r(n,function(n,r,e){return t=er.call(e,r),!1 -}),!0===t):($r(n,function(n,r){t=r}),!1===t||er.call(n,t)):t}function Y(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Ft(0>r?0:r);++er?hr(0,u+r):r)||0,typeof u=="number"?a=-1<(lt(n)?n.indexOf(t,r):kt(n,t,r)):Br(n,function(n){return++eu&&(u=i)}}else t=!t&<(n)?L:a.createCallback(t,r),Br(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n) -});return u}function dt(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Sr(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var l=Ir(n),o=l.length;else kr.unindexedChars&<(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),ht(n,function(n,e,a){e=l?l[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function _t(n,t,r){var e; -if(t=a.createCallback(t,r),Sr(n)){r=-1;for(var u=n.length;++rr?hr(0,u+r):r||0)-1;else if(r)return e=Et(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])=c;for(null!=e&&(f=[],e=a.createCallback(e,u)),p&&(f=T([]));++or?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var xr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Pr=et(Nr),zr=J(xr,{h:xr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Fr=J(xr),$r=J(Er,Or,{i:!1}),qr=J(Er,Or); -at(/x/)&&(at=function(n){return typeof n=="function"&&lr.call(n)==B});var Dr=rr?function(n){if(!n||lr.call(n)!=P||!kr.argsClass&&nt(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=rr(t))&&rr(r);return r?n==r||rr(n)==r:X(n)}:X,Rr=yt;Cr&&u&&typeof or=="function"&&(Bt=It(or,e));var Tr=8==mr(d+"08")?mr:function(n,t){return mr(lt(n)?n.replace(b,""):n,t||0)};return a.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=zr,a.at=function(n){var t=-1,r=Zt.apply(Kt,br.call(arguments,1)),e=r.length,u=Ft(e); -for(kr.unindexedChars&<(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),l=ir(e,t),a}},a.defaults=Fr,a.defer=Bt,a.delay=function(n,t){var e=br.call(arguments,2);return ir(function(){n.apply(r,e)},t)},a.difference=Ct,a.filter=gt,a.flatten=wt,a.forEach=ht,a.forIn=$r,a.forOwn=qr,a.functions=rt,a.groupBy=function(n,t,r){var e={}; -return t=a.createCallback(t,r),ht(n,function(n,r,u){r=Ht(t(n,r,u)),(er.call(e,r)?e[r]:e[r]=[]).push(n)}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return Y(n,0,yr(hr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=T([]),u={},a=-1,o=n?n.length:0,i=[];n:for(;++akt(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Ir(n),e=r.length,u=Ft(e);++tr?hr(0,e+r):yr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Pt,a.noConflict=function(){return e._=Qt,this},a.parseInt=Tr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=dr();return n%1||t%1?n+yr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+nr(r*(t-n+1))},a.reduce=dt,a.reduceRight=bt,a.result=function(n,t){var e=n?n[t]:r; -return at(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ir(n).length},a.some=_t,a.sortedIndex=Et,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=Fr({},e,u);var o,i=Fr({},e.imports,u.imports),u=Ir(i),i=ft(i),l=0,c=e.interpolate||_,g="__p+='",c=Gt((e.escape||_).source+"|"+c.source+"|"+(c===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(c,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(l,i).replace(j,M),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),l=i+t.length,t -}),g+="';\n",c=e=e.variable,c||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(c?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Dt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Ht(n).replace(g,Z)},a.uniqueId=function(n){var t=++o;return Ht(null==n?"":n)+t -},a.all=st,a.any=_t,a.detect=vt,a.foldl=dt,a.foldr=bt,a.include=pt,a.inject=dt,qr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ur.apply(t,arguments),n.apply(a,t)})}),a.first=jt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Y(n,hr(0,u-e))}},a.take=jt,a.head=jt,qr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); -return null==t||r&&typeof t!="function"?e:new Q(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Ht(this.__wrapped__)},a.prototype.value=zt,a.prototype.valueOf=zt,Br(["join","pop","shift"],function(n){var t=Kt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Br(["push","reverse","sort","unshift"],function(n){var t=Kt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Br(["concat","slice","splice"],function(n){var t=Kt[n];a.prototype[n]=function(){return new Q(t.apply(this.__wrapped__,arguments)) -}}),kr.spliceObjects||Br(["pop","shift","splice"],function(n){var t=Kt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new Q(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},l=+new Date+"",c=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),E="[object Arguments]",O="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; +;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Or(n)&&rr.call(n,"__wrapped__")?n:new W(n)}function T(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(n=l,p={},s={"false":!1,"function":!1,"null":!1,number:{},object:p,string:{},"true":!1,undefined:!1}; +if(f){for(;++ok;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; +e+="}"}return(t.b||wr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Kt,rr,rt,Or,ft,Ar,a,Mt,q,jr,F,Ut,ir)}function M(n){return ct(n)?lr(n):{}}function U(n){return Br[n]}function V(n){return"\\"+D[n]}function Q(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function W(n){this.__wrapped__=n}function X(){}function Y(n){return function(t,e,u,o){return typeof e!="boolean"&&null!=e&&(o=u,u=o&&o[e]===t?r:e,e=!1),null!=u&&(u=a.createCallback(u,o)),n(t,e,u,o) +}}function Z(n){var t=!1;if(!n||ir.call(n)!=P||!wr.argsClass&&rt(n))return t;var r=n.constructor;return(it(r)?r instanceof r:wr.nodeClass||!Q(n))?wr.ownLast?(Fr(n,function(n,r,e){return t=rr.call(e,r),!1}),!0===t):(Fr(n,function(n,r){t=r}),!1===t||rr.call(n,t)):t}function nt(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=zt(0>r?0:r);++er?vr(0,u+r):r)||0,u&&typeof u=="number"?a=-1<(ft(n)?n.indexOf(t,r):T(n,t,r)):Ir(n,function(n){return++eu&&(u=i)}}else t=!t&&ft(n)?L:a.createCallback(t,r),Ir(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n)});return u}function _t(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Or(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Ar(n),o=c.length;else wr.unindexedChars&&ft(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),mt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function jt(n,t,r){var e;if(t=a.createCallback(t,r),Or(n)){r=-1;for(var u=n.length;++r>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var kr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Nr=at(Br),Pr=K(kr,{h:kr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),zr=K(kr),Fr=K(xr,Er,{i:!1}),$r=K(xr,Er); +it(/x/)&&(it=function(n){return typeof n=="function"&&ir.call(n)==B});var qr=tr?function(n){if(!n||ir.call(n)!=P||!wr.argsClass&&rt(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=tr(t))&&tr(r);return r?n==r||tr(n)==r:Z(n)}:Z,Dr=dt,Rr=Y(function Gr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e=l,o=[],i=a?J():r?[]:o;++en?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Pr,a.at=function(n){var t=-1,r=Yt.apply(Jt,dr.call(arguments,1)),e=r.length,u=zt(e);for(wr.unindexedChars&&ft(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),c=or(e,t),a}},a.defaults=zr,a.defer=It,a.delay=function(n,t){var e=dr.call(arguments,2);return or(function(){n.apply(r,e)},t)},a.difference=wt,a.filter=ht,a.flatten=Rr,a.forEach=mt,a.forIn=Fr,a.forOwn=$r,a.functions=ut,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),mt(n,function(n,r,u){r=Gt(t(n,r,u)),(rr.call(e,r)?e[r]:e[r]=[]).push(n) +}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return nt(n,0,hr(vr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=J(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++aT(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Ar(n),e=r.length,u=zt(e);++tr?vr(0,e+r):r||0}else if(r)return r=Et(n,t),n[r]===t?r:-1;return n?T(n,t,r):-1},a.isArguments=rt,a.isArray=Or,a.isBoolean=function(n){return!0===n||!1===n||ir.call(n)==S},a.isDate=function(n){return n?typeof n=="object"&&ir.call(n)==A:!1 +},a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t;var r=ir.call(n),e=n.length;return r==O||r==F||(wr.argsClass?r==E:rt(n))||r==P&&typeof e=="number"&&it(n.splice)?!e:($r(n,function(){return t=!1}),t)},a.isEqual=ot,a.isFinite=function(n){return pr(n)&&!sr(parseFloat(n))},a.isFunction=it,a.isNaN=function(n){return lt(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=lt,a.isObject=ct,a.isPlainObject=qr,a.isRegExp=function(n){return!(!n||!q[typeof n])&&ir.call(n)==z +},a.isString=ft,a.isUndefined=function(n){return typeof n=="undefined"},a.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?vr(0,e+r):hr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Nt,a.noConflict=function(){return e._=Vt,this},a.parseInt=Lr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=mr();return n%1||t%1?n+hr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+Zt(r*(t-n+1))},a.reduce=_t,a.reduceRight=Ct,a.result=function(n,t){var e=n?n[t]:r; +return it(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ar(n).length},a.some=jt,a.sortedIndex=Et,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=zr({},e,u);var o,i=zr({},e.imports,u.imports),u=Ar(i),i=st(i),c=0,l=e.interpolate||_,g="__p+='",l=Lt((e.escape||_).source+"|"+l.source+"|"+(l===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t +}),g+="';\n",l=e=e.variable,l||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=qt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Gt(n).replace(g,tt)},a.uniqueId=function(n){var t=++o;return Gt(null==n?"":n)+t +},a.all=vt,a.any=jt,a.detect=yt,a.foldl=_t,a.foldr=Ct,a.include=gt,a.inject=_t,$r(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return er.apply(t,arguments),n.apply(a,t)})}),a.first=kt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return nt(n,vr(0,u-e))}},a.take=kt,a.head=kt,$r(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); +return null==t||r&&typeof t!="function"?e:new W(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Gt(this.__wrapped__)},a.prototype.value=Pt,a.prototype.valueOf=Pt,Ir(["join","pop","shift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Ir(["push","reverse","sort","unshift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ir(["concat","slice","splice"],function(n){var t=Jt[n];a.prototype[n]=function(){return new W(t.apply(this.__wrapped__,arguments)) +}}),wr.spliceObjects||Ir(["pop","shift","splice"],function(n){var t=Jt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new W(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),E="[object Arguments]",O="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; $[B]=!1,$[E]=$[O]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index dc0889f243..12edb8893c 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -372,80 +372,25 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a function optimized to search large arrays for a given `value`, - * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. + * A basic version of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. * * @private * @param {Array} array The array to search. * @param {Mixed} value The value to search for. - * @returns {Boolean} Returns `true`, if `value` is found, else `false`. + * @param {Number} [fromIndex=0] The index to search from. + * @returns {Number} Returns the index of the matched value or `-1`. */ - function createCache(array) { - var bailout, - index = -1, - length = array.length, - isLarge = length >= largeArraySize, - objCache = {}; - - var caches = { - 'false': false, - 'function': false, - 'null': false, - 'number': {}, - 'object': objCache, - 'string': {}, - 'true': false, - 'undefined': false - }; - - function cacheContains(value) { - var type = typeof value; - if (type == 'boolean' || value == null) { - return caches[value]; - } - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; - - return type == 'object' - ? (cache[key] ? indexOf(cache[key], value) > -1 : false) - : !!cache[key]; - } - - function cachePush(value) { - var type = typeof value; - if (type == 'boolean' || value == null) { - caches[value] = true; - } else { - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; - - if (type == 'object') { - bailout = (cache[key] || (cache[key] = [])).push(value) == length; - } else { - cache[key] = true; - } - } - } - - function simpleContains(value) { - return indexOf(array, value) > -1; - } - - function simplePush(value) { - array.push(value); - } + function basicIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; - if (isLarge) { - while (++index < length) { - cachePush(array[index]); - } - if (bailout) { - isLarge = caches = objCache = null; + while (++index < length) { + if (array[index] === value) { + return index; } } - return isLarge - ? { 'contains': cacheContains, 'push': cachePush } - : { 'push': simplePush, 'contains' : simpleContains }; + return -1; } /** @@ -547,6 +492,85 @@ return bound; } + /** + * Creates a function optimized to search large arrays for a given `value`, + * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. + * + * @private + * @param {Array} [array=[]] The array to search. + * @param {Mixed} value The value to search for. + * @returns {Boolean} Returns `true`, if `value` is found, else `false`. + */ + function createCache(array) { + array || (array = []); + + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; + + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; + + function basicContains(value) { + return basicIndexOf(array, value) > -1; + } + + function basicPush(value) { + array.push(value); + } + + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; + } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) + : !!cache[key]; + } + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } + } + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'contains': basicContains, 'push': basicPush }; + } + /** * Creates a new object with the specified `prototype`. * @@ -559,26 +583,26 @@ } /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. + * Used by `escape` to convert characters to HTML entities. * * @private * @param {String} match The matched character to escape. * @returns {String} Returns the escaped character. */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; + function escapeHtmlChar(match) { + return htmlEscapes[match]; } /** - * Used by `escape` to convert characters to HTML entities. + * Used by `template` to escape characters for inclusion in compiled + * string literals. * * @private * @param {String} match The matched character to escape. * @returns {String} Returns the escaped character. */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; + function escapeStringChar(match) { + return '\\' + stringEscapes[match]; } /** @@ -603,6 +627,29 @@ // no operation performed } + /** + * Creates a function that juggles arguments, allowing argument overloading + * for `_.flatten` and `_.uniq`, before passing them to the given `func`. + * + * @private + * @param {Function} func The function to wrap. + * @returns {Function} Returns the new function. + */ + function overloadWrapper(func) { + return function(array, flag, callback, thisArg) { + // juggle arguments + if (typeof flag != 'boolean' && flag != null) { + thisArg = callback; + callback = !(thisArg && thisArg[flag] === array) ? flag : undefined; + flag = false; + } + if (callback != null) { + callback = lodash.createCallback(callback, thisArg); + } + return func(array, flag, callback, thisArg); + }; + } + /** * A fallback implementation of `isPlainObject` which checks if a given `value` * is an object created by the `Object` constructor, assuming objects created @@ -1915,7 +1962,7 @@ forIn(object, function(value, key, object) { if (isFunc ? !callback(value, key, object) - : indexOf(props, key) < 0 + : basicIndexOf(props, key) < 0 ) { result[key] = value; } @@ -2142,10 +2189,10 @@ result = false; fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; - if (typeof length == 'number') { + if (length && typeof length == 'number') { result = (isString(collection) ? collection.indexOf(target, fromIndex) - : indexOf(collection, target, fromIndex) + : basicIndexOf(collection, target, fromIndex) ) > -1; } else { forOwn(collection, function(value) { @@ -3313,20 +3360,11 @@ * _.flatten(stooges, 'quotes'); * // => ['Oh, a wise guy, eh?', 'Poifect!', 'Spread out!', 'You knucklehead!'] */ - function flatten(array, isShallow, callback, thisArg) { + var flatten = overloadWrapper(function flatten(array, isShallow, callback) { var index = -1, length = array ? array.length : 0, result = []; - // juggle arguments - if (typeof isShallow != 'boolean' && isShallow != null) { - thisArg = callback; - callback = !(thisArg && thisArg[isShallow] === array) ? isShallow : undefined; - isShallow = false; - } - if (callback != null) { - callback = lodash.createCallback(callback, thisArg); - } while (++index < length) { var value = array[index]; if (callback) { @@ -3340,7 +3378,7 @@ } } return result; - } + }); /** * Gets the index at which the first occurrence of `value` is found using @@ -3367,21 +3405,14 @@ * // => 2 */ function indexOf(array, value, fromIndex) { - var index = -1, - length = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0) - 1; + var length = array ? array.length : 0; + fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); } else if (fromIndex) { - index = sortedIndex(array, value); + var index = sortedIndex(array, value); return array[index] === value ? index : -1; } - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; + return array ? basicIndexOf(array, value, fromIndex) : -1; } /** @@ -3477,7 +3508,7 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = createCache([]), + cache = createCache(), caches = {}, index = -1, length = array ? array.length : 0, @@ -3826,7 +3857,7 @@ * Creates a duplicate-value-free version of the `array` using strict equality * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` * for `isSorted` will run a faster algorithm. If `callback` is passed, each - * element of `array` is passed through a `callback` before uniqueness is computed. + * element of `array` is passed through the `callback` before uniqueness is computed. * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is passed for `callback`, the created "_.pluck" style @@ -3855,44 +3886,30 @@ * _.uniq([1, 1, 2, 2, 3], true); * // => [1, 2, 3] * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return Math.floor(num); }); - * // => [1, 2, 3] + * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); + * // => ['A', 'b', 'C'] * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2, 3] + * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); + * // => [1, 2.5, 3] * * // using "_.pluck" callback shorthand * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); * // => [{ 'x': 1 }, { 'x': 2 }] */ - function uniq(array, isSorted, callback, thisArg) { + var uniq = overloadWrapper(function(array, isSorted, callback) { var index = -1, length = array ? array.length : 0, + isLarge = !isSorted && length >= largeArraySize, result = [], - seen = result; + seen = isLarge ? createCache() : (callback ? [] : result); - // juggle arguments - if (typeof isSorted != 'boolean' && isSorted != null) { - thisArg = callback; - callback = !(thisArg && thisArg[isSorted] === array) ? isSorted : undefined; - isSorted = false; - } - // init value cache for large arrays - var isLarge = !isSorted && length >= largeArraySize; - if (callback != null) { - seen = []; - callback = lodash.createCallback(callback, thisArg); - } - if (isLarge) { - seen = createCache([]); - } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) + : (isLarge ? !seen.contains(computed) : basicIndexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); @@ -3901,7 +3918,7 @@ } } return result; - } + }); /** * The inverse of `_.zip`, this method splits groups of elements into arrays diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 2d198d4dd8..73046f97f7 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,42 +4,42 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(o){function f(n){if(!n||ie.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=ee(t))&&ee(e);return e?n==e||ee(n)==e:Z(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?je(n):[],o=u.length;++r=s,g={},y={"false":a,"function":a,"null":a,number:{},object:g,string:{},"true":a,undefined:a};if(v){for(;++ct||typeof n=="undefined")return 1;if(ne?0:e);++re?ge(0,u+e):e)||0,typeof u=="number"?o=-1<(ct(n)?n.indexOf(t,e):Ot(n,t,e)):P(n,function(n){return++ru&&(u=o) -}}else t=!t&&ct(n)?J:G.createCallback(t,e),ht(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function dt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=qt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -if(typeof u!="number")var i=je(n),u=i.length;return t=G.createCallback(t,r,4),ht(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function jt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ge(0,u+e):e||0)-1;else if(e)return r=St(n,t),n[r]===t?r:-1; -for(;++r>>1,e(n[r])=s;for(r!=u&&(l=[],r=G.createCallback(r,o)),p&&(l=H([]));++ie?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Y.prototype=G.prototype;var ke=le,je=ve?function(n){return it(n)?ve(n):[]}:V,we={"&":"&","<":"<",">":">",'"':""","'":"'"},Ce=ut(we);return Kt&&i&&typeof ae=="function"&&(Bt=$t(ae,o)),Dt=8==he(k+"08")?he:function(n,t){return he(ct(n)?n.replace(j,""):n,t||0) -},G.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=Zt.apply(Jt,me.call(arguments,1)),r=e.length,u=qt(r);++t++l&&(f=n.apply(c,i)),p=oe(o,t),f}},G.defaults=M,G.defer=Bt,G.delay=function(n,t){var r=me.call(arguments,2); -return oe(function(){n.apply(e,r)},t)},G.difference=wt,G.filter=gt,G.flatten=xt,G.forEach=ht,G.forIn=K,G.forOwn=P,G.functions=rt,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),ht(n,function(n,e,u){e=Gt(t(n,e,u)),(re.call(r,e)?r[e]:r[e]=[]).push(n)}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return nt(n,0,ye(ge(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=H([]),u={},a=-1,o=n?n.length:0,i=[]; -n:for(;++aOt(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e) -}},G.pairs=function(n){for(var t=-1,e=je(n),r=e.length,u=qt(r);++te?ge(0,r+e):ye(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Rt,G.noConflict=function(){return o._=Qt,this},G.parseInt=Dt,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0; -var e=be();return n%1||t%1?n+ye(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ne(e*(t-n+1))},G.reduce=_t,G.reduceRight=kt,G.result=function(n,t){var r=n?n[t]:e;return ot(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:je(n).length},G.some=jt,G.sortedIndex=St,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=je(i),i=pt(i),f=0,c=u.interpolate||w,l="__p+='",c=Vt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g"); -n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,W),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=Pt(a,"return "+l).apply(e,i) -}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Gt(n).replace(h,tt)},G.uniqueId=function(n){var t=++c;return Gt(n==u?"":n)+t},G.all=vt,G.any=jt,G.detect=yt,G.foldl=_t,G.foldr=kt,G.include=st,G.inject=_t,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ue.apply(t,arguments),n.apply(G,t)})}),G.first=Ct,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++ -}else if(r=t,r==u||e)return n[a-1];return nt(n,ge(0,a-r))}},G.take=Ct,G.head=Ct,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new Y(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Gt(this.__wrapped__)},G.prototype.value=Tt,G.prototype.valueOf=Tt,ht(["join","pop","shift"],function(n){var t=Jt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),ht(["push","reverse","sort","unshift"],function(n){var t=Jt[n]; -G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),ht(["concat","slice","splice"],function(n){var t=Jt[n];G.prototype[n]=function(){return new Y(t.apply(this.__wrapped__,arguments))}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; +;!function(n){function t(o){function f(n){if(!n||oe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=te(t))&&te(e);return e?n==e||te(n)==e:tt(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?ke(n):[],o=u.length;++rt||typeof n=="undefined")return 1;if(n=s,g={},y={"false":a,"function":a,"null":a,number:{},object:g,string:{},"true":a,undefined:a};if(v){for(;++ce?0:e);++re?ve(0,u+e):e)||0,u&&typeof u=="number"?o=-1<(pt(n)?n.indexOf(t,e):H(n,t,e)):P(n,function(n){return++ru&&(u=o) +}}else t=!t&&pt(n)?J:G.createCallback(t,e),mt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function kt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Tt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; +if(typeof u!="number")var i=ke(n),u=i.length;return t=G.createCallback(t,r,4),mt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function Ct(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Z.prototype=G.prototype;var _e=ce,ke=se?function(n){return ct(n)?se(n):[]}:V,je={"&":"&","<":"<",">":">",'"':""","'":"'"},we=ot(je),qt=nt(function xe(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=s,o=[],i=a?W():e?[]:o;++rn?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=Yt.apply(Ht,be.call(arguments,1)),r=e.length,u=Tt(r);++t++l&&(f=n.apply(c,i)),p=ae(o,t),f}},G.defaults=M,G.defer=$t,G.delay=function(n,t){var r=be.call(arguments,2);return ae(function(){n.apply(e,r)},t)},G.difference=xt,G.filter=ht,G.flatten=qt,G.forEach=mt,G.forIn=K,G.forOwn=P,G.functions=at,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),mt(n,function(n,e,u){e=Vt(t(n,e,u)),(ee.call(r,e)?r[e]:r[e]=[]).push(n) +}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return et(n,0,ge(ve(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=W(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++aH(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=ke(n),r=e.length,u=Tt(r);++te?ve(0,r+e):e||0}else if(e)return e=St(n,t),n[e]===t?e:-1;return n?H(n,t,e):-1},G.isArguments=function(n){return oe.call(n)==E},G.isArray=_e,G.isBoolean=function(n){return n===r||n===a||oe.call(n)==I +},G.isDate=function(n){return n?typeof n=="object"&&oe.call(n)==N:a},G.isElement=function(n){return n?1===n.nodeType:a},G.isEmpty=function(n){var t=r;if(!n)return t;var e=oe.call(n),u=n.length;return e==S||e==R||e==E||e==B&&typeof u=="number"&&ft(n.splice)?!u:(P(n,function(){return t=a}),t)},G.isEqual=it,G.isFinite=function(n){return le(n)&&!pe(parseFloat(n))},G.isFunction=ft,G.isNaN=function(n){return lt(n)&&n!=+n},G.isNull=function(n){return n===u},G.isNumber=lt,G.isObject=ct,G.isPlainObject=f,G.isRegExp=function(n){return n?typeof n=="object"&&oe.call(n)==F:a +},G.isString=pt,G.isUndefined=function(n){return typeof n=="undefined"},G.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?ve(0,r+e):ge(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Ft,G.noConflict=function(){return o._=Lt,this},G.parseInt=ue,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=he();return n%1||t%1?n+ge(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},G.reduce=jt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e; +return ft(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ke(n).length},G.some=Ct,G.sortedIndex=St,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=ke(i),i=vt(i),f=0,c=u.interpolate||w,l="__p+='",c=Ut((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,Y),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t +}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=zt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Vt(n).replace(h,rt)},G.uniqueId=function(n){var t=++c;return Vt(n==u?"":n)+t +},G.all=yt,G.any=Ct,G.detect=bt,G.foldl=jt,G.foldr=wt,G.include=gt,G.inject=jt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return re.apply(t,arguments),n.apply(G,t)})}),G.first=Ot,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return et(n,ve(0,a-r))}},G.take=Ot,G.head=Ot,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); +return t==u||e&&typeof t!="function"?r:new Z(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Vt(this.__wrapped__)},G.prototype.value=Rt,G.prototype.valueOf=Rt,mt(["join","pop","shift"],function(n){var t=Ht[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),mt(["push","reverse","sort","unshift"],function(n){var t=Ht[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),mt(["concat","slice","splice"],function(n){var t=Ht[n];G.prototype[n]=function(){return new Z(t.apply(this.__wrapped__,arguments)) +}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; T[A]=a,T[E]=T[S]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 625d5b051b..beeaaae7fc 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -295,6 +295,28 @@ /*--------------------------------------------------------------------------*/ + /** + * A basic version of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. + * + * @private + * @param {Array} array The array to search. + * @param {Mixed} value The value to search for. + * @param {Number} [fromIndex=0] The index to search from. + * @returns {Number} Returns the index of the matched value or `-1`. + */ + function basicIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + /** * Used by `_.max` and `_.min` as the default `callback` when a given * `collection` is a string value. @@ -394,6 +416,85 @@ return bound; } + /** + * Creates a function optimized to search large arrays for a given `value`, + * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. + * + * @private + * @param {Array} [array=[]] The array to search. + * @param {Mixed} value The value to search for. + * @returns {Boolean} Returns `true`, if `value` is found, else `false`. + */ + function createCache(array) { + array || (array = []); + + var bailout, + index = -1, + length = array.length, + isLarge = length >= largeArraySize, + objCache = {}; + + var caches = { + 'false': false, + 'function': false, + 'null': false, + 'number': {}, + 'object': objCache, + 'string': {}, + 'true': false, + 'undefined': false + }; + + function basicContains(value) { + return basicIndexOf(array, value) > -1; + } + + function basicPush(value) { + array.push(value); + } + + function cacheContains(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + return caches[value]; + } + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + return type == 'object' + ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) + : !!cache[key]; + } + + function cachePush(value) { + var type = typeof value; + if (type == 'boolean' || value == null) { + caches[value] = true; + } else { + var cache = caches[type] || (type = 'object', objCache), + key = type == 'number' ? value : keyPrefix + value; + + if (type == 'object') { + bailout = (cache[key] || (cache[key] = [])).push(value) == length; + } else { + cache[key] = true; + } + } + } + + if (isLarge) { + while (++index < length) { + cachePush(array[index]); + } + if (bailout) { + isLarge = caches = objCache = null; + } + } + return isLarge + ? { 'contains': cacheContains, 'push': cachePush } + : { 'contains': basicContains, 'push': basicPush }; + } + /** * Creates a new object with the specified `prototype`. * @@ -417,26 +518,26 @@ } /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. + * Used by `escape` to convert characters to HTML entities. * * @private * @param {String} match The matched character to escape. * @returns {String} Returns the escaped character. */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; + function escapeHtmlChar(match) { + return htmlEscapes[match]; } /** - * Used by `escape` to convert characters to HTML entities. + * Used by `template` to escape characters for inclusion in compiled + * string literals. * * @private * @param {String} match The matched character to escape. * @returns {String} Returns the escaped character. */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; + function escapeStringChar(match) { + return '\\' + stringEscapes[match]; } /** @@ -461,6 +562,29 @@ // no operation performed } + /** + * Creates a function that juggles arguments, allowing argument overloading + * for `_.flatten` and `_.uniq`, before passing them to the given `func`. + * + * @private + * @param {Function} func The function to wrap. + * @returns {Function} Returns the new function. + */ + function overloadWrapper(func) { + return function(array, flag, callback, thisArg) { + // juggle arguments + if (typeof flag != 'boolean' && flag != null) { + thisArg = callback; + callback = !(thisArg && thisArg[flag] === array) ? flag : undefined; + flag = false; + } + if (callback != null) { + callback = createCallback(callback, thisArg); + } + return func(array, flag, callback, thisArg); + }; + } + /** * Used by `unescape` to convert HTML entities to characters. * @@ -1312,7 +1436,7 @@ result = {}; forIn(object, function(value, key) { - if (indexOf(props, key) < 0) { + if (basicIndexOf(props, key) < 0) { result[key] = value; } }); @@ -1443,8 +1567,8 @@ function contains(collection, target) { var length = collection ? collection.length : 0, result = false; - if (typeof length == 'number') { - result = indexOf(collection, target) > -1; + if (length && typeof length == 'number') { + result = basicIndexOf(collection, target) > -1; } else { forOwn(collection, function(value) { return (result = value === target) && indicatorObject; @@ -2478,7 +2602,7 @@ while (++index < length) { var value = array[index]; - if (indexOf(flattened, value) < 0) { + if (basicIndexOf(flattened, value) < 0) { result.push(value); } } @@ -2645,21 +2769,14 @@ * // => 2 */ function indexOf(array, value, fromIndex) { - var index = -1, - length = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0) - 1; + var length = array ? array.length : 0; + fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); } else if (fromIndex) { - index = sortedIndex(array, value); + var index = sortedIndex(array, value); return array[index] === value ? index : -1; } - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; + return array ? basicIndexOf(array, value, fromIndex) : -1; } /** @@ -2762,10 +2879,10 @@ outer: while (++index < length) { var value = array[index]; - if (indexOf(result, value) < 0) { + if (basicIndexOf(result, value) < 0) { var argsIndex = argsLength; while (--argsIndex) { - if (indexOf(args[argsIndex], value) < 0) { + if (basicIndexOf(args[argsIndex], value) < 0) { continue outer; } } @@ -3100,7 +3217,7 @@ * Creates a duplicate-value-free version of the `array` using strict equality * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` * for `isSorted` will run a faster algorithm. If `callback` is passed, each - * element of `array` is passed through a `callback` before uniqueness is computed. + * element of `array` is passed through the `callback` before uniqueness is computed. * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is passed for `callback`, the created "_.pluck" style @@ -3129,11 +3246,11 @@ * _.uniq([1, 1, 2, 2, 3], true); * // => [1, 2, 3] * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return Math.floor(num); }); - * // => [1, 2, 3] + * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); + * // => ['A', 'b', 'C'] * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2, 3] + * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); + * // => [1, 2.5, 3] * * // using "_.pluck" callback shorthand * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); @@ -3160,7 +3277,7 @@ if (isSorted ? !index || seen[seen.length - 1] !== computed - : indexOf(seen, computed) < 0 + : basicIndexOf(seen, computed) < 0 ) { if (callback) { seen.push(computed); diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 3df50eeb59..85c7df7e87 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,32 +4,31 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n){return n instanceof t?n:new a(n)}function r(n,t){var r=n.b,e=t.b;if(n=n.a,t=t.a,n!==t){if(n>t||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function B(n,t){var r=-1,e=n?n.length:0; -if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=U(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=Mt(n),u=i.length;return t=U(t,e,4),E(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f)}),r}function q(n,t,r){var e; -t=U(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++r$(e,o)&&u.push(o)}return u}function M(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=U(t,r);++or?Nt(0,u+r):r||0)-1;else if(r)return e=z(n,t),n[e]===t?e:-1;for(;++e>>1,r(n[e])$(a,f))&&(r&&a.push(f),i.push(e))}return i}function P(n,t){return Rt.fastBind||wt&&2"']/g,nt=/['\n\r\t\u2028\u2029\\]/g,tt="[object Arguments]",rt="[object Array]",et="[object Boolean]",ut="[object Date]",ot="[object Number]",it="[object Object]",at="[object RegExp]",ft="[object String]",lt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},ct={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},pt=Array.prototype,J=Object.prototype,st=n._,vt=RegExp("^"+(J.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),gt=Math.ceil,ht=n.clearTimeout,yt=pt.concat,mt=Math.floor,_t=J.hasOwnProperty,bt=pt.push,dt=n.setTimeout,jt=J.toString,wt=vt.test(wt=jt.bind)&&wt,At=vt.test(At=Object.create)&&At,xt=vt.test(xt=Array.isArray)&&xt,Ot=n.isFinite,Et=n.isNaN,St=vt.test(St=Object.keys)&&St,Nt=Math.max,Bt=Math.min,Ft=Math.random,kt=pt.slice,J=vt.test(n.attachEvent),qt=wt&&!/\n|true/.test(wt+J),Rt={}; -!function(){var n={0:1,length:1};Rt.fastBind=wt&&!qt,Rt.spliceObjects=(pt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},At||(u=function(n){if(_(n)){f.prototype=n;var t=new f;f.prototype=null}return t||{}}),a.prototype=t.prototype,c(arguments)||(c=function(n){return n?_t.call(n,"callee"):!1});var Dt=xt||function(n){return n?typeof n=="object"&&jt.call(n)==rt:!1},xt=function(n){var t,r=[];if(!n||!lt[typeof n])return r; -for(t in n)_t.call(n,t)&&r.push(t);return r},Mt=St?function(n){return _(n)?St(n):[]}:xt,Tt={"&":"&","<":"<",">":">",'"':""","'":"'"},$t=g(Tt),It=function(n,t){var r;if(!n||!lt[typeof n])return n;for(r in n)if(t(n[r],r,n)===L)break;return n},zt=function(n,t){var r;if(!n||!lt[typeof n])return n;for(r in n)if(_t.call(n,r)&&t(n[r],r,n)===L)break;return n};m(/x/)&&(m=function(n){return typeof n=="function"&&"[object Function]"==jt.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},t.bind=P,t.bindAll=function(n){for(var t=1$(o,i)){for(var a=r;--a;)if(0>$(t[a],i))continue n;o.push(i)}}return o},t.invert=g,t.invoke=function(n,t){var r=kt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return E(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=Mt,t.map=S,t.max=N,t.memoize=function(n,t){var r={};return function(){var e=Q+(t?t.apply(this,arguments):arguments[0]);return _t.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=U(t,r),E(n,function(n,r,o){r=t(n,r,o),r$(t,e)&&(r[e]=n) -}),r},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=Mt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Nt(0,e+r):Bt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=W,t.noConflict=function(){return n._=st,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=Ft();return n%1||t%1?n+Bt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+mt(r*(t-n+1)) -},t.reduce=F,t.reduceRight=k,t.result=function(n,t){var r=n?n[t]:null;return m(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Mt(n).length},t.some=q,t.sortedIndex=z,t.template=function(n,r,e){n||(n=""),e=s({},e,t.templateSettings);var u=0,i="__p+='",a=e.variable;n.replace(RegExp((e.escape||Y).source+"|"+(e.interpolate||Y).source+"|"+(e.evaluate||Y).source+"|$","g"),function(t,r,e,a,f){return i+=n.slice(u,f).replace(nt,o),r&&(i+="'+_['escape']("+r+")+'"),a&&(i+="';"+a+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t -}),i+="';\n",a||(a="obj",i="with("+a+"||{}){"+i+"}"),i="function("+a+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(X,l)},t.uniqueId=function(n){var t=++K+"";return n?n+t:t},t.all=A,t.any=q,t.detect=O,t.foldl=F,t.foldr=k,t.include=w,t.inject=F,t.first=M,t.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t!="number"&&null!=t){var o=u;for(t=U(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return kt.call(n,Nt(0,u-e))}},t.take=M,t.head=M,t.VERSION="1.2.1",W(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},E("pop push reverse shift sort splice unshift".split(" "),function(n){var r=pt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Rt.spliceObjects&&0===n.length&&delete n[0],this -}}),E(["concat","join","slice"],function(n){var r=pt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new a(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):G&&!G.nodeType?H?(H.exports=t)._=t:G._=t:n._=t}(this); \ No newline at end of file +;!function(n){function t(n,t){var r;if(n&&ht[typeof n])for(r in n)if(xt.call(n,r)&&t(n[r],r,n)===tt)break}function r(n,t){var r;if(n&&ht[typeof n])for(r in n)if(t(n[r],r,n)===tt)break}function e(n){var t,r=[];if(!n||!ht[typeof n])return r;for(t in n)xt.call(n,t)&&r.push(t);return r}function u(n){return n instanceof u?n:new p(n)}function o(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1; +if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function R(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++rarguments.length;r=G(r,u,4);var i=-1,a=n.length; +if(typeof a=="number")for(o&&(e=n[++i]);++iarguments.length;if(typeof u!="number")var i=Pt(n),u=i.length;return t=G(t,e,4),B(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=Q,n[a]):t(r,n[a],a,f)}),r}function T(n,r,e){var u;r=G(r,e),e=-1;var o=n?n.length:0;if(typeof o=="number")for(;++eo(e,i)&&u.push(i)}return u}function z(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=L){var o=-1;for(t=G(t,r);++o>>1,r(n[e])o(f,c))&&(r&&f.push(c),a.push(e))}return a}function W(n,t){return zt.fastBind||Nt&&2"']/g,it=/['\n\r\t\u2028\u2029\\]/g,at="[object Arguments]",ft="[object Array]",ct="[object Boolean]",lt="[object Date]",pt="[object Number]",st="[object Object]",vt="[object RegExp]",gt="[object String]",ht={"boolean":Q,"function":K,object:K,number:Q,string:Q,undefined:Q},yt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},mt=Array.prototype,Z=Object.prototype,_t=n._,bt=RegExp("^"+(Z.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),dt=Math.ceil,jt=n.clearTimeout,wt=mt.concat,At=Math.floor,xt=Z.hasOwnProperty,Ot=mt.push,Et=n.setTimeout,St=Z.toString,Nt=bt.test(Nt=St.bind)&&Nt,kt=bt.test(kt=Object.create)&&kt,Bt=bt.test(Bt=Array.isArray)&&Bt,Ft=n.isFinite,qt=n.isNaN,Rt=bt.test(Rt=Object.keys)&&Rt,Dt=Math.max,Mt=Math.min,Tt=Math.random,$t=mt.slice,Z=bt.test(n.attachEvent),It=Nt&&!/\n|true/.test(Nt+Z),zt={}; +!function(){var n={0:1,length:1};zt.fastBind=Nt&&!It,zt.spliceObjects=(mt.splice.call(n,0,1),!n[0])}(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},kt||(f=function(n){if(w(n)){s.prototype=n;var t=new s;s.prototype=L}return t||{}}),p.prototype=u.prototype,g(arguments)||(g=function(n){return n?xt.call(n,"callee"):Q});var Ct=Bt||function(n){return n?typeof n=="object"&&St.call(n)==ft:Q},Pt=Rt?function(n){return w(n)?Rt(n):[]}:e,Ut={"&":"&","<":"<",">":">",'"':""","'":"'"},Vt=_(Ut); +j(/x/)&&(j=function(n){return typeof n=="function"&&"[object Function]"==St.call(n)}),u.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},u.bind=W,u.bindAll=function(n){for(var t=1o(i,a)){for(var f=r;--f;)if(0>o(t[f],a))continue n;i.push(a)}}return i},u.invert=_,u.invoke=function(n,t){var r=$t.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return B(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},u.keys=Pt,u.map=F,u.max=q,u.memoize=function(n,t){var r={};return function(){var e=rt+(t?t.apply(this,arguments):arguments[0]);return xt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},u.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=G(t,r),B(n,function(n,r,o){r=t(n,r,o),ro(t,r)&&(e[r]=n) +}),e},u.once=function(n){var t,r;return function(){return t?r:(t=K,r=n.apply(this,arguments),n=L,r)}},u.pairs=function(n){for(var t=-1,r=Pt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Dt(0,e+r):r||0}else if(r)return r=U(n,t),n[r]===t?r:-1;return n?o(n,t,r):-1},u.isArguments=g,u.isArray=Ct,u.isBoolean=function(n){return n===K||n===Q||St.call(n)==ct},u.isDate=function(n){return n?typeof n=="object"&&St.call(n)==lt:Q},u.isElement=function(n){return n?1===n.nodeType:Q},u.isEmpty=b,u.isEqual=d,u.isFinite=function(n){return Ft(n)&&!qt(parseFloat(n)) +},u.isFunction=j,u.isNaN=function(n){return A(n)&&n!=+n},u.isNull=function(n){return n===L},u.isNumber=A,u.isObject=w,u.isRegExp=function(n){return!(!n||!ht[typeof n])&&St.call(n)==vt},u.isString=x,u.isUndefined=function(n){return typeof n=="undefined"},u.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?Dt(0,e+r):Mt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=J,u.noConflict=function(){return n._=_t,this},u.random=function(n,t){n==L&&t==L&&(t=1),n=+n||0,t==L?(t=n,n=0):t=+t||0; +var r=Tt();return n%1||t%1?n+Mt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+At(r*(t-n+1))},u.reduce=D,u.reduceRight=M,u.result=function(n,t){var r=n?n[t]:L;return j(r)?n[t]():r},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Pt(n).length},u.some=T,u.sortedIndex=U,u.template=function(n,t,r){n||(n=""),r=y({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||ut).source+"|"+(r.interpolate||ut).source+"|"+(r.evaluate||ut).source+"|$","g"),function(t,r,u,i,a){return o+=n.slice(e,a).replace(it,l),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=a+t.length,t +}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var a=Function("_","return "+o)(u)}catch(f){throw f.source=o,f}return t?a(t):(a.source=o,a)},u.unescape=function(n){return n==L?"":(n+"").replace(et,v)},u.uniqueId=function(n){var t=++nt+"";return n?n+t:t},u.all=S,u.any=T,u.detect=k,u.foldl=D,u.foldr=M,u.include=E,u.inject=D,u.first=z,u.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&t!=L){var o=u;for(t=G(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==L||r)return n[u-1];return $t.call(n,Dt(0,u-e))}},u.take=z,u.head=z,u.VERSION="1.2.1",J(u),u.prototype.chain=function(){return this.__chain__=K,this},u.prototype.value=function(){return this.__wrapped__},B("pop push reverse shift sort splice unshift".split(" "),function(n){var t=mt[n];u.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!zt.spliceObjects&&0===n.length&&delete n[0],this}}),B(["concat","join","slice"],function(n){var t=mt[n]; +u.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new p(n),n.__chain__=K),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=u, define(function(){return u})):X&&!X.nodeType?Y?(Y.exports=u)._=u:X._=u:n._=u}(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 2a13d5840d..86ee4604d9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -217,7 +217,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3460 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3508 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -241,7 +241,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3490 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3538 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -266,7 +266,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3526 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3574 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -294,7 +294,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3596 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3644 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -354,7 +354,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3658 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3706 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -397,7 +397,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3711 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3750 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -429,7 +429,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3785 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3817 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -486,7 +486,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3819 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3851 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -510,7 +510,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3903 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3935 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -567,7 +567,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3944 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3976 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -596,7 +596,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3985 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4017 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -634,7 +634,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4064 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4096 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -694,7 +694,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4128 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4160 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -743,7 +743,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4160 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4192 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -767,9 +767,9 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4210 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4242 "View in source") [Ⓣ][1] -Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through a `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. +Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. If a property name is passed for `callback`, the created "_.pluck" style callback will return the property value of the given element. @@ -795,11 +795,11 @@ _.uniq([1, 2, 1, 3, 1]); _.uniq([1, 1, 2, 2, 3], true); // => [1, 2, 3] -_.uniq([1, 2, 1.5, 3, 2.5], function(num) { return Math.floor(num); }); -// => [1, 2, 3] +_.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); +// => ['A', 'b', 'C'] -_.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); -// => [1, 2, 3] +_.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); +// => [1, 2.5, 3] // using "_.pluck" callback shorthand _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); @@ -814,7 +814,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4262 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4280 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -838,7 +838,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4288 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4306 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -863,7 +863,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4308 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4326 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -887,7 +887,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4330 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4348 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -978,7 +978,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5407 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5425 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1008,7 +1008,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5424 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5442 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1029,7 +1029,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5441 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5459 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1060,7 +1060,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2449 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2497 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1088,7 +1088,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2491 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2539 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1126,7 +1126,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2545 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2593 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1162,7 +1162,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2597 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2645 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1208,7 +1208,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2658 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2706 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1254,7 +1254,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2725 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2773 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1303,7 +1303,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2820 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1335,7 +1335,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2822 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2870 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1372,7 +1372,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2855 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2903 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1401,7 +1401,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2907 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2955 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1446,7 +1446,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2964 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3012 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1488,7 +1488,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3033 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3081 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1530,7 +1530,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3131 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1560,7 +1560,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3115 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3163 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1598,7 +1598,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3158 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3206 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1629,7 +1629,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3218 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3266 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1672,7 +1672,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3239 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3287 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1696,7 +1696,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3272 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3320 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1726,7 +1726,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3319 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3367 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1772,7 +1772,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3375 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3423 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1809,7 +1809,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3410 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3458 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1833,7 +1833,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3442 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3490 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1870,7 +1870,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4370 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4388 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1898,7 +1898,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4403 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4421 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1929,7 +1929,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4434 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4452 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1960,7 +1960,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4480 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4498 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2001,7 +2001,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4503 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4521 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2028,7 +2028,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4562 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4580 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2082,7 +2082,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4638 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4656 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2115,7 +2115,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4691 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4709 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2140,7 +2140,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4717 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4735 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2167,7 +2167,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4741 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4759 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2193,7 +2193,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4771 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4789 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2219,7 +2219,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4806 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4824 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2246,7 +2246,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4837 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4855 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2283,7 +2283,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4870 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4888 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2315,7 +2315,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4935 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4953 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2351,7 +2351,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1205 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1253 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2389,7 +2389,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1260 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1308 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2436,7 +2436,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1385 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1433 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2482,7 +2482,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1409 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1457 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2508,7 +2508,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1431 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1479 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2536,7 +2536,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1472 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1520 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2572,7 +2572,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1497 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1545 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2600,7 +2600,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1514 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1562 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2627,7 +2627,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1539 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1587 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2652,7 +2652,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1604 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2676,7 +2676,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1068 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1116 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2703,7 +2703,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1094 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1142 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2730,7 +2730,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1582 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1630 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2754,7 +2754,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1599 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1647 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2778,7 +2778,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1616 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1664 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2802,7 +2802,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1641 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1689 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2832,7 +2832,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1700 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1748 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2877,7 +2877,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1881 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1929 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2915,7 +2915,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1898 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1946 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2939,7 +2939,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1961 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2009 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2974,7 +2974,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1983 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2031 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3001,7 +3001,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2000 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2048 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3025,7 +3025,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1928 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1976 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3055,7 +3055,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2028 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2076 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3090,7 +3090,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2053 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2101 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3114,7 +3114,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2070 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2118 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3138,7 +3138,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2087 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2135 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3162,7 +3162,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1127 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1175 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3186,7 +3186,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2146 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2194 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3242,7 +3242,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2255 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2303 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3273,7 +3273,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2289 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2337 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3297,7 +3297,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2327 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2375 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3328,7 +3328,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2381 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2429 "View in source") [Ⓣ][1] Transforms an `object` to an new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback`is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3365,7 +3365,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2414 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2462 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3396,7 +3396,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4977 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3420,7 +3420,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4977 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4995 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3445,7 +3445,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5003 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5021 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3475,7 +3475,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5032 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5050 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3495,7 +3495,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5056 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5074 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3522,7 +3522,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5079 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5097 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3550,7 +3550,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5123 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5141 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3603,7 +3603,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5207 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5225 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3685,7 +3685,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5332 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5350 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3717,7 +3717,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5359 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5377 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3741,7 +3741,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5379 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5397 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3794,7 +3794,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5621 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5639 "View in source") [Ⓣ][1] *(String)*: The semantic version number. diff --git a/lodash.js b/lodash.js index d34c622b3e..1a1ed74667 100644 --- a/lodash.js +++ b/lodash.js @@ -4200,7 +4200,7 @@ * Creates a duplicate-value-free version of the `array` using strict equality * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` * for `isSorted` will run a faster algorithm. If `callback` is passed, each - * element of `array` is passed through a `callback` before uniqueness is computed. + * element of `array` is passed through the `callback` before uniqueness is computed. * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array). * * If a property name is passed for `callback`, the created "_.pluck" style @@ -4229,11 +4229,11 @@ * _.uniq([1, 1, 2, 2, 3], true); * // => [1, 2, 3] * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return Math.floor(num); }); - * // => [1, 2, 3] + * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); + * // => ['A', 'b', 'C'] * - * _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2, 3] + * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); + * // => [1, 2.5, 3] * * // using "_.pluck" callback shorthand * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); From 8f7be7190512a23107034eb78383cbb77f306f5e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 24 May 2013 08:42:11 -0700 Subject: [PATCH 065/117] Avoid escaping existing non-ascii characters in templates. [closes #278] Former-commit-id: a56581f3e323c0c47e4f26ef8dce13e90fb6c15c --- build/minify.js | 6 +++++- test/template/d.tpl | 2 +- test/test-build.js | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/build/minify.js b/build/minify.js index b6c5d76542..1061b09f6e 100755 --- a/build/minify.js +++ b/build/minify.js @@ -375,6 +375,7 @@ isAdvanced = mode == 'advanced', isMapped = this.isMapped, isSilent = this.isSilent, + isTemplate = this.isTemplate, options = closureOptions.slice(), outputPath = this.outputPath, mapPath = getMapPath(outputPath), @@ -400,6 +401,9 @@ if (isMapped) { options.push('--create_source_map=' + mapPath, '--source_map_format=V3'); } + if (isTemplate) { + options.push('--charset=UTF-8'); + } getJavaOptions(function(javaOptions) { var compiler = cp.spawn('java', javaOptions.concat('-jar', closurePath, options)); @@ -497,7 +501,7 @@ // 4. output // restrict lines to 500 characters for consistency with the Closure Compiler var stream = uglifyJS.OutputStream({ - 'ascii_only': true, + 'ascii_only': !this.isTemplate, 'comments': /@cc_on|@license|@preserve/i, 'max_line_len': 500, }); diff --git a/test/template/d.tpl b/test/template/d.tpl index c7a43bc1fd..fdb97d1a4c 100644 --- a/test/template/d.tpl +++ b/test/template/d.tpl @@ -1 +1 @@ -Hello {{ name }}! \ No newline at end of file +Hallå {{ name }}! \ No newline at end of file diff --git a/test/test-build.js b/test/test-build.js index c1820730f4..37cfdbdd08 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -652,7 +652,7 @@ vm.runInContext(data.source, context); equal(moduleId, expectedId, basename); - equal(_.templates.d(object.d), 'Hello Mustache!', basename); + equal(_.templates.d(object.d), 'Hallå Mustache!', basename); delete _.templates; start(); }); From 90fe45c52d693191b0a216b8bff0860d51309a05 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 24 May 2013 09:10:45 -0700 Subject: [PATCH 066/117] Tweak regexp in build/post-compile.js used to repair whitespace detection. Former-commit-id: 7bfe6a6bc0b5e2258c56588d8aacad1e5176d8ba --- build/post-compile.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/post-compile.js b/build/post-compile.js index 2d37963932..310578134e 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -31,7 +31,7 @@ source = source .replace(/(document[^&]+&&)\s*(?:\w+|!\d)/, '$1!({toString:0}+"")') .replace(/"\t"/g, '"\\t"') - .replace(/"[^"]*?\\u180e[^"]*?"/g, + .replace(/"[^"]*?\\f[^"]*?"/g, '" \\t\\x0B\\f\\xa0\\ufeff' + '\\n\\r\\u2028\\u2029' + '\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000"' From d15bd2380002a3c63df6c86291525fc08cb53bfa Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 24 May 2013 09:11:34 -0700 Subject: [PATCH 067/117] Add *.template.* to .ignore files. Former-commit-id: d4c34dccb521890de2ced7482628f4796b55dcc1 --- .gitignore | 2 ++ .jamignore | 1 + .npmignore | 1 + bower.json | 1 + 4 files changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index d583af498f..150de05ff2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .DS_Store *.custom.* +*.template.* +*.d.ts *.map node_modules vendor/closure-compiler diff --git a/.jamignore b/.jamignore index 59c0c1afeb..c5e2518937 100644 --- a/.jamignore +++ b/.jamignore @@ -1,5 +1,6 @@ .* *.custom.* +*.template.* *.d.ts *.map *.md diff --git a/.npmignore b/.npmignore index 5a206d2aa5..edc3e1342e 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,6 @@ .* *.custom.* +*.template.* *.d.ts *.map *.md diff --git a/bower.json b/bower.json index 086e1aaf6a..c34bb4d453 100644 --- a/bower.json +++ b/bower.json @@ -5,6 +5,7 @@ "ignore": [ ".*", "*.custom.*", + "*.template.*", "*.d.ts", "*.map", "*.md", From d28cc15be291d9e8686989aee206e34097dea2f6 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 25 May 2013 01:08:08 -0700 Subject: [PATCH 068/117] Ensure `_.isPlainObject` returns `true` for empty objects in older browsers. [closes #283] Former-commit-id: d01d32b1cbd87d08bc8014d07eaa1842e3118a40 --- build.js | 13 +++++-------- lodash.js | 49 ++++++++++++++++++++++++------------------------- test/test.js | 6 +++++- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/build.js b/build.js index aa15dfc2f7..de40b79372 100755 --- a/build.js +++ b/build.js @@ -1319,14 +1319,11 @@ source = removeFunction(source, 'isNode'); source = removeSupportProp(source, 'nodeClass'); - // remove `support.nodeClass` from `shimIsPlainObject` - source = source.replace(matchFunction(source, 'shimIsPlainObject'), function(match) { - return match.replace(/\(support\.nodeClass[\s\S]+?\)\)/, 'true'); - }); - - // remove `support.nodeClass` from `_.clone` - source = source.replace(matchFunction(source, 'clone'), function(match) { - return match.replace(/\s*\|\|\s*\(!support\.nodeClass[\s\S]+?\)\)/, ''); + // remove `support.nodeClass` from `_.clone` and `shimIsPlainObject` + _.each(['clone', 'shimIsPlainObject'], function(methodName) { + source = source.replace(matchFunction(source, methodName), function(match) { + return match.replace(/\s*\|\|\s*\(!support\.nodeClass[\s\S]+?\)\)/, ''); + }); }); // remove `support.nodeClass` from `_.isEqual` diff --git a/lodash.js b/lodash.js index 1a1ed74667..ba98b3342d 100644 --- a/lodash.js +++ b/lodash.js @@ -1026,34 +1026,33 @@ * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. */ function shimIsPlainObject(value) { - // avoid non-objects and false positives for `arguments` objects - var result = false; - if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) { - return result; + var ctor, + result; + + // avoid non Object objects, `arguments` objects, and DOM elements + if (!(value && toString.call(value) == objectClass) || + (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) || + (!support.argsClass && isArguments(value)) || + (!support.nodeClass && isNode(value))) { + return false; } - // check that the constructor is `Object` (i.e. `Object instanceof Object`) - var ctor = value.constructor; - - if (isFunction(ctor) ? ctor instanceof ctor : (support.nodeClass || !isNode(value))) { - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - if (support.ownLast) { - forIn(value, function(value, key, object) { - result = hasOwnProperty.call(object, key); - return false; - }); - return result === true; - } - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - forIn(value, function(value, key) { - result = key; + // IE < 9 iterates inherited properties before own properties. If the first + // iterated property is an object's own property then there are no inherited + // enumerable properties. + if (support.ownLast) { + forIn(value, function(value, key, object) { + result = hasOwnProperty.call(object, key); + return false; }); - return result === false || hasOwnProperty.call(value, result); + return result !== false; } - return result; + // In most environments an object's own properties are iterated before + // its inherited properties. If the last iterated property is an object's + // own property then there are no inherited enumerable properties. + forIn(value, function(value, key) { + result = key; + }); + return result === undefined || hasOwnProperty.call(value, result); } /** diff --git a/test/test.js b/test/test.js index 431d884c65..d50c9ecf4f 100644 --- a/test/test.js +++ b/test/test.js @@ -1655,12 +1655,16 @@ } }); + test('should return `true` for empty objects', function() { + strictEqual(_.isPlainObject({}), true); + }); + test('should return `false` for Object objects without a [[Class]] of "Object"', function() { strictEqual(_.isPlainObject(arguments), false); strictEqual(_.isPlainObject(Error), false); strictEqual(_.isPlainObject(Math), false); strictEqual(_.isPlainObject(window), false); - }) + }); }()); /*--------------------------------------------------------------------------*/ From 2e3b135fe94841672359024fadd93b3327961a8a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 25 May 2013 01:08:38 -0700 Subject: [PATCH 069/117] Rebuild docs and files. Former-commit-id: 3f0dd7d8a07e2a3694619ce7277573ffb6f88ef6 --- dist/lodash.compat.js | 49 +++++---- dist/lodash.compat.min.js | 2 +- dist/lodash.js | 31 +++--- dist/lodash.min.js | 8 +- doc/README.md | 210 +++++++++++++++++++------------------- 5 files changed, 148 insertions(+), 152 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index f5d596e89d..1a490c72ef 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -1007,34 +1007,33 @@ * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. */ function shimIsPlainObject(value) { - // avoid non-objects and false positives for `arguments` objects - var result = false; - if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) { - return result; + var ctor, + result; + + // avoid non Object objects, `arguments` objects, and DOM elements + if (!(value && toString.call(value) == objectClass) || + (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) || + (!support.argsClass && isArguments(value)) || + (!support.nodeClass && isNode(value))) { + return false; } - // check that the constructor is `Object` (i.e. `Object instanceof Object`) - var ctor = value.constructor; - - if (isFunction(ctor) ? ctor instanceof ctor : (support.nodeClass || !isNode(value))) { - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - if (support.ownLast) { - forIn(value, function(value, key, object) { - result = hasOwnProperty.call(object, key); - return false; - }); - return result === true; - } - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - forIn(value, function(value, key) { - result = key; + // IE < 9 iterates inherited properties before own properties. If the first + // iterated property is an object's own property then there are no inherited + // enumerable properties. + if (support.ownLast) { + forIn(value, function(value, key, object) { + result = hasOwnProperty.call(object, key); + return false; }); - return result === false || hasOwnProperty.call(value, result); + return result !== false; } - return result; + // In most environments an object's own properties are iterated before + // its inherited properties. If the last iterated property is an object's + // own property then there are no inherited enumerable properties. + forIn(value, function(value, key) { + result = key; + }); + return result === undefined || hasOwnProperty.call(value, result); } /** diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 672016f21d..c5063acc7b 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -9,7 +9,7 @@ if(f){for(;++ok;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; e+="}"}return(t.b||wr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Kt,rr,rt,Or,ft,Ar,a,Mt,q,jr,F,Ut,ir)}function M(n){return ct(n)?lr(n):{}}function U(n){return Br[n]}function V(n){return"\\"+D[n]}function Q(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function W(n){this.__wrapped__=n}function X(){}function Y(n){return function(t,e,u,o){return typeof e!="boolean"&&null!=e&&(o=u,u=o&&o[e]===t?r:e,e=!1),null!=u&&(u=a.createCallback(u,o)),n(t,e,u,o) -}}function Z(n){var t=!1;if(!n||ir.call(n)!=P||!wr.argsClass&&rt(n))return t;var r=n.constructor;return(it(r)?r instanceof r:wr.nodeClass||!Q(n))?wr.ownLast?(Fr(n,function(n,r,e){return t=rr.call(e,r),!1}),!0===t):(Fr(n,function(n,r){t=r}),!1===t||rr.call(n,t)):t}function nt(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=zt(0>r?0:r);++er?0:r);++et||typeof n=="undefined")return 1;if(n=s,g={},y={"false":a,"function":a,"null":a,number:{},object:g,string:{},"true":a,undefined:a};if(v){for(;++ce?0:e);++re?0:e);++re?ve(0,u+e):e)||0,u&&typeof u=="number"?o=-1<(pt(n)?n.indexOf(t,e):H(n,t,e)):P(n,function(n){return++r ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3508 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3507 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -241,7 +241,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3538 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3537 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -266,7 +266,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3574 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3573 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -294,7 +294,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3644 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3643 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -354,7 +354,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3706 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3705 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -397,7 +397,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3750 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3749 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -429,7 +429,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3817 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3816 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -486,7 +486,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3851 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3850 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -510,7 +510,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3935 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3934 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -567,7 +567,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3976 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3975 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -596,7 +596,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4017 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4016 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -634,7 +634,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4096 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4095 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -694,7 +694,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4160 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4159 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -743,7 +743,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4192 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4191 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -767,7 +767,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4242 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4241 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -814,7 +814,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4280 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4279 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -838,7 +838,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4306 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4305 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -863,7 +863,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4326 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4325 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -887,7 +887,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4348 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4347 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -978,7 +978,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5425 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5424 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1008,7 +1008,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5442 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5441 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1029,7 +1029,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5459 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5458 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1060,7 +1060,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2497 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2496 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1088,7 +1088,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2539 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2538 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1126,7 +1126,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2593 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2592 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1162,7 +1162,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2645 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2644 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1208,7 +1208,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2706 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2705 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1254,7 +1254,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2773 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1303,7 +1303,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2820 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2819 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1335,7 +1335,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2870 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2869 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1372,7 +1372,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2903 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2902 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1401,7 +1401,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2955 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2954 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1446,7 +1446,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3012 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3011 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1488,7 +1488,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3081 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3080 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1530,7 +1530,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3131 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3130 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1560,7 +1560,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3163 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3162 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1598,7 +1598,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3206 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3205 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1629,7 +1629,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3266 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3265 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1672,7 +1672,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3287 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3286 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1696,7 +1696,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3320 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3319 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1726,7 +1726,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3367 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3366 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1772,7 +1772,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3423 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3422 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1809,7 +1809,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3458 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3457 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1833,7 +1833,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3490 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3489 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1870,7 +1870,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4388 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4387 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1898,7 +1898,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4421 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4420 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1929,7 +1929,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4452 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4451 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1960,7 +1960,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4498 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4497 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2001,7 +2001,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4521 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4520 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2028,7 +2028,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4580 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4579 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2082,7 +2082,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4656 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4655 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2115,7 +2115,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4709 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4708 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2140,7 +2140,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4735 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4734 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2167,7 +2167,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4759 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4758 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2193,7 +2193,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4789 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4788 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2219,7 +2219,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4824 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4823 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2246,7 +2246,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4855 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4854 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2283,7 +2283,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4888 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4887 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2315,7 +2315,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4953 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4952 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2351,7 +2351,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1253 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1252 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2389,7 +2389,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1308 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1307 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2436,7 +2436,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1433 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1432 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2482,7 +2482,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1457 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1456 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2508,7 +2508,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1479 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1478 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2536,7 +2536,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1520 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1519 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2572,7 +2572,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1545 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1544 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2600,7 +2600,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1562 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1561 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2627,7 +2627,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1587 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1586 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2652,7 +2652,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1604 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1603 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2676,7 +2676,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1116 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1115 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2703,7 +2703,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1142 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1141 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2730,7 +2730,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1630 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1629 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2754,7 +2754,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1647 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1646 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2778,7 +2778,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1664 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1663 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2802,7 +2802,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1689 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1688 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2832,7 +2832,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1748 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1747 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2877,7 +2877,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1929 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1928 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2915,7 +2915,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1946 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1945 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2939,7 +2939,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2009 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2008 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2974,7 +2974,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2031 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2030 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3001,7 +3001,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2048 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2047 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3025,7 +3025,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1976 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1975 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3055,7 +3055,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2076 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2075 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3090,7 +3090,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2101 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2100 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3114,7 +3114,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2118 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2117 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3138,7 +3138,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2135 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2134 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3162,7 +3162,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1175 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1174 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3186,7 +3186,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2194 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2193 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3242,7 +3242,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2303 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2302 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3273,7 +3273,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2337 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2336 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3297,7 +3297,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2375 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2374 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3328,7 +3328,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2429 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2428 "View in source") [Ⓣ][1] Transforms an `object` to an new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback`is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3365,7 +3365,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2462 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2461 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3396,7 +3396,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4977 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4976 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3420,7 +3420,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4995 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4994 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3445,7 +3445,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5021 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5020 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3475,7 +3475,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5050 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5049 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3495,7 +3495,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5074 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5073 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3522,7 +3522,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5097 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5096 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3550,7 +3550,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5141 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5140 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3603,7 +3603,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5225 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5224 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3685,7 +3685,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5350 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5349 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3717,7 +3717,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5377 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5376 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3741,7 +3741,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5397 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5396 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3794,7 +3794,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5639 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5638 "View in source") [Ⓣ][1] *(String)*: The semantic version number. From e9387d322c3f1c86bf4290798b89cd935e08171f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 26 May 2013 18:57:17 -0700 Subject: [PATCH 070/117] Disable use of `basicIndexOf` optimization if `_.indexOf` is customized. Former-commit-id: 5b2273b36934581e34c6f6042de95bf556c61ca2 --- build.js | 34 +++--- dist/lodash.compat.js | 29 ++++- dist/lodash.compat.min.js | 86 +++++++------- dist/lodash.js | 29 ++++- dist/lodash.min.js | 75 ++++++------ dist/lodash.underscore.js | 39 +++++-- dist/lodash.underscore.min.js | 57 ++++----- doc/README.md | 210 +++++++++++++++++----------------- lodash.js | 29 ++++- test/test.js | 74 +++++++++++- 10 files changed, 402 insertions(+), 260 deletions(-) diff --git a/build.js b/build.js index de40b79372..4bfc5c4027 100755 --- a/build.js +++ b/build.js @@ -88,14 +88,14 @@ 'cloneDeep': ['clone'], 'compact': [], 'compose': [], - 'contains': ['basicEach', 'basicIndexOf', 'isString'], + 'contains': ['basicEach', 'getIndexOf', 'isString'], 'countBy': ['createCallback', 'forEach'], 'createCallback': ['identity', 'isEqual', 'keys'], 'debounce': ['isObject'], 'defaults': ['createIterator', 'isArguments', 'keys'], 'defer': ['bind'], 'delay': [], - 'difference': ['basicIndexOf', 'createCache'], + 'difference': ['createCache'], 'escape': ['escapeHtmlChar'], 'every': ['basicEach', 'createCallback', 'isArray'], 'filter': ['basicEach', 'createCallback', 'isArray'], @@ -113,7 +113,7 @@ 'identity': [], 'indexOf': ['basicIndexOf', 'sortedIndex'], 'initial': ['slice'], - 'intersection': ['basicIndexOf', 'createCache'], + 'intersection': ['createCache'], 'invert': ['keys'], 'invoke': ['forEach'], 'isArguments': [], @@ -143,7 +143,7 @@ 'min': ['basicEach', 'charAtCallback', 'createCallback', 'isArray', 'isString'], 'mixin': ['forEach', 'functions'], 'noConflict': [], - 'omit': ['basicIndexOf', 'forIn'], + 'omit': ['forIn', 'getIndexOf'], 'once': [], 'pairs': ['keys'], 'parseInt': ['isString'], @@ -172,7 +172,7 @@ 'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'], 'unescape': ['unescapeHtmlChar'], 'union': ['isArray', 'uniq'], - 'uniq': ['basicIndexOf', 'createCache', 'overloadWrapper'], + 'uniq': ['createCache', 'getIndexOf', 'overloadWrapper'], 'uniqueId': [], 'unzip': ['max', 'pluck'], 'value': ['basicEach', 'forOwn', 'isArray', 'lodashWrapper'], @@ -189,11 +189,12 @@ 'charAtCallback': [], 'compareAscending': [], 'createBound': ['createObject', 'isFunction', 'isObject'], - 'createCache': ['basicIndexOf'], + 'createCache': ['basicIndexOf', 'getIndexOf'], 'createIterator': ['iteratorTemplate'], 'createObject': [ 'isObject', 'noop'], 'escapeHtmlChar': [], 'escapeStringChar': [], + 'getIndexOf': ['basicIndexOf', 'indexOf'], 'iteratorTemplate': [], 'isNode': [], 'lodashWrapper': [], @@ -2277,10 +2278,11 @@ if (!useLodashMethod('contains')) { source = replaceFunction(source, 'contains', [ 'function contains(collection, target) {', - ' var length = collection ? collection.length : 0,', + ' var indexOf = getIndexOf(),', + ' length = collection ? collection.length : 0,', ' result = false;', " if (length && typeof length == 'number') {", - ' result = basicIndexOf(collection, target) > -1;', + ' result = indexOf(collection, target) > -1;', ' } else {', ' basicEach(collection, function(value) {', ' return !(result = value === target);', @@ -2347,13 +2349,14 @@ source = replaceFunction(source, 'difference', [ 'function difference(array) {', ' var index = -1,', + ' indexOf = getIndexOf(),', ' length = array.length,', ' flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', ' result = [];', '', ' while (++index < length) {', ' var value = array[index];', - ' if (basicIndexOf(flattened, value) < 0) {', + ' if (indexOf(flattened, value) < 0) {', ' result.push(value);', ' }', ' }', @@ -2388,16 +2391,17 @@ ' var args = arguments,', ' argsLength = args.length,', ' index = -1,', + ' indexOf = getIndexOf(),', ' length = array ? array.length : 0,', ' result = [];', '', ' outer:', ' while (++index < length) {', ' var value = array[index];', - ' if (basicIndexOf(result, value) < 0) {', + ' if (indexOf(result, value) < 0) {', ' var argsIndex = argsLength;', ' while (--argsIndex) {', - ' if (basicIndexOf(args[argsIndex], value) < 0) {', + ' if (indexOf(args[argsIndex], value) < 0) {', ' continue outer;', ' }', ' }', @@ -2547,11 +2551,12 @@ if (!useLodashMethod('omit')) { source = replaceFunction(source, 'omit', [ 'function omit(object) {', - ' var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', + ' var indexOf = getIndexOf(),', + ' props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', ' result = {};', '', ' forIn(object, function(value, key) {', - ' if (basicIndexOf(props, key) < 0) {', + ' if (indexOf(props, key) < 0) {', ' result[key] = value;', ' }', ' });', @@ -2716,6 +2721,7 @@ source = replaceFunction(source, 'uniq', [ 'function uniq(array, isSorted, callback, thisArg) {', ' var index = -1,', + ' indexOf = getIndexOf(),', ' length = array ? array.length : 0,', ' result = [],', ' seen = result;', @@ -2735,7 +2741,7 @@ '', ' if (isSorted', ' ? !index || seen[seen.length - 1] !== computed', - ' : basicIndexOf(seen, computed) < 0', + ' : indexOf(seen, computed) < 0', ' ) {', ' if (callback) {', ' seen.push(computed);', diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 1a490c72ef..9541b516b4 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -776,8 +776,9 @@ var bailout, index = -1, + indexOf = getIndexOf(), length = array.length, - isLarge = length >= largeArraySize, + isLarge = length >= largeArraySize && lodash.indexOf != indexOf, objCache = {}; var caches = { @@ -792,7 +793,7 @@ }; function basicContains(value) { - return basicIndexOf(array, value) > -1; + return indexOf(array, value) > -1; } function basicPush(value) { @@ -938,6 +939,19 @@ return '\\' + stringEscapes[match]; } + /** + * Gets the appropriate "indexOf" function. If the `_.indexOf` method is + * customized, this method returns the custom method, otherwise it returns + * the `basicIndexOf` function. + * + * @private + * @returns {Function} Returns the "indexOf" function. + */ + function getIndexOf(array, value, fromIndex) { + var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result; + return result; + } + /** * Checks if `value` is a DOM node in IE < 9. * @@ -2281,7 +2295,8 @@ * // => { 'name': 'moe' } */ function omit(object, callback, thisArg) { - var isFunc = typeof callback == 'function', + var indexOf = getIndexOf(), + isFunc = typeof callback == 'function', result = {}; if (isFunc) { @@ -2292,7 +2307,7 @@ forIn(object, function(value, key, object) { if (isFunc ? !callback(value, key, object) - : basicIndexOf(props, key) < 0 + : indexOf(props, key) < 0 ) { result[key] = value; } @@ -2518,6 +2533,7 @@ */ function contains(collection, target, fromIndex) { var index = -1, + indexOf = getIndexOf(), length = collection ? collection.length : 0, result = false; @@ -2525,7 +2541,7 @@ if (length && typeof length == 'number') { result = (isString(collection) ? collection.indexOf(target, fromIndex) - : basicIndexOf(collection, target, fromIndex) + : indexOf(collection, target, fromIndex) ) > -1; } else { basicEach(collection, function(value) { @@ -4221,6 +4237,7 @@ */ var uniq = overloadWrapper(function(array, isSorted, callback) { var index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, isLarge = !isSorted && length >= largeArraySize, result = [], @@ -4232,7 +4249,7 @@ if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : basicIndexOf(seen, computed) < 0) + : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index c5063acc7b..6fb6238b4e 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,46 +4,46 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Or(n)&&rr.call(n,"__wrapped__")?n:new W(n)}function T(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(n=l,p={},s={"false":!1,"function":!1,"null":!1,number:{},object:p,string:{},"true":!1,undefined:!1}; -if(f){for(;++ok;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; -e+="}"}return(t.b||wr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Kt,rr,rt,Or,ft,Ar,a,Mt,q,jr,F,Ut,ir)}function M(n){return ct(n)?lr(n):{}}function U(n){return Br[n]}function V(n){return"\\"+D[n]}function Q(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function W(n){this.__wrapped__=n}function X(){}function Y(n){return function(t,e,u,o){return typeof e!="boolean"&&null!=e&&(o=u,u=o&&o[e]===t?r:e,e=!1),null!=u&&(u=a.createCallback(u,o)),n(t,e,u,o) -}}function Z(n){var t,e;return!n||ir.call(n)!=P||(t=n.constructor,it(t)&&!(t instanceof t))||!wr.argsClass&&rt(n)||!wr.nodeClass&&Q(n)?!1:wr.ownLast?(Fr(n,function(n,t,r){return e=rr.call(r,t),!1}),!1!==e):(Fr(n,function(n,t){e=t}),e===r||rr.call(n,e))}function nt(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=zt(0>r?0:r);++er?vr(0,u+r):r)||0,u&&typeof u=="number"?a=-1<(ft(n)?n.indexOf(t,r):T(n,t,r)):Ir(n,function(n){return++eu&&(u=i)}}else t=!t&&ft(n)?L:a.createCallback(t,r),Ir(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n)});return u}function _t(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Or(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Ar(n),o=c.length;else wr.unindexedChars&&ft(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),mt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function jt(n,t,r){var e;if(t=a.createCallback(t,r),Or(n)){r=-1;for(var u=n.length;++r>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var kr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Nr=at(Br),Pr=K(kr,{h:kr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),zr=K(kr),Fr=K(xr,Er,{i:!1}),$r=K(xr,Er); -it(/x/)&&(it=function(n){return typeof n=="function"&&ir.call(n)==B});var qr=tr?function(n){if(!n||ir.call(n)!=P||!wr.argsClass&&rt(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=tr(t))&&tr(r);return r?n==r||tr(n)==r:Z(n)}:Z,Dr=dt,Rr=Y(function Gr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e=l,o=[],i=a?J():r?[]:o;++en?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Pr,a.at=function(n){var t=-1,r=Yt.apply(Jt,dr.call(arguments,1)),e=r.length,u=zt(e);for(wr.unindexedChars&&ft(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),c=or(e,t),a}},a.defaults=zr,a.defer=It,a.delay=function(n,t){var e=dr.call(arguments,2);return or(function(){n.apply(r,e)},t)},a.difference=wt,a.filter=ht,a.flatten=Rr,a.forEach=mt,a.forIn=Fr,a.forOwn=$r,a.functions=ut,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),mt(n,function(n,r,u){r=Gt(t(n,r,u)),(rr.call(e,r)?e[r]:e[r]=[]).push(n) -}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return nt(n,0,hr(vr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=J(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++aT(o,r))&&(u[r]=n)}),u},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Ar(n),e=r.length,u=zt(e);++tr?vr(0,e+r):r||0}else if(r)return r=Et(n,t),n[r]===t?r:-1;return n?T(n,t,r):-1},a.isArguments=rt,a.isArray=Or,a.isBoolean=function(n){return!0===n||!1===n||ir.call(n)==S},a.isDate=function(n){return n?typeof n=="object"&&ir.call(n)==A:!1 -},a.isElement=function(n){return n?1===n.nodeType:!1},a.isEmpty=function(n){var t=!0;if(!n)return t;var r=ir.call(n),e=n.length;return r==O||r==F||(wr.argsClass?r==E:rt(n))||r==P&&typeof e=="number"&&it(n.splice)?!e:($r(n,function(){return t=!1}),t)},a.isEqual=ot,a.isFinite=function(n){return pr(n)&&!sr(parseFloat(n))},a.isFunction=it,a.isNaN=function(n){return lt(n)&&n!=+n},a.isNull=function(n){return null===n},a.isNumber=lt,a.isObject=ct,a.isPlainObject=qr,a.isRegExp=function(n){return!(!n||!q[typeof n])&&ir.call(n)==z -},a.isString=ft,a.isUndefined=function(n){return typeof n=="undefined"},a.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?vr(0,e+r):hr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=Nt,a.noConflict=function(){return e._=Vt,this},a.parseInt=Lr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=mr();return n%1||t%1?n+hr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+Zt(r*(t-n+1))},a.reduce=_t,a.reduceRight=Ct,a.result=function(n,t){var e=n?n[t]:r; -return it(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ar(n).length},a.some=jt,a.sortedIndex=Et,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=zr({},e,u);var o,i=zr({},e.imports,u.imports),u=Ar(i),i=st(i),c=0,l=e.interpolate||_,g="__p+='",l=Lt((e.escape||_).source+"|"+l.source+"|"+(l===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t -}),g+="';\n",l=e=e.variable,l||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=qt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Gt(n).replace(g,tt)},a.uniqueId=function(n){var t=++o;return Gt(null==n?"":n)+t -},a.all=vt,a.any=jt,a.detect=yt,a.foldl=_t,a.foldr=Ct,a.include=gt,a.inject=_t,$r(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return er.apply(t,arguments),n.apply(a,t)})}),a.first=kt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return nt(n,vr(0,u-e))}},a.take=kt,a.head=kt,$r(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); -return null==t||r&&typeof t!="function"?e:new W(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Gt(this.__wrapped__)},a.prototype.value=Pt,a.prototype.valueOf=Pt,Ir(["join","pop","shift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Ir(["push","reverse","sort","unshift"],function(n){var t=Jt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ir(["concat","slice","splice"],function(n){var t=Jt[n];a.prototype[n]=function(){return new W(t.apply(this.__wrapped__,arguments)) -}}),wr.spliceObjects||Ir(["pop","shift","splice"],function(n){var t=Jt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new W(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),E="[object Arguments]",O="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; -$[B]=!1,$[E]=$[O]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file +;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Ar(n)&&ur.call(n,"__wrapped__")?n:new X(n)}function T(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(n=l&&a.indexOf!=f,g={},v={"false":!1,"function":!1,"null":!1,number:{},object:g,string:{},"true":!1,undefined:!1}; +if(s){for(;++ik;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; +e+="}"}return(t.b||xr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Ut,ur,et,Ar,pt,Br,a,Vt,q,kr,F,Qt,lr)}function M(n){return lt(n)?pr(n):{}}function U(n){return Pr[n]}function V(n){return"\\"+D[n]}function Q(){var n=(n=a.indexOf)==Ot?T:n;return n}function W(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function X(n){this.__wrapped__=n}function Y(){}function Z(n){return function(t,e,u,o){return typeof e!="boolean"&&null!=e&&(o=u,u=o&&o[e]===t?r:e,e=!1),null!=u&&(u=a.createCallback(u,o)),n(t,e,u,o) +}}function nt(n){var t,e;return!n||lr.call(n)!=P||(t=n.constructor,ct(t)&&!(t instanceof t))||!xr.argsClass&&et(n)||!xr.nodeClass&&W(n)?!1:xr.ownLast?(qr(n,function(n,t,r){return e=ur.call(r,t),!1}),!1!==e):(qr(n,function(n,t){e=t}),e===r||ur.call(n,e))}function tt(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=$t(0>r?0:r);++er?yr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(pt(n)?n.indexOf(t,r):u(n,t,r)):Nr(n,function(n){return++eu&&(u=i)}}else t=!t&&pt(n)?L:a.createCallback(t,r),Nr(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n)});return u}function Ct(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Ar(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Br(n),o=c.length;else xr.unindexedChars&&pt(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),dt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function wt(n,t,r){var e;if(t=a.createCallback(t,r),Ar(n)){r=-1;for(var u=n.length;++rr?yr(0,e+r):r||0}else if(r)return r=St(n,t),n[r]===t?r:-1;return n?T(n,t,r):-1}function Et(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=a.createCallback(t,r);++u>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var Or={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},zr=ot(Pr),Fr=K(Or,{h:Or.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),$r=K(Or),qr=K(Er,Sr,{i:!1}),Dr=K(Er,Sr); +ct(/x/)&&(ct=function(n){return typeof n=="function"&&lr.call(n)==B});var Rr=er?function(n){if(!n||lr.call(n)!=P||!xr.argsClass&&et(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=er(t))&&er(r);return r?n==r||er(n)==r:nt(n)}:nt,Tr=bt,Lr=Z(function Jr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e=l,i=[],c=o?J():r?[]:i;++en?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Fr,a.at=function(n){var t=-1,r=nr.apply(Mt,_r.call(arguments,1)),e=r.length,u=$t(e);for(xr.unindexedChars&&pt(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),c=cr(e,t),a}},a.defaults=$r,a.defer=Nt,a.delay=function(n,t){var e=_r.call(arguments,2);return cr(function(){n.apply(r,e)},t)},a.difference=kt,a.filter=yt,a.flatten=Lr,a.forEach=dt,a.forIn=qr,a.forOwn=Dr,a.functions=at,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),dt(n,function(n,r,u){r=Jt(t(n,r,u)),(ur.call(e,r)?e[r]:e[r]=[]).push(n) +}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return tt(n,0,mr(yr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=J(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ae(i,r))&&(o[r]=n)}),o},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Br(n),e=r.length,u=$t(e);++tr?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; +return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(l===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t +}),g+="';\n",l=e=e.variable,l||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Rt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(g,rt)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t +},a.all=ht,a.any=wt,a.detect=mt,a.foldl=Ct,a.foldr=jt,a.include=vt,a.inject=Ct,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ar.apply(t,arguments),n.apply(a,t)})}),a.first=xt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return tt(n,yr(0,u-e))}},a.take=xt,a.head=xt,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); +return null==t||r&&typeof t!="function"?e:new X(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Ft,a.prototype.valueOf=Ft,Nr(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Nr(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Nr(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments)) +}}),xr.spliceObjects||Nr(["pop","shift","splice"],function(n){var t=Mt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new X(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),O="[object Arguments]",E="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; +$[B]=!1,$[O]=$[E]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 9d5dc28506..fd4c3b4c36 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -506,8 +506,9 @@ var bailout, index = -1, + indexOf = getIndexOf(), length = array.length, - isLarge = length >= largeArraySize, + isLarge = length >= largeArraySize && lodash.indexOf != indexOf, objCache = {}; var caches = { @@ -522,7 +523,7 @@ }; function basicContains(value) { - return basicIndexOf(array, value) > -1; + return indexOf(array, value) > -1; } function basicPush(value) { @@ -605,6 +606,19 @@ return '\\' + stringEscapes[match]; } + /** + * Gets the appropriate "indexOf" function. If the `_.indexOf` method is + * customized, this method returns the custom method, otherwise it returns + * the `basicIndexOf` function. + * + * @private + * @returns {Function} Returns the "indexOf" function. + */ + function getIndexOf(array, value, fromIndex) { + var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result; + return result; + } + /** * A fast path for creating `lodash` wrapper objects. * @@ -1948,7 +1962,8 @@ * // => { 'name': 'moe' } */ function omit(object, callback, thisArg) { - var isFunc = typeof callback == 'function', + var indexOf = getIndexOf(), + isFunc = typeof callback == 'function', result = {}; if (isFunc) { @@ -1959,7 +1974,7 @@ forIn(object, function(value, key, object) { if (isFunc ? !callback(value, key, object) - : basicIndexOf(props, key) < 0 + : indexOf(props, key) < 0 ) { result[key] = value; } @@ -2182,6 +2197,7 @@ */ function contains(collection, target, fromIndex) { var index = -1, + indexOf = getIndexOf(), length = collection ? collection.length : 0, result = false; @@ -2189,7 +2205,7 @@ if (length && typeof length == 'number') { result = (isString(collection) ? collection.indexOf(target, fromIndex) - : basicIndexOf(collection, target, fromIndex) + : indexOf(collection, target, fromIndex) ) > -1; } else { forOwn(collection, function(value) { @@ -3895,6 +3911,7 @@ */ var uniq = overloadWrapper(function(array, isSorted, callback) { var index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, isLarge = !isSorted && length >= largeArraySize, result = [], @@ -3906,7 +3923,7 @@ if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : basicIndexOf(seen, computed) < 0) + : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 1c0e20bdcf..23c306b7c7 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,42 +4,41 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(o){function f(n){if(!n||oe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=te(t))&&te(e);return e?n==e||te(n)==e:tt(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?ke(n):[],o=u.length;++rt||typeof n=="undefined")return 1;if(n=s,g={},y={"false":a,"function":a,"null":a,number:{},object:g,string:{},"true":a,undefined:a};if(v){for(;++ce?0:e);++re?ve(0,u+e):e)||0,u&&typeof u=="number"?o=-1<(pt(n)?n.indexOf(t,e):H(n,t,e)):P(n,function(n){return++ru&&(u=o) -}}else t=!t&&pt(n)?J:G.createCallback(t,e),mt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function kt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Tt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length; -if(typeof u!="number")var i=ke(n),u=i.length;return t=G.createCallback(t,r,4),mt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function Ct(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},Z.prototype=G.prototype;var _e=ce,ke=se?function(n){return ct(n)?se(n):[]}:V,je={"&":"&","<":"<",">":">",'"':""","'":"'"},we=ot(je),qt=nt(function xe(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=s,o=[],i=a?W():e?[]:o;++rn?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=Yt.apply(Ht,be.call(arguments,1)),r=e.length,u=Tt(r);++t++l&&(f=n.apply(c,i)),p=ae(o,t),f}},G.defaults=M,G.defer=$t,G.delay=function(n,t){var r=be.call(arguments,2);return ae(function(){n.apply(e,r)},t)},G.difference=xt,G.filter=ht,G.flatten=qt,G.forEach=mt,G.forIn=K,G.forOwn=P,G.functions=at,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),mt(n,function(n,e,u){e=Vt(t(n,e,u)),(ee.call(r,e)?r[e]:r[e]=[]).push(n) -}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return et(n,0,ge(ve(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=W(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++aH(a,e))&&(u[e]=n)}),u},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=ke(n),r=e.length,u=Tt(r);++te?ve(0,r+e):e||0}else if(e)return e=St(n,t),n[e]===t?e:-1;return n?H(n,t,e):-1},G.isArguments=function(n){return oe.call(n)==E},G.isArray=_e,G.isBoolean=function(n){return n===r||n===a||oe.call(n)==I -},G.isDate=function(n){return n?typeof n=="object"&&oe.call(n)==N:a},G.isElement=function(n){return n?1===n.nodeType:a},G.isEmpty=function(n){var t=r;if(!n)return t;var e=oe.call(n),u=n.length;return e==S||e==R||e==E||e==B&&typeof u=="number"&&ft(n.splice)?!u:(P(n,function(){return t=a}),t)},G.isEqual=it,G.isFinite=function(n){return le(n)&&!pe(parseFloat(n))},G.isFunction=ft,G.isNaN=function(n){return lt(n)&&n!=+n},G.isNull=function(n){return n===u},G.isNumber=lt,G.isObject=ct,G.isPlainObject=f,G.isRegExp=function(n){return n?typeof n=="object"&&oe.call(n)==F:a -},G.isString=pt,G.isUndefined=function(n){return typeof n=="undefined"},G.lastIndexOf=function(n,t,e){var r=n?n.length:0;for(typeof e=="number"&&(r=(0>e?ve(0,r+e):ge(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Ft,G.noConflict=function(){return o._=Lt,this},G.parseInt=ue,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=he();return n%1||t%1?n+ge(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+Zt(e*(t-n+1))},G.reduce=jt,G.reduceRight=wt,G.result=function(n,t){var r=n?n[t]:e; -return ft(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ke(n).length},G.some=Ct,G.sortedIndex=St,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=ke(i),i=vt(i),f=0,c=u.interpolate||w,l="__p+='",c=Ut((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,Y),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t -}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var p=zt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Vt(n).replace(h,rt)},G.uniqueId=function(n){var t=++c;return Vt(n==u?"":n)+t -},G.all=yt,G.any=Ct,G.detect=bt,G.foldl=jt,G.foldr=wt,G.include=gt,G.inject=jt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return re.apply(t,arguments),n.apply(G,t)})}),G.first=Ot,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return et(n,ve(0,a-r))}},G.take=Ot,G.head=Ot,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e); -return t==u||e&&typeof t!="function"?r:new Z(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Vt(this.__wrapped__)},G.prototype.value=Rt,G.prototype.valueOf=Rt,mt(["join","pop","shift"],function(n){var t=Ht[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),mt(["push","reverse","sort","unshift"],function(n){var t=Ht[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),mt(["concat","slice","splice"],function(n){var t=Ht[n];G.prototype[n]=function(){return new Z(t.apply(this.__wrapped__,arguments)) -}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; +;!function(n){function t(o){function f(n){if(!n||fe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=re(t))&&re(e);return e?n==e||re(n)==e:et(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?xe(n):[],o=u.length;++rt||typeof n=="undefined")return 1;if(n=s&&G.indexOf!=l,y={},h={"false":a,"function":a,"null":a,number:{},object:y,string:{},"true":a,undefined:a};if(g){for(;++ce?0:e);++re?ye(0,o+e):e)||0,o&&typeof o=="number"?i=-1<(st(n)?n.indexOf(t,e):u(n,t,e)):P(n,function(n){return++ru&&(u=o)}}else t=!t&&st(n)?J:G.createCallback(t,e),dt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function jt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;if(typeof u!="number")var i=xe(n),u=i.length;return t=G.createCallback(t,r,4),dt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function xt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ye(0,r+e):e||0}else if(e)return e=Nt(n,t),n[e]===t?e:-1;return n?H(n,t,e):-1}function It(n,t,e){if(typeof t!="number"&&t!=u){var r=0,a=-1,o=n?n.length:0;for(t=G.createCallback(t,e);++a>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},nt.prototype=G.prototype;var Ce=pe,xe=ge?function(n){return lt(n)?ge(n):[]}:V,Oe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ee=it(Oe),Se=tt(function Ae(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=s,i=[],f=o?W():e?[]:i;++rn?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=ne.apply(Lt,de.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(f=n.apply(c,i)),p=ie(o,t),f}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=de.call(arguments,2);return ie(function(){n.apply(e,r)},t)},G.difference=Ot,G.filter=bt,G.flatten=Se,G.forEach=dt,G.forIn=K,G.forOwn=P,G.functions=ot,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),dt(n,function(n,e,u){e=Ht(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n) +}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return rt(n,0,he(ye(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=W(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ar(o,e))&&(a[e]=n)}),a},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=xe(n),r=e.length,u=Dt(r);++te?ye(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Wt,this},G.parseInt=Ne,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},G.reduce=wt,G.reduceRight=Ct,G.result=function(n,t){var r=n?n[t]:e;return ct(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:xe(n).length +},G.some=xt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=xe(i),i=gt(i),f=0,c=u.interpolate||w,l="__p+='",c=Gt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,Y),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; +try{var p=Kt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Ht(n).replace(h,ut)},G.uniqueId=function(n){var t=++c;return Ht(n==u?"":n)+t},G.all=ht,G.any=xt,G.detect=mt,G.foldl=wt,G.foldr=Ct,G.include=yt,G.inject=wt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(G,t)})}),G.first=Et,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; +for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return rt(n,ye(0,a-r))}},G.take=Et,G.head=Et,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new nt(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Ht(this.__wrapped__)},G.prototype.value=qt,G.prototype.valueOf=qt,dt(["join","pop","shift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),dt(["push","reverse","sort","unshift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),dt(["concat","slice","splice"],function(n){var t=Lt[n];G.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments))}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; T[A]=a,T[E]=T[S]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index beeaaae7fc..fb47ab194c 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -430,8 +430,9 @@ var bailout, index = -1, + indexOf = getIndexOf(), length = array.length, - isLarge = length >= largeArraySize, + isLarge = length >= largeArraySize && lodash.indexOf != indexOf, objCache = {}; var caches = { @@ -446,7 +447,7 @@ }; function basicContains(value) { - return basicIndexOf(array, value) > -1; + return indexOf(array, value) > -1; } function basicPush(value) { @@ -540,6 +541,19 @@ return '\\' + stringEscapes[match]; } + /** + * Gets the appropriate "indexOf" function. If the `_.indexOf` method is + * customized, this method returns the custom method, otherwise it returns + * the `basicIndexOf` function. + * + * @private + * @returns {Function} Returns the "indexOf" function. + */ + function getIndexOf(array, value, fromIndex) { + var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result; + return result; + } + /** * A fast path for creating `lodash` wrapper objects. * @@ -1432,11 +1446,12 @@ * // => { 'name': 'moe' } */ function omit(object) { - var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + var indexOf = getIndexOf(), + props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), result = {}; forIn(object, function(value, key) { - if (basicIndexOf(props, key) < 0) { + if (indexOf(props, key) < 0) { result[key] = value; } }); @@ -1565,10 +1580,11 @@ * // => true */ function contains(collection, target) { - var length = collection ? collection.length : 0, + var indexOf = getIndexOf(), + length = collection ? collection.length : 0, result = false; if (length && typeof length == 'number') { - result = basicIndexOf(collection, target) > -1; + result = indexOf(collection, target) > -1; } else { forOwn(collection, function(value) { return (result = value === target) && indicatorObject; @@ -2596,13 +2612,14 @@ */ function difference(array) { var index = -1, + indexOf = getIndexOf(), length = array.length, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), result = []; while (++index < length) { var value = array[index]; - if (basicIndexOf(flattened, value) < 0) { + if (indexOf(flattened, value) < 0) { result.push(value); } } @@ -2873,16 +2890,17 @@ var args = arguments, argsLength = args.length, index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, result = []; outer: while (++index < length) { var value = array[index]; - if (basicIndexOf(result, value) < 0) { + if (indexOf(result, value) < 0) { var argsIndex = argsLength; while (--argsIndex) { - if (basicIndexOf(args[argsIndex], value) < 0) { + if (indexOf(args[argsIndex], value) < 0) { continue outer; } } @@ -3258,6 +3276,7 @@ */ function uniq(array, isSorted, callback, thisArg) { var index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, result = [], seen = result; @@ -3277,7 +3296,7 @@ if (isSorted ? !index || seen[seen.length - 1] !== computed - : basicIndexOf(seen, computed) < 0 + : indexOf(seen, computed) < 0 ) { if (callback) { seen.push(computed); diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 85c7df7e87..a90a55f181 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,31 +4,32 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n,t){var r;if(n&&ht[typeof n])for(r in n)if(xt.call(n,r)&&t(n[r],r,n)===tt)break}function r(n,t){var r;if(n&&ht[typeof n])for(r in n)if(t(n[r],r,n)===tt)break}function e(n){var t,r=[];if(!n||!ht[typeof n])return r;for(t in n)xt.call(n,t)&&r.push(t);return r}function u(n){return n instanceof u?n:new p(n)}function o(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1; -if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function R(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++rarguments.length;r=G(r,u,4);var i=-1,a=n.length; -if(typeof a=="number")for(o&&(e=n[++i]);++iarguments.length;if(typeof u!="number")var i=Pt(n),u=i.length;return t=G(t,e,4),B(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=Q,n[a]):t(r,n[a],a,f)}),r}function T(n,r,e){var u;r=G(r,e),e=-1;var o=n?n.length:0;if(typeof o=="number")for(;++eo(e,i)&&u.push(i)}return u}function z(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=L){var o=-1;for(t=G(t,r);++o>>1,r(n[e])o(f,c))&&(r&&f.push(c),a.push(e))}return a}function W(n,t){return zt.fastBind||Nt&&2"']/g,it=/['\n\r\t\u2028\u2029\\]/g,at="[object Arguments]",ft="[object Array]",ct="[object Boolean]",lt="[object Date]",pt="[object Number]",st="[object Object]",vt="[object RegExp]",gt="[object String]",ht={"boolean":Q,"function":K,object:K,number:Q,string:Q,undefined:Q},yt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},mt=Array.prototype,Z=Object.prototype,_t=n._,bt=RegExp("^"+(Z.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),dt=Math.ceil,jt=n.clearTimeout,wt=mt.concat,At=Math.floor,xt=Z.hasOwnProperty,Ot=mt.push,Et=n.setTimeout,St=Z.toString,Nt=bt.test(Nt=St.bind)&&Nt,kt=bt.test(kt=Object.create)&&kt,Bt=bt.test(Bt=Array.isArray)&&Bt,Ft=n.isFinite,qt=n.isNaN,Rt=bt.test(Rt=Object.keys)&&Rt,Dt=Math.max,Mt=Math.min,Tt=Math.random,$t=mt.slice,Z=bt.test(n.attachEvent),It=Nt&&!/\n|true/.test(Nt+Z),zt={}; -!function(){var n={0:1,length:1};zt.fastBind=Nt&&!It,zt.spliceObjects=(mt.splice.call(n,0,1),!n[0])}(1),u.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},kt||(f=function(n){if(w(n)){s.prototype=n;var t=new s;s.prototype=L}return t||{}}),p.prototype=u.prototype,g(arguments)||(g=function(n){return n?xt.call(n,"callee"):Q});var Ct=Bt||function(n){return n?typeof n=="object"&&St.call(n)==ft:Q},Pt=Rt?function(n){return w(n)?Rt(n):[]}:e,Ut={"&":"&","<":"<",">":">",'"':""","'":"'"},Vt=_(Ut); -j(/x/)&&(j=function(n){return typeof n=="function"&&"[object Function]"==St.call(n)}),u.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},u.bind=W,u.bindAll=function(n){for(var t=1o(i,a)){for(var f=r;--f;)if(0>o(t[f],a))continue n;i.push(a)}}return i},u.invert=_,u.invoke=function(n,t){var r=$t.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return B(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},u.keys=Pt,u.map=F,u.max=q,u.memoize=function(n,t){var r={};return function(){var e=rt+(t?t.apply(this,arguments):arguments[0]);return xt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},u.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=G(t,r),B(n,function(n,r,o){r=t(n,r,o),ro(t,r)&&(e[r]=n) -}),e},u.once=function(n){var t,r;return function(){return t?r:(t=K,r=n.apply(this,arguments),n=L,r)}},u.pairs=function(n){for(var t=-1,r=Pt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Dt(0,e+r):r||0}else if(r)return r=U(n,t),n[r]===t?r:-1;return n?o(n,t,r):-1},u.isArguments=g,u.isArray=Ct,u.isBoolean=function(n){return n===K||n===Q||St.call(n)==ct},u.isDate=function(n){return n?typeof n=="object"&&St.call(n)==lt:Q},u.isElement=function(n){return n?1===n.nodeType:Q},u.isEmpty=b,u.isEqual=d,u.isFinite=function(n){return Ft(n)&&!qt(parseFloat(n)) -},u.isFunction=j,u.isNaN=function(n){return A(n)&&n!=+n},u.isNull=function(n){return n===L},u.isNumber=A,u.isObject=w,u.isRegExp=function(n){return!(!n||!ht[typeof n])&&St.call(n)==vt},u.isString=x,u.isUndefined=function(n){return typeof n=="undefined"},u.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?Dt(0,e+r):Mt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},u.mixin=J,u.noConflict=function(){return n._=_t,this},u.random=function(n,t){n==L&&t==L&&(t=1),n=+n||0,t==L?(t=n,n=0):t=+t||0; -var r=Tt();return n%1||t%1?n+Mt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+At(r*(t-n+1))},u.reduce=D,u.reduceRight=M,u.result=function(n,t){var r=n?n[t]:L;return j(r)?n[t]():r},u.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Pt(n).length},u.some=T,u.sortedIndex=U,u.template=function(n,t,r){n||(n=""),r=y({},r,u.templateSettings);var e=0,o="__p+='",i=r.variable;n.replace(RegExp((r.escape||ut).source+"|"+(r.interpolate||ut).source+"|"+(r.evaluate||ut).source+"|$","g"),function(t,r,u,i,a){return o+=n.slice(e,a).replace(it,l),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),u&&(o+="'+((__t=("+u+"))==null?'':__t)+'"),e=a+t.length,t -}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var a=Function("_","return "+o)(u)}catch(f){throw f.source=o,f}return t?a(t):(a.source=o,a)},u.unescape=function(n){return n==L?"":(n+"").replace(et,v)},u.uniqueId=function(n){var t=++nt+"";return n?n+t:t},u.all=S,u.any=T,u.detect=k,u.foldl=D,u.foldr=M,u.include=E,u.inject=D,u.first=z,u.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t!="number"&&t!=L){var o=u;for(t=G(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==L||r)return n[u-1];return $t.call(n,Dt(0,u-e))}},u.take=z,u.head=z,u.VERSION="1.2.1",J(u),u.prototype.chain=function(){return this.__chain__=K,this},u.prototype.value=function(){return this.__wrapped__},B("pop push reverse shift sort splice unshift".split(" "),function(n){var t=mt[n];u.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!zt.spliceObjects&&0===n.length&&delete n[0],this}}),B(["concat","join","slice"],function(n){var t=mt[n]; -u.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new p(n),n.__chain__=K),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=u, define(function(){return u})):X&&!X.nodeType?Y?(Y.exports=u)._=u:X._=u:n._=u}(this); \ No newline at end of file +;!function(n){function t(n){return n instanceof t?n:new l(n)}function r(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)}); +else for(;++ou&&(u=r);return u}function k(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=W(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=$t(n),u=i.length;return t=W(t,e,4),N(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f) +}),r}function D(n,t,r){var e;t=W(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rr(u,i)&&o.push(i)}return o}function $(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=W(t,r);++oe?Ft(0,u+e):e||0}else if(e)return e=P(n,t),n[e]===t?e:-1;return n?r(n,t,e):-1}function C(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=W(t,r);++u>>1,r(n[e])o(l,c))&&(r&&l.push(c),a.push(e))}return a}function V(n,t){return Mt.fastBind||xt&&2"']/g,rt=/['\n\r\t\u2028\u2029\\]/g,et="[object Arguments]",ut="[object Array]",ot="[object Boolean]",it="[object Date]",at="[object Number]",ft="[object Object]",lt="[object RegExp]",ct="[object String]",pt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},vt=Array.prototype,L=Object.prototype,gt=n._,ht=RegExp("^"+(L.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),yt=Math.ceil,mt=n.clearTimeout,_t=vt.concat,bt=Math.floor,dt=L.hasOwnProperty,jt=vt.push,wt=n.setTimeout,At=L.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Nt=n.isNaN,Bt=ht.test(Bt=Object.keys)&&Bt,Ft=Math.max,kt=Math.min,qt=Math.random,Rt=vt.slice,L=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+L),Mt={}; +!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(vt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(o=function(n){if(d(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}}),l.prototype=t.prototype,s(arguments)||(s=function(n){return n?dt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==ut:!1},Et=function(n){var t,r=[];if(!n||!pt[typeof n])return r; +for(t in n)dt.call(n,t)&&r.push(t);return r},$t=Bt?function(n){return d(n)?Bt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=y(It),Ct=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(t(n[r],r,n)===X)break;return n},Pt=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(dt.call(n,r)&&t(n[r],r,n)===X)break;return n};b(/x/)&&(b=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},t.bind=V,t.bindAll=function(n){for(var t=1u(i,a)){for(var l=r;--l;)if(0>u(t[l],a))continue n;i.push(a)}}return i},t.invert=y,t.invoke=function(n,t){var r=Rt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=B,t.max=F,t.memoize=function(n,t){var r={};return function(){var e=Y+(t?t.apply(this,arguments):arguments[0]);return dt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=W(t,r),N(n,function(n,r,o){r=t(n,r,o),rt(r,u)&&(e[u]=n) +}),e},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+bt(r*(t-n+1)) +},t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null;return b(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){n||(n=""),e=g({},e,t.templateSettings);var u=0,o="__p+='",i=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,i,f){return o+=n.slice(u,f).replace(rt,a),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),e&&(o+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t +}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var f=Function("_","return "+o)(t)}catch(l){throw l.source=o,l}return r?f(r):(f.source=o,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},t.uniqueId=function(n){var t=++Q+"";return n?n+t:t},t.all=O,t.any=D,t.detect=S,t.foldl=q,t.foldr=R,t.include=x,t.inject=q,t.first=$,t.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&null!=t){var o=u;for(t=W(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Ft(0,u-e))}},t.take=$,t.head=$,t.VERSION="1.2.1",H(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var r=vt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this +}}),N(["concat","join","slice"],function(n){var r=vt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new l(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):J&&!J.nodeType?K?(K.exports=t)._=t:J._=t:n._=t}(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 7d8f1347a8..56e9689716 100644 --- a/doc/README.md +++ b/doc/README.md @@ -217,7 +217,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3507 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3523 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -241,7 +241,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3537 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3553 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -266,7 +266,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3573 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3589 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -294,7 +294,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3643 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3659 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -354,7 +354,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3705 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3721 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -397,7 +397,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3749 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3765 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -429,7 +429,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3816 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3832 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -486,7 +486,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3850 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3866 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -510,7 +510,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3934 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3950 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -567,7 +567,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3975 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3991 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -596,7 +596,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4016 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4032 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -634,7 +634,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4095 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4111 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -694,7 +694,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4159 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4175 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -743,7 +743,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4191 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4207 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -767,7 +767,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4241 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4257 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -814,7 +814,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4279 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4296 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -838,7 +838,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4305 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4322 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -863,7 +863,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4325 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4342 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -887,7 +887,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4347 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4364 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -978,7 +978,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5424 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5441 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1008,7 +1008,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5441 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5458 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1029,7 +1029,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5458 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5475 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1060,7 +1060,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2496 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2511 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1088,7 +1088,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2538 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2553 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1126,7 +1126,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2592 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2608 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1162,7 +1162,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2644 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2660 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1208,7 +1208,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2705 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2721 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1254,7 +1254,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2772 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2788 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1303,7 +1303,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2819 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2835 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1335,7 +1335,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2869 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2885 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1372,7 +1372,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2902 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2918 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1401,7 +1401,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2954 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2970 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1446,7 +1446,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3011 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3027 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1488,7 +1488,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3080 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3096 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1530,7 +1530,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3130 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3146 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1560,7 +1560,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3162 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3178 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1598,7 +1598,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3205 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3221 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1629,7 +1629,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3265 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3281 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1672,7 +1672,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3286 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3302 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1696,7 +1696,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3319 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3335 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1726,7 +1726,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3366 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3382 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1772,7 +1772,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3422 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3438 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1809,7 +1809,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3457 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3473 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1833,7 +1833,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3489 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3505 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1870,7 +1870,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4387 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4404 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1898,7 +1898,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4420 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4437 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1929,7 +1929,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4451 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4468 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1960,7 +1960,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4497 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4514 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2001,7 +2001,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4520 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4537 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2028,7 +2028,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4579 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4596 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2082,7 +2082,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4655 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4672 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2115,7 +2115,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4708 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4725 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2140,7 +2140,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4734 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4751 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2167,7 +2167,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4758 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4775 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2193,7 +2193,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4788 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4805 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2219,7 +2219,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4823 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4840 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2246,7 +2246,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4854 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4871 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2283,7 +2283,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4887 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4904 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2315,7 +2315,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4952 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4969 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2351,7 +2351,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1252 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1266 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2389,7 +2389,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1307 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1321 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2436,7 +2436,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1432 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1446 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2482,7 +2482,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1456 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1470 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2508,7 +2508,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1478 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1492 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2536,7 +2536,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1519 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1533 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2572,7 +2572,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1544 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1558 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2600,7 +2600,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1561 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1575 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2627,7 +2627,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1586 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1600 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2652,7 +2652,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1603 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1617 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2676,7 +2676,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1115 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1129 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2703,7 +2703,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1141 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1155 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2730,7 +2730,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1629 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1643 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2754,7 +2754,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1646 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1660 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2778,7 +2778,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1663 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1677 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2802,7 +2802,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1688 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1702 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2832,7 +2832,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1747 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1761 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2877,7 +2877,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1928 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1942 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2915,7 +2915,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1945 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1959 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2939,7 +2939,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2008 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2022 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2974,7 +2974,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2030 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2044 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3001,7 +3001,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2047 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2061 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3025,7 +3025,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1975 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1989 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3055,7 +3055,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2075 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2089 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3090,7 +3090,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2100 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2114 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3114,7 +3114,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2117 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2131 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3138,7 +3138,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2134 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2148 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3162,7 +3162,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1174 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1188 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3186,7 +3186,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2193 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2207 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3242,7 +3242,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2302 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2316 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3273,7 +3273,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2336 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2351 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3297,7 +3297,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2374 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2389 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3328,7 +3328,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2428 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2443 "View in source") [Ⓣ][1] Transforms an `object` to an new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback`is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3365,7 +3365,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2461 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2476 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3396,7 +3396,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4976 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4993 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3420,7 +3420,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4994 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5011 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3445,7 +3445,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5020 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5037 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3475,7 +3475,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5049 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5066 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3495,7 +3495,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5073 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5090 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3522,7 +3522,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5096 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5113 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3550,7 +3550,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5140 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5157 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3603,7 +3603,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5224 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5241 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3685,7 +3685,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5349 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5366 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3717,7 +3717,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5376 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5393 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3741,7 +3741,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5396 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5413 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3794,7 +3794,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5638 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5655 "View in source") [Ⓣ][1] *(String)*: The semantic version number. diff --git a/lodash.js b/lodash.js index ba98b3342d..7bc10572fd 100644 --- a/lodash.js +++ b/lodash.js @@ -793,8 +793,9 @@ var bailout, index = -1, + indexOf = getIndexOf(), length = array.length, - isLarge = length >= largeArraySize, + isLarge = length >= largeArraySize && lodash.indexOf != indexOf, objCache = {}; var caches = { @@ -809,7 +810,7 @@ }; function basicContains(value) { - return basicIndexOf(array, value) > -1; + return indexOf(array, value) > -1; } function basicPush(value) { @@ -957,6 +958,19 @@ return '\\' + stringEscapes[match]; } + /** + * Gets the appropriate "indexOf" function. If the `_.indexOf` method is + * customized, this method returns the custom method, otherwise it returns + * the `basicIndexOf` function. + * + * @private + * @returns {Function} Returns the "indexOf" function. + */ + function getIndexOf(array, value, fromIndex) { + var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result; + return result; + } + /** * Checks if `value` is a DOM node in IE < 9. * @@ -2300,7 +2314,8 @@ * // => { 'name': 'moe' } */ function omit(object, callback, thisArg) { - var isFunc = typeof callback == 'function', + var indexOf = getIndexOf(), + isFunc = typeof callback == 'function', result = {}; if (isFunc) { @@ -2311,7 +2326,7 @@ forIn(object, function(value, key, object) { if (isFunc ? !callback(value, key, object) - : basicIndexOf(props, key) < 0 + : indexOf(props, key) < 0 ) { result[key] = value; } @@ -2537,6 +2552,7 @@ */ function contains(collection, target, fromIndex) { var index = -1, + indexOf = getIndexOf(), length = collection ? collection.length : 0, result = false; @@ -2544,7 +2560,7 @@ if (length && typeof length == 'number') { result = (isString(collection) ? collection.indexOf(target, fromIndex) - : basicIndexOf(collection, target, fromIndex) + : indexOf(collection, target, fromIndex) ) > -1; } else { basicEach(collection, function(value) { @@ -4240,6 +4256,7 @@ */ var uniq = overloadWrapper(function(array, isSorted, callback) { var index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, isLarge = !isSorted && length >= largeArraySize, result = [], @@ -4251,7 +4268,7 @@ if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : basicIndexOf(seen, computed) < 0) + : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) ) { if (callback || isLarge) { seen.push(computed); diff --git a/test/test.js b/test/test.js index d50c9ecf4f..7403ed75e1 100644 --- a/test/test.js +++ b/test/test.js @@ -72,6 +72,9 @@ undefined ]; + /** Used as the size when optimizations are enabled for large arrays */ + var largeArraySize = 75; + /** Used to set property descriptors */ var setDescriptor = (function() { try { @@ -1241,7 +1244,7 @@ stringObject = Object(stringLiteral), expected = [stringLiteral, stringObject]; - var array = _.times(100, function(count) { + var array = _.times(largeArraySize, function(count) { return count % 2 ? stringObject : stringLiteral; }); @@ -1354,6 +1357,68 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('custom `_.indexOf` methods'); + + (function() { + function custom(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; + + while (++index < length) { + var other = array[index]; + if (other === value || + (_.isObject(value) && other instanceof Foo) || + (other === 'x' && /[13]/.test(value))) { + return index; + } + } + return -1; + } + + function Foo() {} + + var array = [1, new Foo, 3, new Foo], + indexOf = _.indexOf; + + test('_.contains should work with a custom `_.indexOf` method', function() { + _.indexOf = custom; + ok(_.contains(array, new Foo)); + _.indexOf = indexOf; + }); + + test('_.difference should work with a custom `_.indexOf` method', function() { + _.indexOf = custom; + deepEqual(_.difference(array, [new Foo]), [1, 3]); + _.indexOf = indexOf; + }); + + test('_.intersection should work with a custom `_.indexOf` method', function() { + _.indexOf = custom; + deepEqual(_.intersection(array, [new Foo]), [array[1]]); + _.indexOf = indexOf; + }); + + test('_.omit should work with a custom `_.indexOf` method', function() { + _.indexOf = custom; + deepEqual(_.omit(array, ['x']), { '0': 1, '2': 3 }); + _.indexOf = indexOf; + }); + + test('_.uniq should work with a custom `_.indexOf` method', function() { + _.indexOf = custom; + deepEqual(_.uniq(array), array.slice(0, 3)); + + var largeArray = _.times(largeArraySize, function() { + return new Foo; + }); + + deepEqual(_.uniq(largeArray), [largeArray[0]]); + _.indexOf = indexOf; + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.initial'); (function() { @@ -3203,13 +3268,14 @@ test('should distinguish between numbers and numeric strings', function() { var array = [], - expected = ['2', 2, Object('2'), Object(2)]; + expected = ['2', 2, Object('2'), Object(2)], + count = Math.ceil(largeArraySize / expected.length); - _.times(50, function() { + _.times(count, function() { array.push.apply(array, expected); }); - deepEqual(_.uniq(expected), expected); + deepEqual(_.uniq(array), expected); }); _.each({ From fe00c628f4fcf0fb71e321934c6be8d549e46514 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 26 May 2013 23:19:10 -0700 Subject: [PATCH 071/117] Fix build. Former-commit-id: 8dfb12b5883e59111857360ee5392c62e5e9146f --- build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.js b/build.js index 4bfc5c4027..8c88e6a505 100755 --- a/build.js +++ b/build.js @@ -1952,7 +1952,7 @@ _.each(['difference', 'intersection', 'uniq'], function(methodName) { if (!useLodashMethod(methodName)) { - dependencyMap[methodName] = _.without(dependencyMap[methodName], 'createCache'); + dependencyMap[methodName] = ['getIndexOf'].concat(_.without(dependencyMap[methodName], 'createCache')); } }); From 507f2ec544ea84817b48733e3dffab7f2d3f32d3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 27 May 2013 13:04:26 -0700 Subject: [PATCH 072/117] Avoid minifier tricks for boolean literals in expressions. Former-commit-id: a02445f97a81c330018247140784818be830595f --- build/post-compile.js | 13 +++++++++++++ dist/lodash.compat.min.js | 22 +++++++++++----------- dist/lodash.min.js | 12 ++++++------ dist/lodash.underscore.min.js | 2 +- 4 files changed, 31 insertions(+), 18 deletions(-) diff --git a/build/post-compile.js b/build/post-compile.js index 310578134e..c7eb6dc0e8 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -37,6 +37,19 @@ '\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000"' ); + // replace vars for `false` and `true` with boolean literals + [/(\w+)\s*=\s*!1\b/.exec(source), /(\w+)\s*=\s*!0\b/.exec(source)].forEach(function(varName, index) { + if (varName) { + varName = varName[1]; + source = source.replace(RegExp('([!=]==\\s*)' + varName + '|' + varName + '(\\s*[!=]==)', 'g'), '$1' + !!index + '$2'); + } + }); + + // replace `!1` and `!0` in expressions with `false` and `true` values + source = source + .replace(/([!=]==\s*)!1|!1(\s*[!=]==)/g, '$1false$2') + .replace(/([!=]==\s*)!0|!0(\s*[!=]==)/g, '$1true$2'); + // flip `typeof` expressions to help optimize Safari and // correct the AMD module definition for AMD build optimizers // (e.g. from `"number" == typeof x` to `typeof x == "number") diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 6fb6238b4e..deae2acced 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -9,14 +9,14 @@ if(s){for(;++ik;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; e+="}"}return(t.b||xr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Ut,ur,et,Ar,pt,Br,a,Vt,q,kr,F,Qt,lr)}function M(n){return lt(n)?pr(n):{}}function U(n){return Pr[n]}function V(n){return"\\"+D[n]}function Q(){var n=(n=a.indexOf)==Ot?T:n;return n}function W(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function X(n){this.__wrapped__=n}function Y(){}function Z(n){return function(t,e,u,o){return typeof e!="boolean"&&null!=e&&(o=u,u=o&&o[e]===t?r:e,e=!1),null!=u&&(u=a.createCallback(u,o)),n(t,e,u,o) -}}function nt(n){var t,e;return!n||lr.call(n)!=P||(t=n.constructor,ct(t)&&!(t instanceof t))||!xr.argsClass&&et(n)||!xr.nodeClass&&W(n)?!1:xr.ownLast?(qr(n,function(n,t,r){return e=ur.call(r,t),!1}),!1!==e):(qr(n,function(n,t){e=t}),e===r||ur.call(n,e))}function tt(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=$t(0>r?0:r);++er?0:r);++er?yr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(pt(n)?n.indexOf(t,r):u(n,t,r)):Nr(n,function(n){return++eu&&(u=i)}}else t=!t&&pt(n)?L:a.createCallback(t,r),Nr(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n)});return u}function Ct(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Ar(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Br(n),o=c.length;else xr.unindexedChars&&pt(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),dt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function wt(n,t,r){var e;if(t=a.createCallback(t,r),Ar(n)){r=-1;for(var u=n.length;++rr?yr(0,e+r):r||0}else if(r)return r=St(n,t),n[r]===t?r:-1;return n?T(n,t,r):-1}function Et(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=a.createCallback(t,r);++un?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Fr,a.at=function(n){var t=-1,r=nr.apply(Mt,_r.call(arguments,1)),e=r.length,u=$t(e);for(xr.unindexedChars&&pt(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),c=cr(e,t),a}},a.defaults=$r,a.defer=Nt,a.delay=function(n,t){var e=_r.call(arguments,2);return cr(function(){n.apply(r,e)},t)},a.difference=kt,a.filter=yt,a.flatten=Lr,a.forEach=dt,a.forIn=qr,a.forOwn=Dr,a.functions=at,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),dt(n,function(n,r,u){r=Jt(t(n,r,u)),(ur.call(e,r)?e[r]:e[r]=[]).push(n) +if(true===r)var f=!0,l=!1;else lt(r)&&(f=r.leading,l="trailing"in r?r.trailing:l);return function(){return u=arguments,o=this,Zt(c),f&&2>++i&&(a=n.apply(o,u)),c=cr(e,t),a}},a.defaults=$r,a.defer=Nt,a.delay=function(n,t){var e=_r.call(arguments,2);return cr(function(){n.apply(r,e)},t)},a.difference=kt,a.filter=yt,a.flatten=Lr,a.forEach=dt,a.forIn=qr,a.forOwn=Dr,a.functions=at,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),dt(n,function(n,r,u){r=Jt(t(n,r,u)),(ur.call(e,r)?e[r]:e[r]=[]).push(n) }),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return tt(n,0,mr(yr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=J(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ae(i,r))&&(o[r]=n)}),o},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Br(n),e=r.length,u=$t(e);++tr?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(l===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t +for(t=a.createCallback(t,r);++er?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===false)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; +return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(true===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t }),g+="';\n",l=e=e.variable,l||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Rt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(g,rt)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t },a.all=ht,a.any=wt,a.detect=mt,a.foldl=Ct,a.foldr=jt,a.include=vt,a.inject=Ct,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ar.apply(t,arguments),n.apply(a,t)})}),a.first=xt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return tt(n,yr(0,u-e))}},a.take=xt,a.head=xt,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); return null==t||r&&typeof t!="function"?e:new X(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Ft,a.prototype.valueOf=Ft,Nr(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Nr(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Nr(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments)) -}}),xr.spliceObjects||Nr(["pop","shift","splice"],function(n){var t=Mt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new X(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),O="[object Arguments]",E="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; +}}),xr.spliceObjects||Nr(["pop","shift","splice"],function(n){var t=Mt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new X(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.globatrue===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),O="[object Arguments]",E="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; $[B]=!1,$[O]=$[E]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 23c306b7c7..000d39575d 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,19 +4,19 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(o){function f(n){if(!n||fe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=re(t))&&re(e);return e?n==e||re(n)==e:et(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?xe(n):[],o=u.length;++rt||typeof n=="undefined")return 1;if(n=s&&G.indexOf!=l,y={},h={"false":a,"function":a,"null":a,number:{},object:y,string:{},"true":a,undefined:a};if(g){for(;++ce?0:e);++re?0:e);++re?ye(0,o+e):e)||0,o&&typeof o=="number"?i=-1<(st(n)?n.indexOf(t,e):u(n,t,e)):P(n,function(n){return++ru&&(u=o)}}else t=!t&&st(n)?J:G.createCallback(t,e),dt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function jt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;if(typeof u!="number")var i=xe(n),u=i.length;return t=G.createCallback(t,r,4),dt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function xt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ye(0,r+e):e||0}else if(e)return e=Nt(n,t),n[e]===t?e:-1;return n?H(n,t,e):-1}function It(n,t,e){if(typeof t!="number"&&t!=u){var r=0,a=-1,o=n?n.length:0;for(t=G.createCallback(t,e);++a=s,i=[],f=o?W():e?[]:i;++rn?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=ne.apply(Lt,de.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(f=n.apply(c,i)),p=ie(o,t),f}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=de.call(arguments,2);return ie(function(){n.apply(e,r)},t)},G.difference=Ot,G.filter=bt,G.flatten=Se,G.forEach=dt,G.forIn=K,G.forOwn=P,G.functions=ot,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),dt(n,function(n,e,u){e=Ht(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n) +l=p=0,t&&(f=n.apply(c,i))}var i,f,c,l=0,p=u,s=r;if(e===true)var v=r,s=a;else lt(e)&&(v=e.leading,s="trailing"in e?e.trailing:s);return function(){return i=arguments,c=this,Zt(p),v&&2>++l&&(f=n.apply(c,i)),p=ie(o,t),f}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=de.call(arguments,2);return ie(function(){n.apply(e,r)},t)},G.difference=Ot,G.filter=bt,G.flatten=Se,G.forEach=dt,G.forIn=K,G.forOwn=P,G.functions=ot,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),dt(n,function(n,e,u){e=Ht(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n) }),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return rt(n,0,he(ye(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=W(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ar(o,e))&&(a[e]=n)}),a},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=xe(n),r=e.length,u=Dt(r);++te?ye(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Wt,this},G.parseInt=Ne,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},G.reduce=wt,G.reduceRight=Ct,G.result=function(n,t){var r=n?n[t]:e;return ct(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:xe(n).length },G.some=xt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=xe(i),i=gt(i),f=0,c=u.interpolate||w,l="__p+='",c=Gt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,Y),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index a90a55f181..ea1dd498cc 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -27,7 +27,7 @@ return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=B,t.max return u},t.reject=function(n,t,r){return t=W(t,r),E(n,function(n,r,e){return!t(n,r,e)})},t.rest=C,t.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return N(n,function(n){var r=bt(qt()*(++t+1));e[t]=e[r],e[r]=n}),e},t.sortBy=function(n,t,r){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=W(t,r),N(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(e);o--;)i[o]=i[o].c;return i},t.tap=function(n,t){return t(n),n},t.throttle=function(n,t){function r(){i=new Date,a=null,u=n.apply(o,e) }var e,u,o,i=0,a=null;return function(){var f=new Date,l=t-(f-i);return e=arguments,o=this,0r?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+bt(r*(t-n+1)) },t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null;return b(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){n||(n=""),e=g({},e,t.templateSettings);var u=0,o="__p+='",i=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,i,f){return o+=n.slice(u,f).replace(rt,a),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),e&&(o+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t }),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var f=Function("_","return "+o)(t)}catch(l){throw l.source=o,l}return r?f(r):(f.source=o,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},t.uniqueId=function(n){var t=++Q+"";return n?n+t:t},t.all=O,t.any=D,t.detect=S,t.foldl=q,t.foldr=R,t.include=x,t.inject=q,t.first=$,t.last=function(n,t,r){if(n){var e=0,u=n.length; From be52c181eaff54ba905b89b2c1bed3151942abe6 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 27 May 2013 13:47:01 -0700 Subject: [PATCH 073/117] Ensure converted `!0` and `!1` have leading whitespace if needed. Former-commit-id: 930001f35111d47a51c011c47d6c2608b0bb7e2d --- build/post-compile.js | 12 +++++++----- dist/lodash.compat.min.js | 4 ++-- dist/lodash.underscore.min.js | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/build/post-compile.js b/build/post-compile.js index c7eb6dc0e8..29fa061525 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -38,17 +38,19 @@ ); // replace vars for `false` and `true` with boolean literals - [/(\w+)\s*=\s*!1\b/.exec(source), /(\w+)\s*=\s*!0\b/.exec(source)].forEach(function(varName, index) { + [/(\w+)\s*=\s*!1\b/, /(\w+)\s*=\s*!0\b/].forEach(function(regexp, index) { + var varName = (regexp.exec(source) || 0)[1]; if (varName) { - varName = varName[1]; source = source.replace(RegExp('([!=]==\\s*)' + varName + '|' + varName + '(\\s*[!=]==)', 'g'), '$1' + !!index + '$2'); } }); // replace `!1` and `!0` in expressions with `false` and `true` values - source = source - .replace(/([!=]==\s*)!1|!1(\s*[!=]==)/g, '$1false$2') - .replace(/([!=]==\s*)!0|!0(\s*[!=]==)/g, '$1true$2'); + [/([!=]==)\s*!1|(.)!1\s*([!=]==)/g, /([!=]==)\s*!0|(.)!0\s*([!=]==)/g].forEach(function(regexp, index) { + source = source.replace(regexp, function(match, prelude, chr, postlude) { + return (prelude || chr + (/\w/.test(chr) ? ' ' : '')) + !!index + (postlude || ''); + }); + }); // flip `typeof` expressions to help optimize Safari and // correct the AMD module definition for AMD build optimizers diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index deae2acced..92b8651bf4 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -35,10 +35,10 @@ if(true===r)var f=!0,l=!1;else lt(r)&&(f=r.leading,l="trailing"in r?r.trailing:l return dt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},a.keys=Br,a.map=bt,a.max=_t,a.memoize=function(n,t){function r(){var e=r.cache,u=c+(t?t.apply(this,arguments):arguments[0]);return ur.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},a.merge=st,a.min=function(n,t,r){var e=1/0,u=e;if(!t&&Ar(n)){r=-1;for(var o=n.length;++re(i,r))&&(o[r]=n)}),o},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Br(n),e=r.length,u=$t(e);++tr?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===false)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(true===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index ea1dd498cc..92c606f8cd 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -27,7 +27,7 @@ return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=B,t.max return u},t.reject=function(n,t,r){return t=W(t,r),E(n,function(n,r,e){return!t(n,r,e)})},t.rest=C,t.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return N(n,function(n){var r=bt(qt()*(++t+1));e[t]=e[r],e[r]=n}),e},t.sortBy=function(n,t,r){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=W(t,r),N(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(e);o--;)i[o]=i[o].c;return i},t.tap=function(n,t){return t(n),n},t.throttle=function(n,t){function r(){i=new Date,a=null,u=n.apply(o,e) }var e,u,o,i=0,a=null;return function(){var f=new Date,l=t-(f-i);return e=arguments,o=this,0r?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+bt(r*(t-n+1)) },t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null;return b(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){n||(n=""),e=g({},e,t.templateSettings);var u=0,o="__p+='",i=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,i,f){return o+=n.slice(u,f).replace(rt,a),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),e&&(o+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t }),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var f=Function("_","return "+o)(t)}catch(l){throw l.source=o,l}return r?f(r):(f.source=o,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},t.uniqueId=function(n){var t=++Q+"";return n?n+t:t},t.all=O,t.any=D,t.detect=S,t.foldl=q,t.foldr=R,t.include=x,t.inject=q,t.first=$,t.last=function(n,t,r){if(n){var e=0,u=n.length; From 96e47f3d275526b9ca0a0bc4ea428608934fedf3 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 27 May 2013 15:31:41 -0700 Subject: [PATCH 074/117] Avoid incorrectly converting local variables to boolean values. Former-commit-id: 322f6dec4c669bdc1ef534f7786cf12aee580e53 --- build.js | 4 ++-- build/post-compile.js | 9 +++++++-- dist/lodash.compat.min.js | 4 ++-- dist/lodash.min.js | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/build.js b/build.js index 8c88e6a505..7c0f1c3aae 100755 --- a/build.js +++ b/build.js @@ -2221,7 +2221,7 @@ } return match.replace(/^(( *)if *\(.*?\bisArray\([^\)]+\).*?\) *{\n)(( *)var index[^;]+.+\n+)/m, function(snippet, statement, indent, vars) { vars = vars - .replace(/\b(length *=)[^;]+/, '$1 collection' + (methodName == 'reduce' ? '.length' : ' ? collection.length : 0')) + .replace(/\b(length *=)[^;=]+/, '$1 collection' + (methodName == 'reduce' ? '.length' : ' ? collection.length : 0')) .replace(RegExp('^ ' + indent, 'gm'), indent); return vars + statement.replace(/\bisArray\([^\)]+\)/, "typeof length == 'number'"); @@ -3263,7 +3263,7 @@ modified = modified .replace(/\bctor *=.+\s+/, '') .replace(/^ *ctor\.prototype.+\s+.+\n/m, '') - .replace(/(?:,\n)? *props *=[^;]+/, '') + .replace(/(?:,\n)? *props *=[^;=]+/, '') .replace(/^ *for *\((?=prop)/, '$&var ') } if (!/support\.nonEnumArgs *=(?! *(?:false|true))/.test(match)) { diff --git a/build/post-compile.js b/build/post-compile.js index 29fa061525..e59442391c 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -41,12 +41,17 @@ [/(\w+)\s*=\s*!1\b/, /(\w+)\s*=\s*!0\b/].forEach(function(regexp, index) { var varName = (regexp.exec(source) || 0)[1]; if (varName) { - source = source.replace(RegExp('([!=]==\\s*)' + varName + '|' + varName + '(\\s*[!=]==)', 'g'), '$1' + !!index + '$2'); + source = source.replace(RegExp('([!=]==\\s*)' + varName + '\\b|\\b' + varName + '(\\s*[!=]==)', 'g'), function(match, prelude, postlude, at) { + // avoid replacing local variables with the same name + return RegExp('\\b' + varName + '\\s*(?:,|=[^=])').test(source.slice(at - 10, at)) + ? match + : (prelude || '') + !!index + (postlude || ''); + }); } }); // replace `!1` and `!0` in expressions with `false` and `true` values - [/([!=]==)\s*!1|(.)!1\s*([!=]==)/g, /([!=]==)\s*!0|(.)!0\s*([!=]==)/g].forEach(function(regexp, index) { + [/([!=]==)\s*!1\b|(.)!1\s*([!=]==)/g, /([!=]==)\s*!0\b|(.)!0\s*([!=]==)/g].forEach(function(regexp, index) { source = source.replace(regexp, function(match, prelude, chr, postlude) { return (prelude || chr + (/\w/.test(chr) ? ' ' : '')) + !!index + (postlude || ''); }); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 92b8651bf4..ea31278f30 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -39,11 +39,11 @@ for(t=a.createCallback(t,r),dt(n,function(n,r,u){o[++e]={a:t(n,r,u),b:e,c:n}}),u var e=-1,u=$t(n);for(t=a.createCallback(t,r,1);++er?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===false)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(true===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t }),g+="';\n",l=e=e.variable,l||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Rt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(g,rt)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t },a.all=ht,a.any=wt,a.detect=mt,a.foldl=Ct,a.foldr=jt,a.include=vt,a.inject=Ct,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ar.apply(t,arguments),n.apply(a,t)})}),a.first=xt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return tt(n,yr(0,u-e))}},a.take=xt,a.head=xt,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); return null==t||r&&typeof t!="function"?e:new X(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Ft,a.prototype.valueOf=Ft,Nr(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Nr(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Nr(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments)) -}}),xr.spliceObjects||Nr(["pop","shift","splice"],function(n){var t=Mt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new X(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.globatrue===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),O="[object Arguments]",E="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; +}}),xr.spliceObjects||Nr(["pop","shift","splice"],function(n){var t=Mt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new X(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),O="[object Arguments]",E="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; $[B]=!1,$[O]=$[E]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 000d39575d..4d677a540b 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -9,7 +9,7 @@ if(!u)return a;for(var o=arguments,i=0,f=typeof e=="number"?2:o.length;++it||typeof n=="undefined")return 1;if(n=s&&G.indexOf!=l,y={},h={"false":a,"function":a,"null":a,number:{},object:y,string:{},"true":a,undefined:a};if(g){for(;++ce?0:e);++re?0:e);++r Date: Mon, 27 May 2013 22:30:50 -0700 Subject: [PATCH 075/117] Tweak `_.transform` docs. Former-commit-id: dc7100411a403be4cce6b3784e1dd81cc9423b76 --- dist/lodash.compat.js | 4 ++-- doc/README.md | 2 +- lodash.js | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 9541b516b4..ec49eb8808 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -2392,9 +2392,9 @@ } /** - * Transforms an `object` to an new `accumulator` object which is the result + * Transforms an `object` to a new `accumulator` object which is the result * of running each of its elements through the `callback`, with each `callback` - * execution potentially mutating the `accumulator` object. The `callback`is + * execution potentially mutating the `accumulator` object. The `callback` is * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). * Callbacks may exit iteration early by explicitly returning `false`. * diff --git a/doc/README.md b/doc/README.md index 56e9689716..5723c287e8 100644 --- a/doc/README.md +++ b/doc/README.md @@ -3330,7 +3330,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2443 "View in source") [Ⓣ][1] -Transforms an `object` to an new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback`is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. +Transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. diff --git a/lodash.js b/lodash.js index 7bc10572fd..2360afcb30 100644 --- a/lodash.js +++ b/lodash.js @@ -2411,9 +2411,9 @@ } /** - * Transforms an `object` to an new `accumulator` object which is the result + * Transforms an `object` to a new `accumulator` object which is the result * of running each of its elements through the `callback`, with each `callback` - * execution potentially mutating the `accumulator` object. The `callback`is + * execution potentially mutating the `accumulator` object. The `callback` is * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). * Callbacks may exit iteration early by explicitly returning `false`. * From a8cdbb65feb4e296051a760043d4a79504f6d60d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 27 May 2013 23:21:18 -0700 Subject: [PATCH 076/117] Move code block to a more related part of build.js. Former-commit-id: c138608bdff2937c51127e129955143ad7a3caec --- build.js | 41 +++++++++++++++++++++-------------------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/build.js b/build.js index 7c0f1c3aae..b4ed5969f4 100755 --- a/build.js +++ b/build.js @@ -2909,26 +2909,6 @@ // replace `basicEach` with `_.forEach` in the method assignment snippet source = source.replace(/\bbasicEach(?=\(\[)/g, 'forEach'); } - // modify `_.contains`, `_.every`, `_.find`, `_.some`, and `_.transform` to use the private `indicatorObject` - if (isUnderscore && (/\bbasicEach\(/.test(source) || !useLodashMethod('forOwn'))) { - source = source.replace(matchFunction(source, 'every'), function(match) { - return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); - }); - - source = source.replace(matchFunction(source, 'find'), function(match) { - return match.replace(/return false/, 'return indicatorObject'); - }); - - source = source.replace(matchFunction(source, 'transform'), function(match) { - return match.replace(/return callback[^)]+\)/, '$& && indicatorObject'); - }); - - _.each(['contains', 'some'], function(methodName) { - source = source.replace(matchFunction(source, methodName), function(match) { - return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;'); - }); - }); - } var context = vm.createContext({ 'clearTimeout': clearTimeout, @@ -2988,6 +2968,27 @@ } }); + // modify `_.contains`, `_.every`, `_.find`, `_.some`, and `_.transform` to use the private `indicatorObject` + if (isUnderscore && (/\bbasicEach\(/.test(source) || !useLodashMethod('forOwn'))) { + source = source.replace(matchFunction(source, 'every'), function(match) { + return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); + }); + + source = source.replace(matchFunction(source, 'find'), function(match) { + return match.replace(/return false/, 'return indicatorObject'); + }); + + source = source.replace(matchFunction(source, 'transform'), function(match) { + return match.replace(/return callback[^)]+\)/, '$& && indicatorObject'); + }); + + _.each(['contains', 'some'], function(methodName) { + source = source.replace(matchFunction(source, methodName), function(match) { + return match.replace(/!\(result *= *(.+?)\);/, '(result = $1) && indicatorObject;'); + }); + }); + } + // remove `thisArg` from unexposed `forIn` and `forOwn` _.each(['forIn', 'forOwn'], function(methodName) { if (!useLodashMethod(methodName)) { From e39211347c1322670c4234c0834b712ffc833467 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 27 May 2013 23:54:16 -0700 Subject: [PATCH 077/117] Fix build. Former-commit-id: f8c32906f46a747b1d610c1c9ca8a8ee3b095d90 --- build/post-compile.js | 31 ++++++++++++++++++++----------- dist/lodash.compat.min.js | 10 +++++----- dist/lodash.js | 4 ++-- dist/lodash.min.js | 4 ++-- 4 files changed, 29 insertions(+), 20 deletions(-) diff --git a/build/post-compile.js b/build/post-compile.js index e59442391c..0ff394d244 100644 --- a/build/post-compile.js +++ b/build/post-compile.js @@ -2,8 +2,9 @@ ;(function() { 'use strict'; - /** The Node.js filesystem module */ - var fs = require('fs'); + /** Load Node.js modules */ + var fs = require('fs'), + vm = require('vm'); /** The minimal license/copyright template */ var licenseTemplate = [ @@ -24,9 +25,6 @@ * @returns {String} Returns the processed source. */ function postprocess(source) { - // remove copyright header - source = source.replace(/^\/\**[\s\S]+?\*\/\n/, ''); - // correct overly aggressive Closure Compiler advanced optimization source = source .replace(/(document[^&]+&&)\s*(?:\w+|!\d)/, '$1!({toString:0}+"")') @@ -37,15 +35,23 @@ '\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000"' ); - // replace vars for `false` and `true` with boolean literals - [/(\w+)\s*=\s*!1\b/, /(\w+)\s*=\s*!0\b/].forEach(function(regexp, index) { - var varName = (regexp.exec(source) || 0)[1]; - if (varName) { - source = source.replace(RegExp('([!=]==\\s*)' + varName + '\\b|\\b' + varName + '(\\s*[!=]==)', 'g'), function(match, prelude, postlude, at) { + try { + var context = vm.createContext({}); + vm.runInContext(source, context); + } catch(e) { } + + ['forEach', 'forIn', 'forOwn'].forEach(function(methodName) { + var pairs = /[!=]==\s*([a-zA-Z]+)(?!\()|([a-zA-Z]+)\s*[!=]==/.exec((context._ || {})[methodName]), + varName = pairs && (pairs[1] || pairs[2]), + value = (value = varName && RegExp('\\b' + varName + '\\s*=\\s*!([01])\\b').exec(source)) && !+value[1]; + + if (typeof value == 'boolean') { + // replace vars for `false` and `true` with boolean literals + source = source.replace(RegExp('([!=]==\\s*)' + varName + '\\b(?!\\()|\\b' + varName + '(\\s*[!=]==)', 'g'), function(match, prelude, postlude, at) { // avoid replacing local variables with the same name return RegExp('\\b' + varName + '\\s*(?:,|=[^=])').test(source.slice(at - 10, at)) ? match - : (prelude || '') + !!index + (postlude || ''); + : (prelude || '') + value + (postlude || ''); }); } }); @@ -78,6 +84,9 @@ if (!snippet) { return source; } + // remove copyright header + source = source.replace(/^\/\**[\s\S]+?\*\/\n/, ''); + // add new copyright header var version = snippet[2]; source = licenseTemplate.replace('<%= VERSION %>', version) + '\n;' + source; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index ea31278f30..16ece43dc9 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -9,12 +9,12 @@ if(s){for(;++ik;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; e+="}"}return(t.b||xr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Ut,ur,et,Ar,pt,Br,a,Vt,q,kr,F,Qt,lr)}function M(n){return lt(n)?pr(n):{}}function U(n){return Pr[n]}function V(n){return"\\"+D[n]}function Q(){var n=(n=a.indexOf)==Ot?T:n;return n}function W(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function X(n){this.__wrapped__=n}function Y(){}function Z(n){return function(t,e,u,o){return typeof e!="boolean"&&null!=e&&(o=u,u=o&&o[e]===t?r:e,e=!1),null!=u&&(u=a.createCallback(u,o)),n(t,e,u,o) -}}function nt(n){var t,e;return!n||lr.call(n)!=P||(t=n.constructor,ct(t)&&!(t instanceof t))||!xr.argsClass&&et(n)||!xr.nodeClass&&W(n)?!1:xr.ownLast?(qr(n,function(n,t,r){return e=ur.call(r,t),!1}),!1):(qr(n,function(n,t){e=t}),false===r||ur.call(n,e))}function tt(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=$t(0>r?0:r);++er?0:r);++er?yr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(pt(n)?n.indexOf(t,r):u(n,t,r)):Nr(n,function(n){return++eu&&(u=i)}}else t=!t&&pt(n)?L:a.createCallback(t,r),Nr(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n)});return u}function Ct(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Ar(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++or?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===false)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(true===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t +},a.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; +return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(l===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t }),g+="';\n",l=e=e.variable,l||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Rt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(g,rt)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t },a.all=ht,a.any=wt,a.detect=mt,a.foldl=Ct,a.foldr=jt,a.include=vt,a.inject=Ct,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ar.apply(t,arguments),n.apply(a,t)})}),a.first=xt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return tt(n,yr(0,u-e))}},a.take=xt,a.head=xt,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); return null==t||r&&typeof t!="function"?e:new X(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Ft,a.prototype.valueOf=Ft,Nr(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Nr(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Nr(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments)) diff --git a/dist/lodash.js b/dist/lodash.js index fd4c3b4c36..2cf66ece05 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -2059,9 +2059,9 @@ } /** - * Transforms an `object` to an new `accumulator` object which is the result + * Transforms an `object` to a new `accumulator` object which is the result * of running each of its elements through the `callback`, with each `callback` - * execution potentially mutating the `accumulator` object. The `callback`is + * execution potentially mutating the `accumulator` object. The `callback` is * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). * Callbacks may exit iteration early by explicitly returning `false`. * diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 4d677a540b..f4ff99db43 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -26,7 +26,7 @@ je[S]=Dt,je[I]=zt,je[N]=Pt,je[A]=Kt,je[B]=Vt,je[$]=Ut,je[F]=Gt,je[R]=Ht;var we=G }return a}),Ie=tt(function(n,t,e){for(var r=-1,u=Z(),a=n?n.length:0,o=!t&&a>=s,i=[],f=o?W():e?[]:i;++rn?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=ne.apply(Lt,de.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(f=n.apply(c,i)),p=ie(o,t),f}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=de.call(arguments,2);return ie(function(){n.apply(e,r)},t)},G.difference=Ot,G.filter=bt,G.flatten=Se,G.forEach=dt,G.forIn=K,G.forOwn=P,G.functions=ot,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),dt(n,function(n,e,u){e=Ht(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n) +l=p=0,t&&(f=n.apply(c,i))}var i,f,c,l=0,p=u,s=r;if(e===r)var v=r,s=a;else lt(e)&&(v=e.leading,s="trailing"in e?e.trailing:s);return function(){return i=arguments,c=this,Zt(p),v&&2>++l&&(f=n.apply(c,i)),p=ie(o,t),f}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=de.call(arguments,2);return ie(function(){n.apply(e,r)},t)},G.difference=Ot,G.filter=bt,G.flatten=Se,G.forEach=dt,G.forIn=K,G.forOwn=P,G.functions=ot,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),dt(n,function(n,e,u){e=Ht(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n) }),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return rt(n,0,he(ye(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=W(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ar(o,e))&&(a[e]=n)}),a},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=xe(n),r=e.length,u=Dt(r);++te?ye(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Wt,this},G.parseInt=Ne,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},G.reduce=wt,G.reduceRight=Ct,G.result=function(n,t){var r=n?n[t]:e;return ct(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:xe(n).length },G.some=xt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=xe(i),i=gt(i),f=0,c=u.interpolate||w,l="__p+='",c=Gt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,Y),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; From 4767ed790cbe86a08009c69aa5259dde1e37ddb5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 28 May 2013 15:48:14 -0500 Subject: [PATCH 078/117] Add `_.findWhere` alias. Former-commit-id: 2c70e59b71c22d902e499747444a196a85691554 --- build.js | 88 +++++++++++++++++------------------ dist/lodash.compat.js | 5 +- dist/lodash.compat.min.js | 22 ++++----- dist/lodash.js | 5 +- dist/lodash.min.js | 70 ++++++++++++++-------------- dist/lodash.underscore.js | 9 ++-- dist/lodash.underscore.min.js | 8 ++-- lodash.js | 5 +- test/test-build.js | 36 ++------------ 9 files changed, 111 insertions(+), 137 deletions(-) diff --git a/build.js b/build.js index b4ed5969f4..0c489374fa 100755 --- a/build.js +++ b/build.js @@ -44,6 +44,7 @@ 'drop': 'rest', 'each': 'forEach', 'extend': 'assign', + 'findWhere': 'find', 'foldl': 'reduce', 'foldr': 'reduceRight', 'head': 'first', @@ -63,7 +64,7 @@ 'contains': ['include'], 'every': ['all'], 'filter': ['select'], - 'find': ['detect'], + 'find': ['detect', 'findWhere'], 'first': ['head', 'take'], 'forEach': ['each'], 'functions': ['methods'], @@ -230,7 +231,7 @@ var allMethods = _.keys(dependencyMap); /** List of Lo-Dash methods */ - var lodashMethods = _.without(allMethods, 'findWhere'); + var lodashMethods = allMethods.slice(); /** List of Backbone's Lo-Dash dependencies */ var backboneDependencies = [ @@ -2364,6 +2365,47 @@ '}' ].join('\n')); } + // add Underscore's `_.findWhere` + if (!useLodashMethod('findWhere') && !useLodashMethod('where')) { + source = source.replace(matchFunction(source, 'find'), function(match) { + var indent = getIndent(match); + return match && (match + [ + '', + '/**', + ' * Examines each element in a `collection`, returning the first that', + ' * has the given `properties`. When checking `properties`, this method', + ' * performs a deep comparison between values to determine if they are', + ' * equivalent to each other.', + ' *', + ' * @static', + ' * @memberOf _', + ' * @category Collections', + ' * @param {Array|Object|String} collection The collection to iterate over.', + ' * @param {Object} properties The object of property values to filter by.', + ' * @returns {Mixed} Returns the found element, else `undefined`.', + ' * @example', + ' *', + ' * var food = [', + " * { 'name': 'apple', 'organic': false, 'type': 'fruit' },", + " * { 'name': 'banana', 'organic': true, 'type': 'fruit' },", + " * { 'name': 'beet', 'organic': false, 'type': 'vegetable' }", + ' * ];', + ' *', + " * _.findWhere(food, { 'type': 'vegetable' });", + " * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' }", + ' */', + 'function findWhere(object, properties) {', + ' return where(object, properties, true);', + '}', + '' + ].join('\n' + indent)); + }); + + // replace alias assignment + source = source.replace(getMethodAssignments(source), function(match) { + return match.replace(/^( *lodash.findWhere *= *).+/m, '$1findWhere;'); + }); + } // replace `_.flatten` if (!useLodashMethod('flatten')) { source = replaceFunction(source, 'flatten', [ @@ -2846,48 +2888,6 @@ }); } } - // add Underscore's `_.findWhere` - if (_.contains(buildMethods, 'findWhere')) { - if (isUnderscore) { - source = source.replace(matchFunction(source, 'find'), function(match) { - var indent = getIndent(match); - return match && (match + [ - '', - '/**', - ' * Examines each element in a `collection`, returning the first that', - ' * has the given `properties`. When checking `properties`, this method', - ' * performs a deep comparison between values to determine if they are', - ' * equivalent to each other.', - ' *', - ' * @static', - ' * @memberOf _', - ' * @category Collections', - ' * @param {Array|Object|String} collection The collection to iterate over.', - ' * @param {Object} properties The object of property values to filter by.', - ' * @returns {Mixed} Returns the found element, else `undefined`.', - ' * @example', - ' *', - ' * var food = [', - " * { 'name': 'apple', 'organic': false, 'type': 'fruit' },", - " * { 'name': 'banana', 'organic': true, 'type': 'fruit' },", - " * { 'name': 'beet', 'organic': false, 'type': 'vegetable' }", - ' * ];', - ' *', - " * _.findWhere(food, { 'type': 'vegetable' });", - " * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' }", - ' */', - 'function findWhere(object, properties) {', - ' return where(object, properties, true);', - '}', - '' - ].join('\n' + indent)); - }); - } - source = source.replace(getMethodAssignments(source), function(match) { - var methodName = isUnderscore ? 'findWhere' : 'find'; - return match.replace(/^( *)lodash.find *=.+/m, '$&\n$1lodash.findWhere = ' + methodName + ';'); - }); - } // add Underscore's chaining methods if (isUnderscore ? !_.contains(plusMethods, 'chain') : _.contains(plusMethods, 'chain')) { source = addChainMethods(source); diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index ec49eb8808..81ff0df512 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -2737,7 +2737,7 @@ * * @static * @memberOf _ - * @alias detect + * @alias detect, findWhere * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called per @@ -5533,7 +5533,7 @@ // add functions to `lodash.prototype` mixin(lodash); - // add Underscore `_.chain` compat + // add Underscore compat lodash.chain = lodash; lodash.prototype.chain = function() { return this; }; @@ -5588,6 +5588,7 @@ lodash.all = every; lodash.any = some; lodash.detect = find; + lodash.findWhere = find; lodash.foldl = reduce; lodash.foldr = reduceRight; lodash.include = contains; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 16ece43dc9..2248ebd73e 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -5,34 +5,34 @@ * Underscore.js 1.4.4 underscorejs.org/LICENSE */ ;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Ar(n)&&ur.call(n,"__wrapped__")?n:new X(n)}function T(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(n=l&&a.indexOf!=f,g={},v={"false":!1,"function":!1,"null":!1,number:{},object:g,string:{},"true":!1,undefined:!1}; +}var a=ct(n),o=!r,i=t;if(o){var c=e;r=t}else if(!a){if(!e)throw new Kt;t=n}return u}function J(n){function t(t){return-1=l&&a.indexOf!=f,g={},v={"false":!1,"function":!1,"null":!1,number:{},object:g,string:{},"true":!1,undefined:!1}; if(s){for(;++ik;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; -e+="}"}return(t.b||xr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Ut,ur,et,Ar,pt,Br,a,Vt,q,kr,F,Qt,lr)}function M(n){return lt(n)?pr(n):{}}function U(n){return Pr[n]}function V(n){return"\\"+D[n]}function Q(){var n=(n=a.indexOf)==Ot?T:n;return n}function W(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function X(n){this.__wrapped__=n}function Y(){}function Z(n){return function(t,e,u,o){return typeof e!="boolean"&&null!=e&&(o=u,u=o&&o[e]===t?r:e,e=!1),null!=u&&(u=a.createCallback(u,o)),n(t,e,u,o) -}}function nt(n){var t,e;return!n||lr.call(n)!=P||(t=n.constructor,ct(t)&&!(t instanceof t))||!xr.argsClass&&et(n)||!xr.nodeClass&&W(n)?!1:xr.ownLast?(qr(n,function(n,t,r){return e=ur.call(r,t),!1}),false!==e):(qr(n,function(n,t){e=t}),e===r||ur.call(n,e))}function tt(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=$t(0>r?0:r);++er?0:r);++er?yr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(pt(n)?n.indexOf(t,r):u(n,t,r)):Nr(n,function(n){return++er?yr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(pt(n)?n.indexOf(t,r):u(n,t,r)):Nr(n,function(n){return++eu&&(u=i)}}else t=!t&&pt(n)?L:a.createCallback(t,r),Nr(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n)});return u}function Ct(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Ar(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Br(n),o=c.length;else xr.unindexedChars&&pt(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),dt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function wt(n,t,r){var e;if(t=a.createCallback(t,r),Ar(n)){r=-1;for(var u=n.length;++rr?yr(0,e+r):r||0}else if(r)return r=St(n,t),n[r]===t?r:-1;return n?T(n,t,r):-1}function Et(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=a.createCallback(t,r);++u>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var Or={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},zr=ot(Pr),Fr=K(Or,{h:Or.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),$r=K(Or),qr=K(Er,Sr,{i:!1}),Dr=K(Er,Sr); -ct(/x/)&&(ct=function(n){return typeof n=="function"&&lr.call(n)==B});var Rr=er?function(n){if(!n||lr.call(n)!=P||!xr.argsClass&&et(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=er(t))&&er(r);return r?n==r||er(n)==r:nt(n)}:nt,Tr=bt,Lr=Z(function Jr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e=l,i=[],c=o?J():r?[]:i;++e=l,i=[],c=o?J():r?[]:i;++en?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Fr,a.at=function(n){var t=-1,r=nr.apply(Mt,_r.call(arguments,1)),e=r.length,u=$t(e);for(xr.unindexedChars&&pt(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),c=cr(e,t),a}},a.defaults=$r,a.defer=Nt,a.delay=function(n,t){var e=_r.call(arguments,2);return cr(function(){n.apply(r,e)},t)},a.difference=kt,a.filter=yt,a.flatten=Lr,a.forEach=dt,a.forIn=qr,a.forOwn=Dr,a.functions=at,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),dt(n,function(n,r,u){r=Jt(t(n,r,u)),(ur.call(e,r)?e[r]:e[r]=[]).push(n) }),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return tt(n,0,mr(yr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=J(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ae(i,r))&&(o[r]=n)}),o},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Br(n),e=r.length,u=$t(e);++tr?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Wt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; +},a.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Qt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(l===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t }),g+="';\n",l=e=e.variable,l||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Rt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(g,rt)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t -},a.all=ht,a.any=wt,a.detect=mt,a.foldl=Ct,a.foldr=jt,a.include=vt,a.inject=Ct,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ar.apply(t,arguments),n.apply(a,t)})}),a.first=xt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return tt(n,yr(0,u-e))}},a.take=xt,a.head=xt,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); +},a.all=ht,a.any=wt,a.detect=mt,a.findWhere=mt,a.foldl=Ct,a.foldr=jt,a.include=vt,a.inject=Ct,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ar.apply(t,arguments),n.apply(a,t)})}),a.first=xt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return tt(n,yr(0,u-e))}},a.take=xt,a.head=xt,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); return null==t||r&&typeof t!="function"?e:new X(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Ft,a.prototype.valueOf=Ft,Nr(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Nr(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Nr(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments)) }}),xr.spliceObjects||Nr(["pop","shift","splice"],function(n){var t=Mt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new X(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),O="[object Arguments]",E="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; $[B]=!1,$[O]=$[E]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 2cf66ece05..4f55498e8a 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -2401,7 +2401,7 @@ * * @static * @memberOf _ - * @alias detect + * @alias detect, findWhere * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called per @@ -5207,7 +5207,7 @@ // add functions to `lodash.prototype` mixin(lodash); - // add Underscore `_.chain` compat + // add Underscore compat lodash.chain = lodash; lodash.prototype.chain = function() { return this; }; @@ -5262,6 +5262,7 @@ lodash.all = every; lodash.any = some; lodash.detect = find; + lodash.findWhere = find; lodash.foldl = reduce; lodash.foldr = reduceRight; lodash.include = contains; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index f4ff99db43..234b9a84a6 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,41 +4,41 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(o){function f(n){if(!n||fe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=re(t))&&re(e);return e?n==e||re(n)==e:et(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:G.createCallback(t,e);for(var r=-1,u=q[typeof n]?xe(n):[],a=u.length;++rt||typeof n=="undefined")return 1;if(n=s&&G.indexOf!=l,y={},h={"false":a,"function":a,"null":a,number:{},object:y,string:{},"true":a,undefined:a};if(g){for(;++ce?0:e);++rt||typeof n=="undefined")return 1;if(n=s&&W.indexOf!=l,y={},h={"false":a,"function":a,"null":a,number:{},object:y,string:{},"true":a,undefined:a};if(g){for(;++ce?0:e);++re?ye(0,o+e):e)||0,o&&typeof o=="number"?i=-1<(st(n)?n.indexOf(t,e):u(n,t,e)):P(n,function(n){return++ru&&(u=o)}}else t=!t&&st(n)?J:G.createCallback(t,e),dt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function jt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=G.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;if(typeof u!="number")var i=xe(n),u=i.length;return t=G.createCallback(t,r,4),dt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function xt(n,t,e){var r;t=G.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ye(0,r+e):e||0}else if(e)return e=Nt(n,t),n[e]===t?e:-1;return n?H(n,t,e):-1}function It(n,t,e){if(typeof t!="number"&&t!=u){var r=0,a=-1,o=n?n.length:0;for(t=G.createCallback(t,e);++a>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:G}},nt.prototype=G.prototype;var Ce=pe,xe=ge?function(n){return lt(n)?ge(n):[]}:V,Oe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ee=it(Oe),Se=tt(function Ae(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=s,i=[],f=o?W():e?[]:i;++rn?t():function(){return 1>--n?t.apply(this,arguments):void 0}},G.assign=U,G.at=function(n){for(var t=-1,e=ne.apply(Lt,de.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(f=n.apply(c,i)),p=ie(o,t),f}},G.defaults=M,G.defer=Ft,G.delay=function(n,t){var r=de.call(arguments,2);return ie(function(){n.apply(e,r)},t)},G.difference=Ot,G.filter=bt,G.flatten=Se,G.forEach=dt,G.forIn=K,G.forOwn=P,G.functions=ot,G.groupBy=function(n,t,e){var r={};return t=G.createCallback(t,e),dt(n,function(n,e,u){e=Ht(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n) -}),r},G.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return rt(n,0,he(ye(0,a-r),a))},G.intersection=function(n){var t=arguments,e=t.length,r=W(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ar(o,e))&&(a[e]=n)}),a},G.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},G.pairs=function(n){for(var t=-1,e=xe(n),r=e.length,u=Dt(r);++te?ye(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},G.mixin=Tt,G.noConflict=function(){return o._=Wt,this},G.parseInt=Ne,G.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},G.reduce=wt,G.reduceRight=Ct,G.result=function(n,t){var r=n?n[t]:e;return ct(r)?n[t]():r},G.runInContext=t,G.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:xe(n).length -},G.some=xt,G.sortedIndex=Nt,G.template=function(n,t,u){var a=G.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=xe(i),i=gt(i),f=0,c=u.interpolate||w,l="__p+='",c=Gt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,Y),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; -try{var p=Kt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},G.unescape=function(n){return n==u?"":Ht(n).replace(h,ut)},G.uniqueId=function(n){var t=++c;return Ht(n==u?"":n)+t},G.all=ht,G.any=xt,G.detect=mt,G.foldl=wt,G.foldr=Ct,G.include=yt,G.inject=wt,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(G,t)})}),G.first=Et,G.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; -for(t=G.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return rt(n,ye(0,a-r))}},G.take=Et,G.head=Et,P(G,function(n,t){G.prototype[t]||(G.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new nt(r)})}),G.VERSION="1.2.1",G.prototype.toString=function(){return Ht(this.__wrapped__)},G.prototype.value=qt,G.prototype.valueOf=qt,dt(["join","pop","shift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),dt(["push","reverse","sort","unshift"],function(n){var t=Lt[n];G.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),dt(["concat","slice","splice"],function(n){var t=Lt[n];G.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments))}}),G}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; +return e=(0>e?ye(0,o+e):e)||0,o&&typeof o=="number"?i=-1<(st(n)?n.indexOf(t,e):u(n,t,e)):P(n,function(n){return++ru&&(u=o)}}else t=!t&&st(n)?H:W.createCallback(t,e),dt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function jt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=W.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;if(typeof u!="number")var i=xe(n),u=i.length;return t=W.createCallback(t,r,4),dt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function xt(n,t,e){var r;t=W.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ye(0,r+e):e||0}else if(e)return e=Nt(n,t),n[e]===t?e:-1;return n?G(n,t,e):-1}function It(n,t,e){if(typeof t!="number"&&t!=u){var r=0,a=-1,o=n?n.length:0;for(t=W.createCallback(t,e);++a>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:W}},nt.prototype=W.prototype;var Ce=pe,xe=ge?function(n){return lt(n)?ge(n):[]}:V,Oe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ee=it(Oe),Se=tt(function Ae(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=s,i=[],f=o?Q():e?[]:i;++rn?t():function(){return 1>--n?t.apply(this,arguments):void 0}},W.assign=U,W.at=function(n){for(var t=-1,e=ne.apply(Jt,de.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(f=n.apply(c,i)),p=ie(o,t),f}},W.defaults=M,W.defer=Ft,W.delay=function(n,t){var r=de.call(arguments,2);return ie(function(){n.apply(e,r)},t)},W.difference=Ot,W.filter=bt,W.flatten=Se,W.forEach=dt,W.forIn=K,W.forOwn=P,W.functions=ot,W.groupBy=function(n,t,e){var r={};return t=W.createCallback(t,e),dt(n,function(n,e,u){e=Gt(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n) +}),r},W.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=W.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return rt(n,0,he(ye(0,a-r),a))},W.intersection=function(n){var t=arguments,e=t.length,r=Q(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ar(o,e))&&(a[e]=n)}),a},W.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},W.pairs=function(n){for(var t=-1,e=xe(n),r=e.length,u=Dt(r);++te?ye(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},W.mixin=Tt,W.noConflict=function(){return o._=Qt,this},W.parseInt=Ne,W.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},W.reduce=wt,W.reduceRight=Ct,W.result=function(n,t){var r=n?n[t]:e;return ct(r)?n[t]():r},W.runInContext=t,W.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:xe(n).length +},W.some=xt,W.sortedIndex=Nt,W.template=function(n,t,u){var a=W.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=xe(i),i=gt(i),f=0,c=u.interpolate||w,l="__p+='",c=Wt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,Y),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; +try{var p=Kt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},W.unescape=function(n){return n==u?"":Gt(n).replace(h,ut)},W.uniqueId=function(n){var t=++c;return Gt(n==u?"":n)+t},W.all=ht,W.any=xt,W.detect=mt,W.findWhere=mt,W.foldl=wt,W.foldr=Ct,W.include=yt,W.inject=wt,P(W,function(n,t){W.prototype[t]||(W.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(W,t)})}),W.first=Et,W.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; +for(t=W.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return rt(n,ye(0,a-r))}},W.take=Et,W.head=Et,P(W,function(n,t){W.prototype[t]||(W.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new nt(r)})}),W.VERSION="1.2.1",W.prototype.toString=function(){return Gt(this.__wrapped__)},W.prototype.value=qt,W.prototype.valueOf=qt,dt(["join","pop","shift"],function(n){var t=Jt[n];W.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),dt(["push","reverse","sort","unshift"],function(n){var t=Jt[n];W.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),dt(["concat","slice","splice"],function(n){var t=Jt[n];W.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments))}}),W}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; T[A]=a,T[E]=T[S]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index fb47ab194c..e5eb98b7f9 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -1777,7 +1777,7 @@ * * @static * @memberOf _ - * @alias detect + * @alias detect, findWhere * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called per @@ -4152,8 +4152,9 @@ * '); */ function template(text, data, options) { + var settings = lodash.templateSettings; text || (text = ''); - options = defaults({}, options, lodash.templateSettings); + options = defaults({}, options, settings); var index = 0, source = "__p += '", @@ -4448,7 +4449,7 @@ lodash.tail = rest; lodash.unique = uniq; - // add Underscore `_.chain` compat + // add Underscore compat lodash.chain = chain; /*--------------------------------------------------------------------------*/ @@ -4459,7 +4460,6 @@ lodash.escape = escape; lodash.every = every; lodash.find = find; - lodash.findWhere = findWhere; lodash.has = has; lodash.identity = identity; lodash.indexOf = indexOf; @@ -4497,6 +4497,7 @@ lodash.all = every; lodash.any = some; lodash.detect = find; + lodash.findWhere = findWhere; lodash.foldl = reduce; lodash.foldr = reduceRight; lodash.include = contains; diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 92c606f8cd..45328b0e53 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -27,9 +27,9 @@ return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=B,t.max return u},t.reject=function(n,t,r){return t=W(t,r),E(n,function(n,r,e){return!t(n,r,e)})},t.rest=C,t.shuffle=function(n){var t=-1,r=n?n.length:0,e=Array(typeof r=="number"?r:0);return N(n,function(n){var r=bt(qt()*(++t+1));e[t]=e[r],e[r]=n}),e},t.sortBy=function(n,t,r){var u=-1,o=n?n.length:0,i=Array(typeof o=="number"?o:0);for(t=W(t,r),N(n,function(n,r,e){i[++u]={a:t(n,r,e),b:u,c:n}}),o=i.length,i.sort(e);o--;)i[o]=i[o].c;return i},t.tap=function(n,t){return t(n),n},t.throttle=function(n,t){function r(){i=new Date,a=null,u=n.apply(o,e) }var e,u,o,i=0,a=null;return function(){var f=new Date,l=t-(f-i);return e=arguments,o=this,0r?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+bt(r*(t-n+1)) -},t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null;return b(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){n||(n=""),e=g({},e,t.templateSettings);var u=0,o="__p+='",i=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,i,f){return o+=n.slice(u,f).replace(rt,a),r&&(o+="'+_['escape']("+r+")+'"),i&&(o+="';"+i+";__p+='"),e&&(o+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t -}),o+="';\n",i||(i="obj",o="with("+i+"||{}){"+o+"}"),o="function("+i+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var f=Function("_","return "+o)(t)}catch(l){throw l.source=o,l}return r?f(r):(f.source=o,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},t.uniqueId=function(n){var t=++Q+"";return n?n+t:t},t.all=O,t.any=D,t.detect=S,t.foldl=q,t.foldr=R,t.include=x,t.inject=q,t.first=$,t.last=function(n,t,r){if(n){var e=0,u=n.length; +},t.every=O,t.find=S,t.has=function(n,t){return n?dt.call(n,t):!1},t.identity=G,t.indexOf=z,t.isArguments=s,t.isArray=Tt,t.isBoolean=function(n){return true===n||false===n||At.call(n)==ot},t.isDate=function(n){return n?typeof n=="object"&&At.call(n)==it:!1},t.isElement=function(n){return n?1===n.nodeType:!1},t.isEmpty=m,t.isEqual=_,t.isFinite=function(n){return St(n)&&!Nt(parseFloat(n))},t.isFunction=b,t.isNaN=function(n){return j(n)&&n!=+n},t.isNull=function(n){return null===n},t.isNumber=j,t.isObject=d,t.isRegExp=function(n){return!(!n||!pt[typeof n])&&At.call(n)==lt +},t.isString=w,t.isUndefined=function(n){return typeof n=="undefined"},t.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+bt(r*(t-n+1))},t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null; +return b(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){var u=t.templateSettings;n||(n=""),e=g({},e,u);var o=0,i="__p+='",u=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,u,f){return i+=n.slice(o,f).replace(rt,a),r&&(i+="'+_['escape']("+r+")+'"),u&&(i+="';"+u+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t +}),i+="';\n",u||(u="obj",i="with("+u+"||{}){"+i+"}"),i="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},t.uniqueId=function(n){var t=++Q+"";return n?n+t:t},t.all=O,t.any=D,t.detect=S,t.findWhere=function(n,t){return M(n,t,!0)},t.foldl=q,t.foldr=R,t.include=x,t.inject=q,t.first=$,t.last=function(n,t,r){if(n){var e=0,u=n.length; if(typeof t!="number"&&null!=t){var o=u;for(t=W(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Ft(0,u-e))}},t.take=$,t.head=$,t.VERSION="1.2.1",H(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var r=vt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this }}),N(["concat","join","slice"],function(n){var r=vt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new l(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):J&&!J.nodeType?K?(K.exports=t)._=t:J._=t:n._=t}(this); \ No newline at end of file diff --git a/lodash.js b/lodash.js index 2360afcb30..c95cf4f195 100644 --- a/lodash.js +++ b/lodash.js @@ -2756,7 +2756,7 @@ * * @static * @memberOf _ - * @alias detect + * @alias detect, findWhere * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called per @@ -5552,7 +5552,7 @@ // add functions to `lodash.prototype` mixin(lodash); - // add Underscore `_.chain` compat + // add Underscore compat lodash.chain = lodash; lodash.prototype.chain = function() { return this; }; @@ -5607,6 +5607,7 @@ lodash.all = every; lodash.any = some; lodash.detect = find; + lodash.findWhere = find; lodash.foldl = reduce; lodash.foldr = reduceRight; lodash.include = contains; diff --git a/test/test-build.js b/test/test-build.js index 37cfdbdd08..3fcd3f4520 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -57,6 +57,7 @@ 'drop': 'rest', 'each': 'forEach', 'extend': 'assign', + 'findWhere': 'find', 'foldl': 'reduce', 'foldr': 'reduceRight', 'head': 'first', @@ -76,7 +77,7 @@ 'contains': ['include'], 'every': ['all'], 'filter': ['select'], - 'find': ['detect'], + 'find': ['detect', 'findWhere'], 'first': ['head', 'take'], 'forEach': ['each'], 'functions': ['methods'], @@ -95,7 +96,7 @@ }); /** List of all methods */ - var allMethods = lodashMethods.concat('findWhere'); + var allMethods = lodashMethods.slice(); /** List of "Arrays" category methods */ var arraysMethods = [ @@ -1341,37 +1342,6 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('commands with findWhere'); - - (function() { - var commands = [ - 'underscore include=findWhere', - 'modern include=findWhere', - 'plus=findWhere' - ]; - - commands.forEach(function(command) { - asyncTest('`lodash ' + command + '`', function() { - var start = _.after(2, _.once(QUnit.start)); - - build(['-s'].concat(command.split(' ')), function(data) { - var basename = path.basename(data.outputPath, '.js'), - context = createContext(); - - vm.runInContext(data.source, context); - var lodash = context._; - - var collection = [{ 'a': 1 }, { 'a': 1 }]; - deepEqual(lodash.findWhere(collection, { 'a': 1 }), collection[0], '_.findWhere: ' + basename); - - start(); - }); - }); - }); - }()); - - /*--------------------------------------------------------------------------*/ - QUnit.module('no-dep option'); (function() { From 93a01506e428edcbcd442f3a0ba101ef8cab94aa Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 29 May 2013 08:30:13 -0500 Subject: [PATCH 079/117] Add/fix build tests for mixed method builds. Former-commit-id: 2b97810ca6960670ea646c6eda962bd4585fda04 --- build.js | 69 +++++++++++++++++------------ test/test-build.js | 106 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 146 insertions(+), 29 deletions(-) diff --git a/build.js b/build.js index 0c489374fa..9a48bb1666 100755 --- a/build.js +++ b/build.js @@ -2052,8 +2052,6 @@ source = setUseStrictOption(source, isStrict); if (isLegacy) { - source = removeKeysOptimization(source); - source = removeSetImmediate(source); source = removeSupportProp(source, 'fastBind'); source = replaceSupportProp(source, 'argsClass', 'false'); @@ -2121,21 +2119,18 @@ source = source.replace(matchFunction(source, 'isPlainObject'), function(match) { return match.replace(/!getPrototypeOf[^:]+:\s*/, ''); }); - - // replace `_.isRegExp` - source = replaceFunction(source, 'isRegExp', [ - 'function isRegExp(value) {', - " return value ? (typeof value == 'object' && toString.call(value) == regexpClass) : false;", - '}' - ].join('\n')); } } - if (isLegacy || isMobile || isUnderscore) { + if ((isLegacy || isMobile || isUnderscore) && !useLodashMethod('createCallback')) { source = removeBindingOptimization(source); } - if (isMobile || isUnderscore) { - source = removeKeysOptimization(source); - source = removeSetImmediate(source); + if (isLegacy || isMobile || isUnderscore) { + if (!useLodashMethod('assign') && !useLodashMethod('defaults') && !useLodashMethod('forIn') && !useLodashMethod('forOwn')) { + source = removeKeysOptimization(source); + } + if (!useLodashMethod('defer')) { + source = removeSetImmediate(source); + } } if (isModern || isUnderscore) { source = removeSupportArgsClass(source); @@ -2170,6 +2165,15 @@ '}', ].join('\n')); + // replace `_.isRegExp` + if (!isUnderscore || (isUnderscore && useLodashMethod('isRegExp'))) { + source = replaceFunction(source, 'isRegExp', [ + 'function isRegExp(value) {', + " return value ? (typeof value == 'object' && toString.call(value) == regexpClass) : false;", + '}' + ].join('\n')); + } + // replace `_.map` source = replaceFunction(source, 'map', [ 'function map(collection, callback, thisArg) {', @@ -2216,7 +2220,7 @@ } else if (/^(?:max|min)$/.test(methodName)) { match = match.replace(/\bbasicEach\(/, 'forEach('); - if (!isUnderscore) { + if (!isUnderscore || useLodashMethod(methodName)) { return match; } } @@ -2641,8 +2645,9 @@ source = replaceFunction(source, 'template', [ 'function template(text, data, options) {', + ' var settings = lodash.templateSettings;', " text || (text = '');", - ' options = defaults({}, options, lodash.templateSettings);', + ' options = iteratorTemplate ? defaults({}, options, settings) : settings;', '', ' var index = 0,', ' source = "__p += \'",', @@ -2834,8 +2839,13 @@ source = source.replace(/lodash\.support *= */, ''); // replace `slice` with `nativeSlice.call` - source = removeFunction(source, 'slice'); - source = source.replace(/([^.])\bslice\(/g, '$1nativeSlice.call('); + _.each(['clone', 'first', 'initial', 'last', 'rest', 'toArray'], function(methodName) { + if (!useLodashMethod(methodName)) { + source = source.replace(matchFunction(source, methodName), function(match) { + return match.replace(/([^.])\bslice\(/g, '$1nativeSlice.call('); + }); + } + }); // remove conditional `charCodeCallback` use from `_.max` and `_.min` _.each(['max', 'min'], function(methodName) { @@ -2846,16 +2856,6 @@ } }); - // modify `_.isEqual` and `shimIsPlainObject` to use the private `indicatorObject` - if (!useLodashMethod('forIn')) { - source = source.replace(matchFunction(source, 'isEqual'), function(match) { - return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); - }); - - source = source.replace(matchFunction(source, 'shimIsPlainObject'), function(match) { - return match.replace(/return false/, 'return indicatorObject'); - }); - } // remove unneeded variables if (!useLodashMethod('clone') && !useLodashMethod('cloneDeep')) { source = removeVar(source, 'cloneableClasses'); @@ -2884,7 +2884,7 @@ ].join(indent); }) .replace(/thisBinding *=[^}]+}/, 'thisBinding = thisArg;\n') - .replace(/\(args *=.+/, 'partialArgs.concat(slice(args))'); + .replace(/\(args *=.+/, 'partialArgs.concat(nativeSlice.call(args))'); }); } } @@ -2988,6 +2988,16 @@ }); }); } + // modify `_.isEqual` and `shimIsPlainObject` to use the private `indicatorObject` + if (!useLodashMethod('forIn')) { + source = source.replace(matchFunction(source, 'isEqual'), function(match) { + return match.replace(/\(result *= *(.+?)\);/g, '!(result = $1) && indicatorObject;'); + }); + + source = source.replace(matchFunction(source, 'shimIsPlainObject'), function(match) { + return match.replace(/return false/, 'return indicatorObject'); + }); + } // remove `thisArg` from unexposed `forIn` and `forOwn` _.each(['forIn', 'forOwn'], function(methodName) { @@ -3240,6 +3250,9 @@ if (!/\bbasicEach\(/.test(source)) { source = removeFunction(source, 'basicEach'); } + if (_.size(source.match(/[^.]slice\(/g)) < 2) { + source = removeFunction(source, 'slice'); + } if (!/^ *support\.(?:enumErrorProps|nonEnumShadows) *=/m.test(source)) { source = removeVar(source, 'Error'); source = removeVar(source, 'errorProto'); diff --git a/test/test-build.js b/test/test-build.js index 3fcd3f4520..aa296ad841 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -6,7 +6,7 @@ var vm = require('vm'); /** Load other modules */ - var _ = require('../lodash.js'), + var _ = require('../dist/lodash.js'), build = require('../build.js'), minify = require('../build/minify.js'), util = require('../build/util.js'); @@ -1445,6 +1445,110 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('mixed underscore and lodash methods'); + + (function() { + var methodNames = [ + 'assign', + 'bindKey', + 'clone', + 'contains', + 'debouce', + 'defaults', + 'defer', + 'difference', + 'every', + 'filter', + 'find', + 'findWhere', + 'first', + 'flatten', + 'forEach', + 'forOwn', + 'intersection', + 'initial', + 'isEmpty', + 'isEqual', + 'isPlainObject', + 'isRegExp', + 'last', + 'map', + 'max', + 'memoize', + 'min', + 'omit', + 'partial', + 'partialRight', + 'pick', + 'pluck', + 'reduce', + 'result', + 'rest', + 'some', + 'tap', + 'template', + 'throttle', + 'times', + 'toArray', + 'transform', + 'uniq', + 'uniqueId', + 'value', + 'where', + 'zip' + ]; + + function strip(value) { + return String(value) + .replace(/^ *\/\/.*/gm, '') + .replace(/\b(?:basicEach|context|forEach|forOwn|window)\b/g, '') + .replace(/\blodash\.(createCallback\()\b/g, '$1') + .replace(/[\s;]/g, ''); + } + + methodNames.forEach(function(methodName) { + var command = 'underscore plus=' + methodName; + + if (methodName == 'createCallback') { + command += ',where'; + } + if (methodName == 'zip') { + command += ',unzip'; + } + if (methodName != 'chain' && _.contains(chainingMethods.concat('mixin'), methodName)) { + command += ',chain'; + } + if (_.contains(['isEqual', 'isPlainObject'], methodName)) { + command += ',forIn'; + } + if (_.contains(['contains', 'every', 'find', 'some', 'transform'], methodName)) { + command += ',forOwn'; + } + asyncTest('`lodash ' + command +'`', function() { + var start = _.after(2, _.once(QUnit.start)); + + build(['-s'].concat(command.split(' ')), function(data) { + var array = [{ 'value': 1 }], + basename = path.basename(data.outputPath, '.js'), + context = createContext(); + + vm.runInContext(data.source, context, true); + var lodash = context._; + + if (methodName == 'chain' || methodName == 'defer') { + notEqual(strip(lodash[methodName]), strip(_[methodName]), basename); + } else if (!/\.min$/.test(basename)) { + equal(strip(lodash[methodName]), strip(_[methodName]), basename); + } + testMethod(lodash, methodName, basename); + start(); + }); + }); + }); + }()); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash build'); (function() { From 1db19148e76e7250ab4e9b6bc32b9c9b39356f43 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 29 May 2013 08:56:53 -0500 Subject: [PATCH 080/117] Update vendors. Former-commit-id: 6be90c53f9b69d500485492ea2a0ebd288b92abe --- build/minify.js | 2 +- vendor/benchmark.js/README.md | 2 +- vendor/platform.js/README.md | 2 +- vendor/qunit-clib/README.md | 2 +- vendor/underscore/underscore-min.js | 2 +- vendor/underscore/underscore.js | 10 ++++++---- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build/minify.js b/build/minify.js index 1061b09f6e..64cf27e60b 100755 --- a/build/minify.js +++ b/build/minify.js @@ -22,7 +22,7 @@ var closureId = '9fd5d61c1b706e7505aeb5187941c2c5497e5fd8'; /** The Git object ID of `uglifyjs.tar.gz` */ - var uglifyId = '48cae9c0cd76acf812f90d4f98de499ac61ec105'; + var uglifyId = '7de2795a3af58d1b293e3b0e83cdbc994f4941dc'; /** The path of the directory that is the base of the repository */ var basePath = fs.realpathSync(path.join(__dirname, '..')); diff --git a/vendor/benchmark.js/README.md b/vendor/benchmark.js/README.md index cb10e88eae..488cbc1a08 100644 --- a/vendor/benchmark.js/README.md +++ b/vendor/benchmark.js/README.md @@ -15,7 +15,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best ## Support -Benchmark.js has been tested in at least Chrome 5~26, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. +Benchmark.js has been tested in at least Chrome 5~27, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. ## Installation and usage diff --git a/vendor/platform.js/README.md b/vendor/platform.js/README.md index 53ef14fc3f..8c773f1221 100644 --- a/vendor/platform.js/README.md +++ b/vendor/platform.js/README.md @@ -18,7 +18,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best ## Support -Platform.js has been tested in at least Chrome 5~26, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. +Platform.js has been tested in at least Chrome 5~27, Firefox 2~21, IE 6-10, Opera 9.25-12, Safari 3-6, Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. ## Installation and usage diff --git a/vendor/qunit-clib/README.md b/vendor/qunit-clib/README.md index 1f4f8818ed..a8d2328e0a 100644 --- a/vendor/qunit-clib/README.md +++ b/vendor/qunit-clib/README.md @@ -9,7 +9,7 @@ QUnit CLIB helps extend QUnit’s CLI support to many common CLI environments. ## Support -QUnit CLIB has been tested in at least Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. +QUnit CLIB has been tested in at least Node.js 0.4.8-0.10.7, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. ## Usage diff --git a/vendor/underscore/underscore-min.js b/vendor/underscore/underscore-min.js index 9e669d307c..9a1c57a76f 100644 --- a/vendor/underscore/underscore-min.js +++ b/vendor/underscore/underscore-min.js @@ -3,4 +3,4 @@ // (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc. // (c) 2011-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Underscore may be freely distributed under the MIT license. -(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,d=e.filter,m=e.every,g=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.4";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},w.find=w.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:m&&n.every===m?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:g&&n.some===g?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2),e=w.isFunction(t);return w.map(n,function(n){return(e?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t,r){return w.isEmpty(t)?r?void 0:[]:w[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.findWhere=function(n,t){return w.where(n,t,!0)},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>=e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var F=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=F(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.indexi;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)||w.isArguments(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(w.flatten(arguments,!0))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){return w.unzip(o.call(arguments))},w.unzip=function(n){for(var t=w.max(w.pluck(n,"length").concat(0)),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i};var M=function(){};w.bind=function(n,t){var r,e;if(n.bind===j&&j)return j.apply(n,o.call(arguments,1));if(!w.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));M.prototype=n.prototype;var u=new M;M.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},w.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},w.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw Error("bindAll must be passed function names");return A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t,r){var e,u,i,a,o=0,c=function(){o=new Date,i=null,a=n.apply(e,u)};return function(){var l=new Date;o||r!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(i),i=null,o=l,a=n.apply(e,u)):i||(i=setTimeout(c,f)),a}},w.debounce=function(n,t,r){var e,u;return function(){var i=this,a=arguments,o=function(){e=null,r||(u=n.apply(i,a))},c=r&&!e;return clearTimeout(e),e=setTimeout(o,t),c&&(u=n.apply(i,a)),u}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&t.push(r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var I=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=I(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&I(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return I(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),"function"!=typeof/./&&(w.isFunction=function(n){return"function"==typeof n}),w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return n===void 0},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var S={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};S.unescape=w.invert(S.escape);var T={escape:RegExp("["+w.keys(S.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(S.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return S[n][t]})}}),w.result=function(n,t){if(null==n)return void 0;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=++N+"";return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){var e;r=w.defaults({},r,w.templateSettings);var u=RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(z,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,w);var c=function(n){return e.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},w.chain=function(n){return w(n).chain()};var D=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this); \ No newline at end of file +(function(){var n=this,t=n._,r={},e=Array.prototype,u=Object.prototype,i=Function.prototype,a=e.push,o=e.slice,c=e.concat,l=u.toString,f=u.hasOwnProperty,s=e.forEach,p=e.map,h=e.reduce,v=e.reduceRight,d=e.filter,m=e.every,g=e.some,y=e.indexOf,b=e.lastIndexOf,x=Array.isArray,_=Object.keys,j=i.bind,w=function(n){return n instanceof w?n:this instanceof w?(this._wrapped=n,void 0):new w(n)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=w),exports._=w):n._=w,w.VERSION="1.4.4";var A=w.each=w.forEach=function(n,t,e){if(null!=n)if(s&&n.forEach===s)n.forEach(t,e);else if(n.length===+n.length){for(var u=0,i=n.length;i>u;u++)if(t.call(e,n[u],u,n)===r)return}else for(var a in n)if(w.has(n,a)&&t.call(e,n[a],a,n)===r)return};w.map=w.collect=function(n,t,r){var e=[];return null==n?e:p&&n.map===p?n.map(t,r):(A(n,function(n,u,i){e.push(t.call(r,n,u,i))}),e)};var E="Reduce of empty array with no initial value";w.reduce=w.foldl=w.inject=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),h&&n.reduce===h)return e&&(t=w.bind(t,e)),u?n.reduce(t,r):n.reduce(t);if(A(n,function(n,i,a){u?r=t.call(e,r,n,i,a):(r=n,u=!0)}),!u)throw new TypeError(E);return r},w.reduceRight=w.foldr=function(n,t,r,e){var u=arguments.length>2;if(null==n&&(n=[]),v&&n.reduceRight===v)return e&&(t=w.bind(t,e)),u?n.reduceRight(t,r):n.reduceRight(t);var i=n.length;if(i!==+i){var a=w.keys(n);i=a.length}if(A(n,function(o,c,l){c=a?a[--i]:--i,u?r=t.call(e,r,n[c],c,l):(r=n[c],u=!0)}),!u)throw new TypeError(E);return r},w.find=w.detect=function(n,t,r){var e;return O(n,function(n,u,i){return t.call(r,n,u,i)?(e=n,!0):void 0}),e},w.filter=w.select=function(n,t,r){var e=[];return null==n?e:d&&n.filter===d?n.filter(t,r):(A(n,function(n,u,i){t.call(r,n,u,i)&&e.push(n)}),e)},w.reject=function(n,t,r){return w.filter(n,function(n,e,u){return!t.call(r,n,e,u)},r)},w.every=w.all=function(n,t,e){t||(t=w.identity);var u=!0;return null==n?u:m&&n.every===m?n.every(t,e):(A(n,function(n,i,a){return(u=u&&t.call(e,n,i,a))?void 0:r}),!!u)};var O=w.some=w.any=function(n,t,e){t||(t=w.identity);var u=!1;return null==n?u:g&&n.some===g?n.some(t,e):(A(n,function(n,i,a){return u||(u=t.call(e,n,i,a))?r:void 0}),!!u)};w.contains=w.include=function(n,t){return null==n?!1:y&&n.indexOf===y?n.indexOf(t)!=-1:O(n,function(n){return n===t})},w.invoke=function(n,t){var r=o.call(arguments,2),e=w.isFunction(t);return w.map(n,function(n){return(e?t:n[t]).apply(n,r)})},w.pluck=function(n,t){return w.map(n,function(n){return n[t]})},w.where=function(n,t,r){return w.isEmpty(t)?r?void 0:[]:w[r?"find":"filter"](n,function(n){for(var r in t)if(t[r]!==n[r])return!1;return!0})},w.findWhere=function(n,t){return w.where(n,t,!0)},w.max=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.max.apply(Math,n);if(!t&&w.isEmpty(n))return-1/0;var e={computed:-1/0,value:-1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;a>e.computed&&(e={value:n,computed:a})}),e.value},w.min=function(n,t,r){if(!t&&w.isArray(n)&&n[0]===+n[0]&&65535>n.length)return Math.min.apply(Math,n);if(!t&&w.isEmpty(n))return 1/0;var e={computed:1/0,value:1/0};return A(n,function(n,u,i){var a=t?t.call(r,n,u,i):n;e.computed>a&&(e={value:n,computed:a})}),e.value},w.shuffle=function(n){var t,r=0,e=[];return A(n,function(n){t=w.random(r++),e[r-1]=e[t],e[t]=n}),e};var F=function(n){return w.isFunction(n)?n:function(t){return t[n]}};w.sortBy=function(n,t,r){var e=F(t);return w.pluck(w.map(n,function(n,t,u){return{value:n,index:t,criteria:e.call(r,n,t,u)}}).sort(function(n,t){var r=n.criteria,e=t.criteria;if(r!==e){if(r>e||r===void 0)return 1;if(e>r||e===void 0)return-1}return n.indexi;){var o=i+a>>>1;u>r.call(e,n[o])?i=o+1:a=o}return i},w.toArray=function(n){return n?w.isArray(n)?o.call(n):n.length===+n.length?w.map(n,w.identity):w.values(n):[]},w.size=function(n){return null==n?0:n.length===+n.length?n.length:w.keys(n).length},w.first=w.head=w.take=function(n,t,r){return null==n?void 0:null==t||r?n[0]:o.call(n,0,t)},w.initial=function(n,t,r){return o.call(n,0,n.length-(null==t||r?1:t))},w.last=function(n,t,r){return null==n?void 0:null==t||r?n[n.length-1]:o.call(n,Math.max(n.length-t,0))},w.rest=w.tail=w.drop=function(n,t,r){return o.call(n,null==t||r?1:t)},w.compact=function(n){return w.filter(n,w.identity)};var R=function(n,t,r){return A(n,function(n){w.isArray(n)||w.isArguments(n)?t?a.apply(r,n):R(n,t,r):r.push(n)}),r};w.flatten=function(n,t){return R(n,t,[])},w.without=function(n){return w.difference(n,o.call(arguments,1))},w.uniq=w.unique=function(n,t,r,e){w.isFunction(t)&&(e=r,r=t,t=!1);var u=r?w.map(n,r,e):n,i=[],a=[];return A(u,function(r,e){(t?e&&a[a.length-1]===r:w.contains(a,r))||(a.push(r),i.push(n[e]))}),i},w.union=function(){return w.uniq(w.flatten(arguments,!0))},w.intersection=function(n){var t=o.call(arguments,1);return w.filter(w.uniq(n),function(n){return w.every(t,function(t){return w.indexOf(t,n)>=0})})},w.difference=function(n){var t=c.apply(e,o.call(arguments,1));return w.filter(n,function(n){return!w.contains(t,n)})},w.zip=function(){return w.unzip(o.call(arguments))},w.unzip=function(n){for(var t=w.max(w.pluck(n,"length").concat(0)),r=Array(t),e=0;t>e;e++)r[e]=w.pluck(n,""+e);return r},w.object=function(n,t){if(null==n)return{};for(var r={},e=0,u=n.length;u>e;e++)t?r[n[e]]=t[e]:r[n[e][0]]=n[e][1];return r},w.indexOf=function(n,t,r){if(null==n)return-1;var e=0,u=n.length;if(r){if("number"!=typeof r)return e=w.sortedIndex(n,t),n[e]===t?e:-1;e=0>r?Math.max(0,u+r):r}if(y&&n.indexOf===y)return n.indexOf(t,r);for(;u>e;e++)if(n[e]===t)return e;return-1},w.lastIndexOf=function(n,t,r){if(null==n)return-1;var e=null!=r;if(b&&n.lastIndexOf===b)return e?n.lastIndexOf(t,r):n.lastIndexOf(t);for(var u=e?r:n.length;u--;)if(n[u]===t)return u;return-1},w.range=function(n,t,r){1>=arguments.length&&(t=n||0,n=0),r=arguments[2]||1;for(var e=Math.max(Math.ceil((t-n)/r),0),u=0,i=Array(e);e>u;)i[u++]=n,n+=r;return i};var M=function(){};w.bind=function(n,t){var r,e;if(j&&n.bind===j)return j.apply(n,o.call(arguments,1));if(!w.isFunction(n))throw new TypeError;return r=o.call(arguments,2),e=function(){if(!(this instanceof e))return n.apply(t,r.concat(o.call(arguments)));M.prototype=n.prototype;var u=new M;M.prototype=null;var i=n.apply(u,r.concat(o.call(arguments)));return Object(i)===i?i:u}},w.partial=function(n){var t=o.call(arguments,1);return function(){return n.apply(this,t.concat(o.call(arguments)))}},w.bindAll=function(n){var t=o.call(arguments,1);if(0===t.length)throw Error("bindAll must be passed function names");return A(t,function(t){n[t]=w.bind(n[t],n)}),n},w.memoize=function(n,t){var r={};return t||(t=w.identity),function(){var e=t.apply(this,arguments);return w.has(r,e)?r[e]:r[e]=n.apply(this,arguments)}},w.delay=function(n,t){var r=o.call(arguments,2);return setTimeout(function(){return n.apply(null,r)},t)},w.defer=function(n){return w.delay.apply(w,[n,1].concat(o.call(arguments,1)))},w.throttle=function(n,t,r){var e,u,i,a=null,o=0,c=function(){o=new Date,a=null,i=n.apply(e,u)};return function(){var l=new Date;o||r!==!1||(o=l);var f=t-(l-o);return e=this,u=arguments,0>=f?(clearTimeout(a),a=null,o=l,i=n.apply(e,u)):a||(a=setTimeout(c,f)),i}},w.debounce=function(n,t,r){var e,u=null;return function(){var i=this,a=arguments,o=function(){u=null,r||(e=n.apply(i,a))},c=r&&!u;return clearTimeout(u),u=setTimeout(o,t),c&&(e=n.apply(i,a)),e}},w.once=function(n){var t,r=!1;return function(){return r?t:(r=!0,t=n.apply(this,arguments),n=null,t)}},w.wrap=function(n,t){return function(){var r=[n];return a.apply(r,arguments),t.apply(this,r)}},w.compose=function(){var n=arguments;return function(){for(var t=arguments,r=n.length-1;r>=0;r--)t=[n[r].apply(this,t)];return t[0]}},w.after=function(n,t){return 0>=n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},w.keys=_||function(n){if(n!==Object(n))throw new TypeError("Invalid object");var t=[];for(var r in n)w.has(n,r)&&t.push(r);return t},w.values=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push(n[r]);return t},w.pairs=function(n){var t=[];for(var r in n)w.has(n,r)&&t.push([r,n[r]]);return t},w.invert=function(n){var t={};for(var r in n)w.has(n,r)&&(t[n[r]]=r);return t},w.functions=w.methods=function(n){var t=[];for(var r in n)w.isFunction(n[r])&&t.push(r);return t.sort()},w.extend=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]=t[r]}),n},w.pick=function(n){var t={},r=c.apply(e,o.call(arguments,1));return A(r,function(r){r in n&&(t[r]=n[r])}),t},w.omit=function(n){var t={},r=c.apply(e,o.call(arguments,1));for(var u in n)w.contains(r,u)||(t[u]=n[u]);return t},w.defaults=function(n){return A(o.call(arguments,1),function(t){if(t)for(var r in t)n[r]===void 0&&(n[r]=t[r])}),n},w.clone=function(n){return w.isObject(n)?w.isArray(n)?n.slice():w.extend({},n):n},w.tap=function(n,t){return t(n),n};var I=function(n,t,r,e){if(n===t)return 0!==n||1/n==1/t;if(null==n||null==t)return n===t;n instanceof w&&(n=n._wrapped),t instanceof w&&(t=t._wrapped);var u=l.call(n);if(u!=l.call(t))return!1;switch(u){case"[object String]":return n==t+"";case"[object Number]":return n!=+n?t!=+t:0==n?1/n==1/t:n==+t;case"[object Date]":case"[object Boolean]":return+n==+t;case"[object RegExp]":return n.source==t.source&&n.global==t.global&&n.multiline==t.multiline&&n.ignoreCase==t.ignoreCase}if("object"!=typeof n||"object"!=typeof t)return!1;for(var i=r.length;i--;)if(r[i]==n)return e[i]==t;r.push(n),e.push(t);var a=0,o=!0;if("[object Array]"==u){if(a=n.length,o=a==t.length)for(;a--&&(o=I(n[a],t[a],r,e)););}else{var c=n.constructor,f=t.constructor;if(c!==f&&!(w.isFunction(c)&&c instanceof c&&w.isFunction(f)&&f instanceof f))return!1;for(var s in n)if(w.has(n,s)&&(a++,!(o=w.has(t,s)&&I(n[s],t[s],r,e))))break;if(o){for(s in t)if(w.has(t,s)&&!a--)break;o=!a}}return r.pop(),e.pop(),o};w.isEqual=function(n,t){return I(n,t,[],[])},w.isEmpty=function(n){if(null==n)return!0;if(w.isArray(n)||w.isString(n))return 0===n.length;for(var t in n)if(w.has(n,t))return!1;return!0},w.isElement=function(n){return!(!n||1!==n.nodeType)},w.isArray=x||function(n){return"[object Array]"==l.call(n)},w.isObject=function(n){return n===Object(n)},A(["Arguments","Function","String","Number","Date","RegExp"],function(n){w["is"+n]=function(t){return l.call(t)=="[object "+n+"]"}}),w.isArguments(arguments)||(w.isArguments=function(n){return!(!n||!w.has(n,"callee"))}),"function"!=typeof/./&&(w.isFunction=function(n){return"function"==typeof n}),w.isFinite=function(n){return isFinite(n)&&!isNaN(parseFloat(n))},w.isNaN=function(n){return w.isNumber(n)&&n!=+n},w.isBoolean=function(n){return n===!0||n===!1||"[object Boolean]"==l.call(n)},w.isNull=function(n){return null===n},w.isUndefined=function(n){return n===void 0},w.has=function(n,t){return f.call(n,t)},w.noConflict=function(){return n._=t,this},w.identity=function(n){return n},w.times=function(n,t,r){for(var e=Array(Math.max(0,n)),u=0;n>u;u++)e[u]=t.call(r,u);return e},w.random=function(n,t){return null==t&&(t=n,n=0),n+Math.floor(Math.random()*(t-n+1))};var S={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};S.unescape=w.invert(S.escape);var T={escape:RegExp("["+w.keys(S.escape).join("")+"]","g"),unescape:RegExp("("+w.keys(S.unescape).join("|")+")","g")};w.each(["escape","unescape"],function(n){w[n]=function(t){return null==t?"":(""+t).replace(T[n],function(t){return S[n][t]})}}),w.result=function(n,t){if(null==n)return void 0;var r=n[t];return w.isFunction(r)?r.call(n):r},w.mixin=function(n){A(w.functions(n),function(t){var r=w[t]=n[t];w.prototype[t]=function(){var n=[this._wrapped];return a.apply(n,arguments),D.call(this,r.apply(w,n))}})};var N=0;w.uniqueId=function(n){var t=++N+"";return n?n+t:t},w.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var q=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},z=/\\|'|\r|\n|\t|\u2028|\u2029/g;w.template=function(n,t,r){var e;r=w.defaults({},r,w.templateSettings);var u=RegExp([(r.escape||q).source,(r.interpolate||q).source,(r.evaluate||q).source].join("|")+"|$","g"),i=0,a="__p+='";n.replace(u,function(t,r,e,u,o){return a+=n.slice(i,o).replace(z,function(n){return"\\"+B[n]}),r&&(a+="'+\n((__t=("+r+"))==null?'':_.escape(__t))+\n'"),e&&(a+="'+\n((__t=("+e+"))==null?'':__t)+\n'"),u&&(a+="';\n"+u+"\n__p+='"),i=o+t.length,t}),a+="';\n",r.variable||(a="with(obj||{}){\n"+a+"}\n"),a="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+a+"return __p;\n";try{e=Function(r.variable||"obj","_",a)}catch(o){throw o.source=a,o}if(t)return e(t,w);var c=function(n){return e.call(this,n,w)};return c.source="function("+(r.variable||"obj")+"){\n"+a+"}",c},w.chain=function(n){return w(n).chain()};var D=function(n){return this._chain?w(n).chain():n};w.mixin(w),A(["pop","push","reverse","shift","sort","splice","unshift"],function(n){var t=e[n];w.prototype[n]=function(){var r=this._wrapped;return t.apply(r,arguments),"shift"!=n&&"splice"!=n||0!==r.length||delete r[0],D.call(this,r)}}),A(["concat","join","slice"],function(n){var t=e[n];w.prototype[n]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),w.extend(w.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this); \ No newline at end of file diff --git a/vendor/underscore/underscore.js b/vendor/underscore/underscore.js index b01e3c91aa..cd384fcb7c 100644 --- a/vendor/underscore/underscore.js +++ b/vendor/underscore/underscore.js @@ -266,7 +266,7 @@ var result = {computed : -Infinity, value: -Infinity}; each(obj, function(value, index, list) { var computed = iterator ? iterator.call(context, value, index, list) : value; - computed >= result.computed && (result = {value : value, computed : computed}); + computed > result.computed && (result = {value : value, computed : computed}); }); return result.value; }; @@ -593,7 +593,7 @@ // available. _.bind = function(func, context) { var args, bound; - if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); + if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); if (!_.isFunction(func)) throw new TypeError; args = slice.call(arguments, 2); return bound = function() { @@ -651,7 +651,8 @@ // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. _.throttle = function(func, wait, immediate) { - var context, args, timeout, result; + var context, args, result; + var timeout = null; var previous = 0; var later = function() { previous = new Date; @@ -681,7 +682,8 @@ // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. _.debounce = function(func, wait, immediate) { - var timeout, result; + var result; + var timeout = null; return function() { var context = this, args = arguments; var later = function() { From 9dd8f62c8a3c84b9b6468be919171a947a370157 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 29 May 2013 09:05:21 -0500 Subject: [PATCH 081/117] Make `Error.prototype` unit tests pass in Firefox. Former-commit-id: 1ff097e7947ba206bc58fe0c319bf36bb64b5387 --- test/test.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/test/test.js b/test/test.js index 7403ed75e1..f61a5fea04 100644 --- a/test/test.js +++ b/test/test.js @@ -1089,9 +1089,20 @@ 'String': String.prototype }, function(object, builtin) { - var keys = []; - func(object, function(value, key) { keys.push(key); }); - deepEqual(keys, [], 'non-enumerable properties on ' + builtin + '.prototype'); + var message = 'non-enumerable properties on ' + builtin + '.prototype', + props = []; + + func(object, function(value, prop) { + props.push(prop); + }); + + if (/Error/.test(builtin)) { + ok(_.every(['constructor', 'toString'], function(prop) { + return !_.contains(props, prop); + }), message); + } else { + deepEqual(props, [], message); + } }); }); From 54fc6df3dacb893b40b7808dc385ccfa85c485d1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 29 May 2013 09:21:45 -0500 Subject: [PATCH 082/117] Update `_.transform` docs. Former-commit-id: ff26ef26e906410787a8819b9c653f20bbdeff38 --- dist/lodash.compat.js | 11 +-- dist/lodash.js | 11 +-- doc/README.md | 151 +++++++++++++++++++++--------------------- lodash.js | 11 +-- 4 files changed, 94 insertions(+), 90 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 81ff0df512..cd39781bbf 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -2392,11 +2392,12 @@ } /** - * Transforms an `object` to a new `accumulator` object which is the result - * of running each of its elements through the `callback`, with each `callback` - * execution potentially mutating the `accumulator` object. The `callback` is - * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. + * An alternative to `_.reduce`, this method transforms an `object` to a new + * `accumulator` object which is the result of running each of its elements + * through the `callback`, with each `callback` execution potentially mutating + * the `accumulator` object. The `callback` is bound to `thisArg` and invoked + * with four arguments; (accumulator, value, key, object). Callbacks may exit + * iteration early by explicitly returning `false`. * * @static * @memberOf _ diff --git a/dist/lodash.js b/dist/lodash.js index 4f55498e8a..c72f195bb3 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -2059,11 +2059,12 @@ } /** - * Transforms an `object` to a new `accumulator` object which is the result - * of running each of its elements through the `callback`, with each `callback` - * execution potentially mutating the `accumulator` object. The `callback` is - * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. + * An alternative to `_.reduce`, this method transforms an `object` to a new + * `accumulator` object which is the result of running each of its elements + * through the `callback`, with each `callback` execution potentially mutating + * the `accumulator` object. The `callback` is bound to `thisArg` and invoked + * with four arguments; (accumulator, value, key, object). Callbacks may exit + * iteration early by explicitly returning `false`. * * @static * @memberOf _ diff --git a/doc/README.md b/doc/README.md index 5723c287e8..c69fddc9bf 100644 --- a/doc/README.md +++ b/doc/README.md @@ -62,6 +62,7 @@ * [`_.every`](#_everycollection--callbackidentity-thisarg) * [`_.filter`](#_filtercollection--callbackidentity-thisarg) * [`_.find`](#_findcollection--callbackidentity-thisarg) +* [`_.findWhere`](#_findcollection--callbackidentity-thisarg) * [`_.foldl`](#_reducecollection--callbackidentity-accumulator-thisarg) * [`_.foldr`](#_reducerightcollection--callbackidentity-accumulator-thisarg) * [`_.forEach`](#_foreachcollection--callbackidentity-thisarg) @@ -217,7 +218,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3523 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3524 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -241,7 +242,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3553 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3554 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -266,7 +267,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3589 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3590 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -294,7 +295,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3659 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3660 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -354,7 +355,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3721 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3722 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -397,7 +398,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3765 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3766 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -429,7 +430,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3832 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3833 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -486,7 +487,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3866 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3867 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -510,7 +511,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3950 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3951 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -567,7 +568,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3991 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3992 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -596,7 +597,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4032 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4033 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -634,7 +635,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4111 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4112 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -694,7 +695,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4175 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4176 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -743,7 +744,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4207 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4208 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -767,7 +768,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4257 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4258 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -814,7 +815,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4296 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4297 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -838,7 +839,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4322 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4323 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -863,7 +864,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4342 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4343 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -887,7 +888,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4364 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4365 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -978,7 +979,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5441 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5442 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1008,7 +1009,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5458 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5459 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1029,7 +1030,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5475 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5476 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1060,7 +1061,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2511 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2512 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1088,7 +1089,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2553 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2554 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1126,7 +1127,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2608 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2609 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1162,7 +1163,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2660 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2661 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1208,7 +1209,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2721 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2722 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1254,7 +1255,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2788 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2789 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1263,7 +1264,7 @@ If a property name is passed for `callback`, the created "_.pluck" style callbac If an object is passed for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases -*detect* +*detect, findWhere* #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. @@ -1303,7 +1304,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2835 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2836 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1335,7 +1336,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2885 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2886 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1372,7 +1373,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2918 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2919 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1401,7 +1402,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2970 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2971 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1446,7 +1447,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3027 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3028 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1488,7 +1489,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3096 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3097 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1530,7 +1531,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3146 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3147 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1560,7 +1561,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3178 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3179 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1598,7 +1599,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3221 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3222 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1629,7 +1630,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3281 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3282 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1672,7 +1673,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3302 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3303 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1696,7 +1697,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3335 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3336 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1726,7 +1727,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3382 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3383 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1772,7 +1773,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3438 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3439 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1809,7 +1810,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3473 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3474 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1833,7 +1834,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3505 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3506 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1870,7 +1871,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4404 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4405 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1898,7 +1899,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4437 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4438 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1929,7 +1930,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4468 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4469 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1960,7 +1961,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4514 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4515 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2001,7 +2002,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4537 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4538 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2028,7 +2029,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4596 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4597 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2082,7 +2083,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4672 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4673 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2115,7 +2116,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4725 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4726 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2140,7 +2141,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4751 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4752 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2167,7 +2168,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4775 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4776 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. @@ -2193,7 +2194,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4805 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4806 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2219,7 +2220,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4840 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4841 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2246,7 +2247,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4871 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4872 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2283,7 +2284,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4904 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4905 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2315,7 +2316,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4969 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4970 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -3328,9 +3329,9 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2443 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2444 "View in source") [Ⓣ][1] -Transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. +An alternative to `_.reduce`, this method transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -3365,7 +3366,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2476 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2477 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3396,7 +3397,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4993 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4994 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3420,7 +3421,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5011 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5012 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3445,7 +3446,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5037 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5038 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3475,7 +3476,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5066 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5067 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3495,7 +3496,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5090 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5091 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3522,7 +3523,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5113 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5114 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3550,7 +3551,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5157 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5158 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3603,7 +3604,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5241 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5242 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3685,7 +3686,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5366 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5367 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3717,7 +3718,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5393 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5394 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3741,7 +3742,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5413 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5414 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3794,7 +3795,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5655 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5657 "View in source") [Ⓣ][1] *(String)*: The semantic version number. diff --git a/lodash.js b/lodash.js index c95cf4f195..5c2e602ccd 100644 --- a/lodash.js +++ b/lodash.js @@ -2411,11 +2411,12 @@ } /** - * Transforms an `object` to a new `accumulator` object which is the result - * of running each of its elements through the `callback`, with each `callback` - * execution potentially mutating the `accumulator` object. The `callback` is - * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. + * An alternative to `_.reduce`, this method transforms an `object` to a new + * `accumulator` object which is the result of running each of its elements + * through the `callback`, with each `callback` execution potentially mutating + * the `accumulator` object. The `callback` is bound to `thisArg` and invoked + * with four arguments; (accumulator, value, key, object). Callbacks may exit + * iteration early by explicitly returning `false`. * * @static * @memberOf _ From e27bdb965cec1e8e2a37ecab6455c38d0dc8d4d5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 29 May 2013 10:30:58 -0500 Subject: [PATCH 083/117] Add a note about the exposed `cache` to `_.memoize` docs. Former-commit-id: 75939e3ed38fe8447c2f9e45b965a837901bcc4c --- dist/lodash.compat.js | 3 ++- dist/lodash.js | 3 ++- dist/lodash.underscore.js | 3 ++- doc/README.md | 44 +++++++++++++++++++-------------------- lodash.js | 3 ++- 5 files changed, 30 insertions(+), 26 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index cd39781bbf..e6948585e8 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -4740,7 +4740,8 @@ * passed, it will be used to determine the cache key for storing the result * based on the arguments passed to the memoized function. By default, the first * argument passed to the memoized function is used as the cache key. The `func` - * is executed with the `this` binding of the memoized function. + * is executed with the `this` binding of the memoized function. The result + * cache is exposed as the `cache` property on the memoized function. * * @static * @memberOf _ diff --git a/dist/lodash.js b/dist/lodash.js index c72f195bb3..387439e781 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -4414,7 +4414,8 @@ * passed, it will be used to determine the cache key for storing the result * based on the arguments passed to the memoized function. By default, the first * argument passed to the memoized function is used as the cache key. The `func` - * is executed with the `this` binding of the memoized function. + * is executed with the `this` binding of the memoized function. The result + * cache is exposed as the `cache` property on the memoized function. * * @static * @memberOf _ diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index e5eb98b7f9..a16885dbcf 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -3740,7 +3740,8 @@ * passed, it will be used to determine the cache key for storing the result * based on the arguments passed to the memoized function. By default, the first * argument passed to the memoized function is used as the cache key. The `func` - * is executed with the `this` binding of the memoized function. + * is executed with the `this` binding of the memoized function. The result + * cache is exposed as the `cache` property on the memoized function. * * @static * @memberOf _ diff --git a/doc/README.md b/doc/README.md index c69fddc9bf..f37ef9f410 100644 --- a/doc/README.md +++ b/doc/README.md @@ -979,7 +979,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5442 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5443 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1009,7 +1009,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5459 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5460 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1030,7 +1030,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5476 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5477 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -2168,9 +2168,9 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4776 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4777 "View in source") [Ⓣ][1] -Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. +Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. #### Arguments 1. `func` *(Function)*: The function to have its output memoized. @@ -2194,7 +2194,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4806 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4807 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2220,7 +2220,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4841 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4842 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2247,7 +2247,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4872 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4873 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2284,7 +2284,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4905 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4906 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2316,7 +2316,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4970 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4971 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -3397,7 +3397,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4994 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4995 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3421,7 +3421,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5012 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5013 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3446,7 +3446,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5038 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5039 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3476,7 +3476,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5067 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5068 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3496,7 +3496,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5091 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5092 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3523,7 +3523,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5114 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5115 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3551,7 +3551,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5158 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5159 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3604,7 +3604,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5242 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5243 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3686,7 +3686,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5367 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5368 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3718,7 +3718,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5394 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5395 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3742,7 +3742,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5414 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5415 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3795,7 +3795,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5657 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5658 "View in source") [Ⓣ][1] *(String)*: The semantic version number. diff --git a/lodash.js b/lodash.js index 5c2e602ccd..a918e09493 100644 --- a/lodash.js +++ b/lodash.js @@ -4759,7 +4759,8 @@ * passed, it will be used to determine the cache key for storing the result * based on the arguments passed to the memoized function. By default, the first * argument passed to the memoized function is used as the cache key. The `func` - * is executed with the `this` binding of the memoized function. + * is executed with the `this` binding of the memoized function. The result + * cache is exposed as the `cache` property on the memoized function. * * @static * @memberOf _ From d1fb379a40bdb6b6027bdfbe047d3fa9eca1598c Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Wed, 29 May 2013 17:51:57 +0200 Subject: [PATCH 084/117] Enable code coverage Former-commit-id: 9b52247b6e880f15895842e4ff34c15fc99fd1eb --- .gitignore | 3 + .npmignore | 3 +- Gruntfile.js | 63 + README.md | 9 + coverage/lodash/index.html | 333 + coverage/lodash/lodash.js.html | 17552 +++++++++++++++++++++++++++++++ coverage/prettify.css | 1 + coverage/prettify.js | 1 + package.json | 7 +- test/run-test.sh | 18 - 10 files changed, 17970 insertions(+), 20 deletions(-) create mode 100644 Gruntfile.js create mode 100644 coverage/lodash/index.html create mode 100644 coverage/lodash/lodash.js.html create mode 100644 coverage/prettify.css create mode 100644 coverage/prettify.js delete mode 100755 test/run-test.sh diff --git a/.gitignore b/.gitignore index 150de05ff2..5bc084a2e5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ node_modules vendor/closure-compiler vendor/uglifyjs +coverage/index.html +coverage/*.json +coverage/lodash/vendor diff --git a/.npmignore b/.npmignore index edc3e1342e..8aa449cc71 100644 --- a/.npmignore +++ b/.npmignore @@ -6,8 +6,9 @@ *.md bower.json component.json +coverage doc -node_modules +Gruntfile.js perf test vendor/*.gz diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000000..a32cc536f4 --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,63 @@ +module.exports = function(grunt) { + + grunt.initConfig({ + 'shell': { + 'options': { + 'stdout': true, + 'stderr': true, + 'failOnError': true, + 'execOptions': { + 'cwd': 'test' + } + }, + 'cover': { + 'command': 'istanbul cover --report "html" --verbose --dir "coverage" "test.js"' + }, + 'test-rhino': { + 'command': 'echo "Testing in Rhino..."; rhino -opt -1 "test.js" "../dist/lodash.compat.js"; rhino -opt -1 "test.js" "../dist/lodash.compat.min.js"' + }, + 'test-rhino-require': { + 'command': 'echo "Testing in Rhino with -require..."; rhino -opt -1 -require "test.js" "../dist/lodash.compat.js"; rhino -opt -1 -require "test.js" "../dist/lodash.compat.min.js";' + }, + 'test-ringo': { + 'command': 'echo "Testing in Ringo..."; ringo -o -1 "test.js" "../dist/lodash.compat.js"; ringo -o -1 "test.js" "../dist/lodash.compat.min.js"' + }, + 'test-phantomjs': { + 'command': 'echo "Testing in PhantomJS..."; phantomjs "test.js" "../dist/lodash.compat.js"; phantomjs "test.js" "../dist/lodash.compat.min.js"' + }, + 'test-narwhal': { + 'command': 'echo "Testing in Narwhal..."; export NARWHAL_OPTIMIZATION=-1; narwhal "test.js" "../dist/lodash.compat.js"; narwhal "test.js" "../dist/lodash.compat.min.js"' + }, + 'test-node': { + 'command': 'echo "Testing in Node..."; node "test.js" "../dist/lodash.compat.js"; node "test.js" "../dist/lodash.compat.min.js"' + }, + 'test-node-build': { + 'command': 'echo "Testing build..."; node "test-build.js"' + }, + 'test-browser': { + 'command': 'echo "Testing in a browser..."; open "index.html"' + } + } + }); + + grunt.loadNpmTasks('grunt-shell'); + + grunt.registerTask('cover', 'shell:cover'); + grunt.registerTask('test', [ + 'shell:test-rhino', + //'shell:test-rhino-require', + 'shell:test-ringo', + 'shell:test-phantomjs', + 'shell:test-narwhal', + 'shell:test-node', + 'shell:test-node-build', + 'shell:test-browser' + ]); + + grunt.registerTask('default', [ + 'shell:test-node', + 'shell:test-node-build', + 'cover' + ]); + +}; diff --git a/README.md b/README.md index 93e0fc1715..1365cf90c5 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,15 @@ require({ }); ``` +## Unit tests & code coverage + +After cloning this repository, run `npm install` to install the dependencies needed for Lo-Dash development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`. + +Once that’s done, you can run the unit tests in Node using `npm test` or `node test/test.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`. + +To generate [the code coverage report](http://rawgithub.com/bestiejs/lodash/master/coverage/lodash/lodash.js.html), use `grunt cover`. + + ## Release Notes ### v1.2.1 diff --git a/coverage/lodash/index.html b/coverage/lodash/index.html new file mode 100644 index 0000000000..8eb3e78f28 --- /dev/null +++ b/coverage/lodash/index.html @@ -0,0 +1,333 @@ + + + + Code coverage report for lodash/ + + + + + + + +
+

Code coverage report for lodash/

+

+ + Statements: 93.59% (1153 / 1232)      + + + Branches: 87.09% (789 / 906)      + + + Functions: 87.5% (168 / 192)      + + + Lines: 93.64% (1149 / 1227)      + +

+
All files » lodash/
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
lodash.js93.59%(1153 / 1232)87.09%(789 / 906)87.5%(168 / 192)93.64%(1149 / 1227)
+
+
+ + + + + + + + diff --git a/coverage/lodash/lodash.js.html b/coverage/lodash/lodash.js.html new file mode 100644 index 0000000000..dc94972bc5 --- /dev/null +++ b/coverage/lodash/lodash.js.html @@ -0,0 +1,17552 @@ + + + + Code coverage report for lodash/lodash.js + + + + + + + +
+

Code coverage report for lodash/lodash.js

+

+ + Statements: 93.59% (1153 / 1232)      + + + Branches: 87.09% (789 / 906)      + + + Functions: 87.5% (168 / 192)      + + + Lines: 93.64% (1149 / 1227)      + +

+
All files » lodash/ » lodash.js
+
+
+

+
+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301 +302 +303 +304 +305 +306 +307 +308 +309 +310 +311 +312 +313 +314 +315 +316 +317 +318 +319 +320 +321 +322 +323 +324 +325 +326 +327 +328 +329 +330 +331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 +346 +347 +348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 +365 +366 +367 +368 +369 +370 +371 +372 +373 +374 +375 +376 +377 +378 +379 +380 +381 +382 +383 +384 +385 +386 +387 +388 +389 +390 +391 +392 +393 +394 +395 +396 +397 +398 +399 +400 +401 +402 +403 +404 +405 +406 +407 +408 +409 +410 +411 +412 +413 +414 +415 +416 +417 +418 +419 +420 +421 +422 +423 +424 +425 +426 +427 +428 +429 +430 +431 +432 +433 +434 +435 +436 +437 +438 +439 +440 +441 +442 +443 +444 +445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 +713 +714 +715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 +750 +751 +752 +753 +754 +755 +756 +757 +758 +759 +760 +761 +762 +763 +764 +765 +766 +767 +768 +769 +770 +771 +772 +773 +774 +775 +776 +777 +778 +779 +780 +781 +782 +783 +784 +785 +786 +787 +788 +789 +790 +791 +792 +793 +794 +795 +796 +797 +798 +799 +800 +801 +802 +803 +804 +805 +806 +807 +808 +809 +810 +811 +812 +813 +814 +815 +816 +817 +818 +819 +820 +821 +822 +823 +824 +825 +826 +827 +828 +829 +830 +831 +832 +833 +834 +835 +836 +837 +838 +839 +840 +841 +842 +843 +844 +845 +846 +847 +848 +849 +850 +851 +852 +853 +854 +855 +856 +857 +858 +859 +860 +861 +862 +863 +864 +865 +866 +867 +868 +869 +870 +871 +872 +873 +874 +875 +876 +877 +878 +879 +880 +881 +882 +883 +884 +885 +886 +887 +888 +889 +890 +891 +892 +893 +894 +895 +896 +897 +898 +899 +900 +901 +902 +903 +904 +905 +906 +907 +908 +909 +910 +911 +912 +913 +914 +915 +916 +917 +918 +919 +920 +921 +922 +923 +924 +925 +926 +927 +928 +929 +930 +931 +932 +933 +934 +935 +936 +937 +938 +939 +940 +941 +942 +943 +944 +945 +946 +947 +948 +949 +950 +951 +952 +953 +954 +955 +956 +957 +958 +959 +960 +961 +962 +963 +964 +965 +966 +967 +968 +969 +970 +971 +972 +973 +974 +975 +976 +977 +978 +979 +980 +981 +982 +983 +984 +985 +986 +987 +988 +989 +990 +991 +992 +993 +994 +995 +996 +997 +998 +999 +1000 +1001 +1002 +1003 +1004 +1005 +1006 +1007 +1008 +1009 +1010 +1011 +1012 +1013 +1014 +1015 +1016 +1017 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1026 +1027 +1028 +1029 +1030 +1031 +1032 +1033 +1034 +1035 +1036 +1037 +1038 +1039 +1040 +1041 +1042 +1043 +1044 +1045 +1046 +1047 +1048 +1049 +1050 +1051 +1052 +1053 +1054 +1055 +1056 +1057 +1058 +1059 +1060 +1061 +1062 +1063 +1064 +1065 +1066 +1067 +1068 +1069 +1070 +1071 +1072 +1073 +1074 +1075 +1076 +1077 +1078 +1079 +1080 +1081 +1082 +1083 +1084 +1085 +1086 +1087 +1088 +1089 +1090 +1091 +1092 +1093 +1094 +1095 +1096 +1097 +1098 +1099 +1100 +1101 +1102 +1103 +1104 +1105 +1106 +1107 +1108 +1109 +1110 +1111 +1112 +1113 +1114 +1115 +1116 +1117 +1118 +1119 +1120 +1121 +1122 +1123 +1124 +1125 +1126 +1127 +1128 +1129 +1130 +1131 +1132 +1133 +1134 +1135 +1136 +1137 +1138 +1139 +1140 +1141 +1142 +1143 +1144 +1145 +1146 +1147 +1148 +1149 +1150 +1151 +1152 +1153 +1154 +1155 +1156 +1157 +1158 +1159 +1160 +1161 +1162 +1163 +1164 +1165 +1166 +1167 +1168 +1169 +1170 +1171 +1172 +1173 +1174 +1175 +1176 +1177 +1178 +1179 +1180 +1181 +1182 +1183 +1184 +1185 +1186 +1187 +1188 +1189 +1190 +1191 +1192 +1193 +1194 +1195 +1196 +1197 +1198 +1199 +1200 +1201 +1202 +1203 +1204 +1205 +1206 +1207 +1208 +1209 +1210 +1211 +1212 +1213 +1214 +1215 +1216 +1217 +1218 +1219 +1220 +1221 +1222 +1223 +1224 +1225 +1226 +1227 +1228 +1229 +1230 +1231 +1232 +1233 +1234 +1235 +1236 +1237 +1238 +1239 +1240 +1241 +1242 +1243 +1244 +1245 +1246 +1247 +1248 +1249 +1250 +1251 +1252 +1253 +1254 +1255 +1256 +1257 +1258 +1259 +1260 +1261 +1262 +1263 +1264 +1265 +1266 +1267 +1268 +1269 +1270 +1271 +1272 +1273 +1274 +1275 +1276 +1277 +1278 +1279 +1280 +1281 +1282 +1283 +1284 +1285 +1286 +1287 +1288 +1289 +1290 +1291 +1292 +1293 +1294 +1295 +1296 +1297 +1298 +1299 +1300 +1301 +1302 +1303 +1304 +1305 +1306 +1307 +1308 +1309 +1310 +1311 +1312 +1313 +1314 +1315 +1316 +1317 +1318 +1319 +1320 +1321 +1322 +1323 +1324 +1325 +1326 +1327 +1328 +1329 +1330 +1331 +1332 +1333 +1334 +1335 +1336 +1337 +1338 +1339 +1340 +1341 +1342 +1343 +1344 +1345 +1346 +1347 +1348 +1349 +1350 +1351 +1352 +1353 +1354 +1355 +1356 +1357 +1358 +1359 +1360 +1361 +1362 +1363 +1364 +1365 +1366 +1367 +1368 +1369 +1370 +1371 +1372 +1373 +1374 +1375 +1376 +1377 +1378 +1379 +1380 +1381 +1382 +1383 +1384 +1385 +1386 +1387 +1388 +1389 +1390 +1391 +1392 +1393 +1394 +1395 +1396 +1397 +1398 +1399 +1400 +1401 +1402 +1403 +1404 +1405 +1406 +1407 +1408 +1409 +1410 +1411 +1412 +1413 +1414 +1415 +1416 +1417 +1418 +1419 +1420 +1421 +1422 +1423 +1424 +1425 +1426 +1427 +1428 +1429 +1430 +1431 +1432 +1433 +1434 +1435 +1436 +1437 +1438 +1439 +1440 +1441 +1442 +1443 +1444 +1445 +1446 +1447 +1448 +1449 +1450 +1451 +1452 +1453 +1454 +1455 +1456 +1457 +1458 +1459 +1460 +1461 +1462 +1463 +1464 +1465 +1466 +1467 +1468 +1469 +1470 +1471 +1472 +1473 +1474 +1475 +1476 +1477 +1478 +1479 +1480 +1481 +1482 +1483 +1484 +1485 +1486 +1487 +1488 +1489 +1490 +1491 +1492 +1493 +1494 +1495 +1496 +1497 +1498 +1499 +1500 +1501 +1502 +1503 +1504 +1505 +1506 +1507 +1508 +1509 +1510 +1511 +1512 +1513 +1514 +1515 +1516 +1517 +1518 +1519 +1520 +1521 +1522 +1523 +1524 +1525 +1526 +1527 +1528 +1529 +1530 +1531 +1532 +1533 +1534 +1535 +1536 +1537 +1538 +1539 +1540 +1541 +1542 +1543 +1544 +1545 +1546 +1547 +1548 +1549 +1550 +1551 +1552 +1553 +1554 +1555 +1556 +1557 +1558 +1559 +1560 +1561 +1562 +1563 +1564 +1565 +1566 +1567 +1568 +1569 +1570 +1571 +1572 +1573 +1574 +1575 +1576 +1577 +1578 +1579 +1580 +1581 +1582 +1583 +1584 +1585 +1586 +1587 +1588 +1589 +1590 +1591 +1592 +1593 +1594 +1595 +1596 +1597 +1598 +1599 +1600 +1601 +1602 +1603 +1604 +1605 +1606 +1607 +1608 +1609 +1610 +1611 +1612 +1613 +1614 +1615 +1616 +1617 +1618 +1619 +1620 +1621 +1622 +1623 +1624 +1625 +1626 +1627 +1628 +1629 +1630 +1631 +1632 +1633 +1634 +1635 +1636 +1637 +1638 +1639 +1640 +1641 +1642 +1643 +1644 +1645 +1646 +1647 +1648 +1649 +1650 +1651 +1652 +1653 +1654 +1655 +1656 +1657 +1658 +1659 +1660 +1661 +1662 +1663 +1664 +1665 +1666 +1667 +1668 +1669 +1670 +1671 +1672 +1673 +1674 +1675 +1676 +1677 +1678 +1679 +1680 +1681 +1682 +1683 +1684 +1685 +1686 +1687 +1688 +1689 +1690 +1691 +1692 +1693 +1694 +1695 +1696 +1697 +1698 +1699 +1700 +1701 +1702 +1703 +1704 +1705 +1706 +1707 +1708 +1709 +1710 +1711 +1712 +1713 +1714 +1715 +1716 +1717 +1718 +1719 +1720 +1721 +1722 +1723 +1724 +1725 +1726 +1727 +1728 +1729 +1730 +1731 +1732 +1733 +1734 +1735 +1736 +1737 +1738 +1739 +1740 +1741 +1742 +1743 +1744 +1745 +1746 +1747 +1748 +1749 +1750 +1751 +1752 +1753 +1754 +1755 +1756 +1757 +1758 +1759 +1760 +1761 +1762 +1763 +1764 +1765 +1766 +1767 +1768 +1769 +1770 +1771 +1772 +1773 +1774 +1775 +1776 +1777 +1778 +1779 +1780 +1781 +1782 +1783 +1784 +1785 +1786 +1787 +1788 +1789 +1790 +1791 +1792 +1793 +1794 +1795 +1796 +1797 +1798 +1799 +1800 +1801 +1802 +1803 +1804 +1805 +1806 +1807 +1808 +1809 +1810 +1811 +1812 +1813 +1814 +1815 +1816 +1817 +1818 +1819 +1820 +1821 +1822 +1823 +1824 +1825 +1826 +1827 +1828 +1829 +1830 +1831 +1832 +1833 +1834 +1835 +1836 +1837 +1838 +1839 +1840 +1841 +1842 +1843 +1844 +1845 +1846 +1847 +1848 +1849 +1850 +1851 +1852 +1853 +1854 +1855 +1856 +1857 +1858 +1859 +1860 +1861 +1862 +1863 +1864 +1865 +1866 +1867 +1868 +1869 +1870 +1871 +1872 +1873 +1874 +1875 +1876 +1877 +1878 +1879 +1880 +1881 +1882 +1883 +1884 +1885 +1886 +1887 +1888 +1889 +1890 +1891 +1892 +1893 +1894 +1895 +1896 +1897 +1898 +1899 +1900 +1901 +1902 +1903 +1904 +1905 +1906 +1907 +1908 +1909 +1910 +1911 +1912 +1913 +1914 +1915 +1916 +1917 +1918 +1919 +1920 +1921 +1922 +1923 +1924 +1925 +1926 +1927 +1928 +1929 +1930 +1931 +1932 +1933 +1934 +1935 +1936 +1937 +1938 +1939 +1940 +1941 +1942 +1943 +1944 +1945 +1946 +1947 +1948 +1949 +1950 +1951 +1952 +1953 +1954 +1955 +1956 +1957 +1958 +1959 +1960 +1961 +1962 +1963 +1964 +1965 +1966 +1967 +1968 +1969 +1970 +1971 +1972 +1973 +1974 +1975 +1976 +1977 +1978 +1979 +1980 +1981 +1982 +1983 +1984 +1985 +1986 +1987 +1988 +1989 +1990 +1991 +1992 +1993 +1994 +1995 +1996 +1997 +1998 +1999 +2000 +2001 +2002 +2003 +2004 +2005 +2006 +2007 +2008 +2009 +2010 +2011 +2012 +2013 +2014 +2015 +2016 +2017 +2018 +2019 +2020 +2021 +2022 +2023 +2024 +2025 +2026 +2027 +2028 +2029 +2030 +2031 +2032 +2033 +2034 +2035 +2036 +2037 +2038 +2039 +2040 +2041 +2042 +2043 +2044 +2045 +2046 +2047 +2048 +2049 +2050 +2051 +2052 +2053 +2054 +2055 +2056 +2057 +2058 +2059 +2060 +2061 +2062 +2063 +2064 +2065 +2066 +2067 +2068 +2069 +2070 +2071 +2072 +2073 +2074 +2075 +2076 +2077 +2078 +2079 +2080 +2081 +2082 +2083 +2084 +2085 +2086 +2087 +2088 +2089 +2090 +2091 +2092 +2093 +2094 +2095 +2096 +2097 +2098 +2099 +2100 +2101 +2102 +2103 +2104 +2105 +2106 +2107 +2108 +2109 +2110 +2111 +2112 +2113 +2114 +2115 +2116 +2117 +2118 +2119 +2120 +2121 +2122 +2123 +2124 +2125 +2126 +2127 +2128 +2129 +2130 +2131 +2132 +2133 +2134 +2135 +2136 +2137 +2138 +2139 +2140 +2141 +2142 +2143 +2144 +2145 +2146 +2147 +2148 +2149 +2150 +2151 +2152 +2153 +2154 +2155 +2156 +2157 +2158 +2159 +2160 +2161 +2162 +2163 +2164 +2165 +2166 +2167 +2168 +2169 +2170 +2171 +2172 +2173 +2174 +2175 +2176 +2177 +2178 +2179 +2180 +2181 +2182 +2183 +2184 +2185 +2186 +2187 +2188 +2189 +2190 +2191 +2192 +2193 +2194 +2195 +2196 +2197 +2198 +2199 +2200 +2201 +2202 +2203 +2204 +2205 +2206 +2207 +2208 +2209 +2210 +2211 +2212 +2213 +2214 +2215 +2216 +2217 +2218 +2219 +2220 +2221 +2222 +2223 +2224 +2225 +2226 +2227 +2228 +2229 +2230 +2231 +2232 +2233 +2234 +2235 +2236 +2237 +2238 +2239 +2240 +2241 +2242 +2243 +2244 +2245 +2246 +2247 +2248 +2249 +2250 +2251 +2252 +2253 +2254 +2255 +2256 +2257 +2258 +2259 +2260 +2261 +2262 +2263 +2264 +2265 +2266 +2267 +2268 +2269 +2270 +2271 +2272 +2273 +2274 +2275 +2276 +2277 +2278 +2279 +2280 +2281 +2282 +2283 +2284 +2285 +2286 +2287 +2288 +2289 +2290 +2291 +2292 +2293 +2294 +2295 +2296 +2297 +2298 +2299 +2300 +2301 +2302 +2303 +2304 +2305 +2306 +2307 +2308 +2309 +2310 +2311 +2312 +2313 +2314 +2315 +2316 +2317 +2318 +2319 +2320 +2321 +2322 +2323 +2324 +2325 +2326 +2327 +2328 +2329 +2330 +2331 +2332 +2333 +2334 +2335 +2336 +2337 +2338 +2339 +2340 +2341 +2342 +2343 +2344 +2345 +2346 +2347 +2348 +2349 +2350 +2351 +2352 +2353 +2354 +2355 +2356 +2357 +2358 +2359 +2360 +2361 +2362 +2363 +2364 +2365 +2366 +2367 +2368 +2369 +2370 +2371 +2372 +2373 +2374 +2375 +2376 +2377 +2378 +2379 +2380 +2381 +2382 +2383 +2384 +2385 +2386 +2387 +2388 +2389 +2390 +2391 +2392 +2393 +2394 +2395 +2396 +2397 +2398 +2399 +2400 +2401 +2402 +2403 +2404 +2405 +2406 +2407 +2408 +2409 +2410 +2411 +2412 +2413 +2414 +2415 +2416 +2417 +2418 +2419 +2420 +2421 +2422 +2423 +2424 +2425 +2426 +2427 +2428 +2429 +2430 +2431 +2432 +2433 +2434 +2435 +2436 +2437 +2438 +2439 +2440 +2441 +2442 +2443 +2444 +2445 +2446 +2447 +2448 +2449 +2450 +2451 +2452 +2453 +2454 +2455 +2456 +2457 +2458 +2459 +2460 +2461 +2462 +2463 +2464 +2465 +2466 +2467 +2468 +2469 +2470 +2471 +2472 +2473 +2474 +2475 +2476 +2477 +2478 +2479 +2480 +2481 +2482 +2483 +2484 +2485 +2486 +2487 +2488 +2489 +2490 +2491 +2492 +2493 +2494 +2495 +2496 +2497 +2498 +2499 +2500 +2501 +2502 +2503 +2504 +2505 +2506 +2507 +2508 +2509 +2510 +2511 +2512 +2513 +2514 +2515 +2516 +2517 +2518 +2519 +2520 +2521 +2522 +2523 +2524 +2525 +2526 +2527 +2528 +2529 +2530 +2531 +2532 +2533 +2534 +2535 +2536 +2537 +2538 +2539 +2540 +2541 +2542 +2543 +2544 +2545 +2546 +2547 +2548 +2549 +2550 +2551 +2552 +2553 +2554 +2555 +2556 +2557 +2558 +2559 +2560 +2561 +2562 +2563 +2564 +2565 +2566 +2567 +2568 +2569 +2570 +2571 +2572 +2573 +2574 +2575 +2576 +2577 +2578 +2579 +2580 +2581 +2582 +2583 +2584 +2585 +2586 +2587 +2588 +2589 +2590 +2591 +2592 +2593 +2594 +2595 +2596 +2597 +2598 +2599 +2600 +2601 +2602 +2603 +2604 +2605 +2606 +2607 +2608 +2609 +2610 +2611 +2612 +2613 +2614 +2615 +2616 +2617 +2618 +2619 +2620 +2621 +2622 +2623 +2624 +2625 +2626 +2627 +2628 +2629 +2630 +2631 +2632 +2633 +2634 +2635 +2636 +2637 +2638 +2639 +2640 +2641 +2642 +2643 +2644 +2645 +2646 +2647 +2648 +2649 +2650 +2651 +2652 +2653 +2654 +2655 +2656 +2657 +2658 +2659 +2660 +2661 +2662 +2663 +2664 +2665 +2666 +2667 +2668 +2669 +2670 +2671 +2672 +2673 +2674 +2675 +2676 +2677 +2678 +2679 +2680 +2681 +2682 +2683 +2684 +2685 +2686 +2687 +2688 +2689 +2690 +2691 +2692 +2693 +2694 +2695 +2696 +2697 +2698 +2699 +2700 +2701 +2702 +2703 +2704 +2705 +2706 +2707 +2708 +2709 +2710 +2711 +2712 +2713 +2714 +2715 +2716 +2717 +2718 +2719 +2720 +2721 +2722 +2723 +2724 +2725 +2726 +2727 +2728 +2729 +2730 +2731 +2732 +2733 +2734 +2735 +2736 +2737 +2738 +2739 +2740 +2741 +2742 +2743 +2744 +2745 +2746 +2747 +2748 +2749 +2750 +2751 +2752 +2753 +2754 +2755 +2756 +2757 +2758 +2759 +2760 +2761 +2762 +2763 +2764 +2765 +2766 +2767 +2768 +2769 +2770 +2771 +2772 +2773 +2774 +2775 +2776 +2777 +2778 +2779 +2780 +2781 +2782 +2783 +2784 +2785 +2786 +2787 +2788 +2789 +2790 +2791 +2792 +2793 +2794 +2795 +2796 +2797 +2798 +2799 +2800 +2801 +2802 +2803 +2804 +2805 +2806 +2807 +2808 +2809 +2810 +2811 +2812 +2813 +2814 +2815 +2816 +2817 +2818 +2819 +2820 +2821 +2822 +2823 +2824 +2825 +2826 +2827 +2828 +2829 +2830 +2831 +2832 +2833 +2834 +2835 +2836 +2837 +2838 +2839 +2840 +2841 +2842 +2843 +2844 +2845 +2846 +2847 +2848 +2849 +2850 +2851 +2852 +2853 +2854 +2855 +2856 +2857 +2858 +2859 +2860 +2861 +2862 +2863 +2864 +2865 +2866 +2867 +2868 +2869 +2870 +2871 +2872 +2873 +2874 +2875 +2876 +2877 +2878 +2879 +2880 +2881 +2882 +2883 +2884 +2885 +2886 +2887 +2888 +2889 +2890 +2891 +2892 +2893 +2894 +2895 +2896 +2897 +2898 +2899 +2900 +2901 +2902 +2903 +2904 +2905 +2906 +2907 +2908 +2909 +2910 +2911 +2912 +2913 +2914 +2915 +2916 +2917 +2918 +2919 +2920 +2921 +2922 +2923 +2924 +2925 +2926 +2927 +2928 +2929 +2930 +2931 +2932 +2933 +2934 +2935 +2936 +2937 +2938 +2939 +2940 +2941 +2942 +2943 +2944 +2945 +2946 +2947 +2948 +2949 +2950 +2951 +2952 +2953 +2954 +2955 +2956 +2957 +2958 +2959 +2960 +2961 +2962 +2963 +2964 +2965 +2966 +2967 +2968 +2969 +2970 +2971 +2972 +2973 +2974 +2975 +2976 +2977 +2978 +2979 +2980 +2981 +2982 +2983 +2984 +2985 +2986 +2987 +2988 +2989 +2990 +2991 +2992 +2993 +2994 +2995 +2996 +2997 +2998 +2999 +3000 +3001 +3002 +3003 +3004 +3005 +3006 +3007 +3008 +3009 +3010 +3011 +3012 +3013 +3014 +3015 +3016 +3017 +3018 +3019 +3020 +3021 +3022 +3023 +3024 +3025 +3026 +3027 +3028 +3029 +3030 +3031 +3032 +3033 +3034 +3035 +3036 +3037 +3038 +3039 +3040 +3041 +3042 +3043 +3044 +3045 +3046 +3047 +3048 +3049 +3050 +3051 +3052 +3053 +3054 +3055 +3056 +3057 +3058 +3059 +3060 +3061 +3062 +3063 +3064 +3065 +3066 +3067 +3068 +3069 +3070 +3071 +3072 +3073 +3074 +3075 +3076 +3077 +3078 +3079 +3080 +3081 +3082 +3083 +3084 +3085 +3086 +3087 +3088 +3089 +3090 +3091 +3092 +3093 +3094 +3095 +3096 +3097 +3098 +3099 +3100 +3101 +3102 +3103 +3104 +3105 +3106 +3107 +3108 +3109 +3110 +3111 +3112 +3113 +3114 +3115 +3116 +3117 +3118 +3119 +3120 +3121 +3122 +3123 +3124 +3125 +3126 +3127 +3128 +3129 +3130 +3131 +3132 +3133 +3134 +3135 +3136 +3137 +3138 +3139 +3140 +3141 +3142 +3143 +3144 +3145 +3146 +3147 +3148 +3149 +3150 +3151 +3152 +3153 +3154 +3155 +3156 +3157 +3158 +3159 +3160 +3161 +3162 +3163 +3164 +3165 +3166 +3167 +3168 +3169 +3170 +3171 +3172 +3173 +3174 +3175 +3176 +3177 +3178 +3179 +3180 +3181 +3182 +3183 +3184 +3185 +3186 +3187 +3188 +3189 +3190 +3191 +3192 +3193 +3194 +3195 +3196 +3197 +3198 +3199 +3200 +3201 +3202 +3203 +3204 +3205 +3206 +3207 +3208 +3209 +3210 +3211 +3212 +3213 +3214 +3215 +3216 +3217 +3218 +3219 +3220 +3221 +3222 +3223 +3224 +3225 +3226 +3227 +3228 +3229 +3230 +3231 +3232 +3233 +3234 +3235 +3236 +3237 +3238 +3239 +3240 +3241 +3242 +3243 +3244 +3245 +3246 +3247 +3248 +3249 +3250 +3251 +3252 +3253 +3254 +3255 +3256 +3257 +3258 +3259 +3260 +3261 +3262 +3263 +3264 +3265 +3266 +3267 +3268 +3269 +3270 +3271 +3272 +3273 +3274 +3275 +3276 +3277 +3278 +3279 +3280 +3281 +3282 +3283 +3284 +3285 +3286 +3287 +3288 +3289 +3290 +3291 +3292 +3293 +3294 +3295 +3296 +3297 +3298 +3299 +3300 +3301 +3302 +3303 +3304 +3305 +3306 +3307 +3308 +3309 +3310 +3311 +3312 +3313 +3314 +3315 +3316 +3317 +3318 +3319 +3320 +3321 +3322 +3323 +3324 +3325 +3326 +3327 +3328 +3329 +3330 +3331 +3332 +3333 +3334 +3335 +3336 +3337 +3338 +3339 +3340 +3341 +3342 +3343 +3344 +3345 +3346 +3347 +3348 +3349 +3350 +3351 +3352 +3353 +3354 +3355 +3356 +3357 +3358 +3359 +3360 +3361 +3362 +3363 +3364 +3365 +3366 +3367 +3368 +3369 +3370 +3371 +3372 +3373 +3374 +3375 +3376 +3377 +3378 +3379 +3380 +3381 +3382 +3383 +3384 +3385 +3386 +3387 +3388 +3389 +3390 +3391 +3392 +3393 +3394 +3395 +3396 +3397 +3398 +3399 +3400 +3401 +3402 +3403 +3404 +3405 +3406 +3407 +3408 +3409 +3410 +3411 +3412 +3413 +3414 +3415 +3416 +3417 +3418 +3419 +3420 +3421 +3422 +3423 +3424 +3425 +3426 +3427 +3428 +3429 +3430 +3431 +3432 +3433 +3434 +3435 +3436 +3437 +3438 +3439 +3440 +3441 +3442 +3443 +3444 +3445 +3446 +3447 +3448 +3449 +3450 +3451 +3452 +3453 +3454 +3455 +3456 +3457 +3458 +3459 +3460 +3461 +3462 +3463 +3464 +3465 +3466 +3467 +3468 +3469 +3470 +3471 +3472 +3473 +3474 +3475 +3476 +3477 +3478 +3479 +3480 +3481 +3482 +3483 +3484 +3485 +3486 +3487 +3488 +3489 +3490 +3491 +3492 +3493 +3494 +3495 +3496 +3497 +3498 +3499 +3500 +3501 +3502 +3503 +3504 +3505 +3506 +3507 +3508 +3509 +3510 +3511 +3512 +3513 +3514 +3515 +3516 +3517 +3518 +3519 +3520 +3521 +3522 +3523 +3524 +3525 +3526 +3527 +3528 +3529 +3530 +3531 +3532 +3533 +3534 +3535 +3536 +3537 +3538 +3539 +3540 +3541 +3542 +3543 +3544 +3545 +3546 +3547 +3548 +3549 +3550 +3551 +3552 +3553 +3554 +3555 +3556 +3557 +3558 +3559 +3560 +3561 +3562 +3563 +3564 +3565 +3566 +3567 +3568 +3569 +3570 +3571 +3572 +3573 +3574 +3575 +3576 +3577 +3578 +3579 +3580 +3581 +3582 +3583 +3584 +3585 +3586 +3587 +3588 +3589 +3590 +3591 +3592 +3593 +3594 +3595 +3596 +3597 +3598 +3599 +3600 +3601 +3602 +3603 +3604 +3605 +3606 +3607 +3608 +3609 +3610 +3611 +3612 +3613 +3614 +3615 +3616 +3617 +3618 +3619 +3620 +3621 +3622 +3623 +3624 +3625 +3626 +3627 +3628 +3629 +3630 +3631 +3632 +3633 +3634 +3635 +3636 +3637 +3638 +3639 +3640 +3641 +3642 +3643 +3644 +3645 +3646 +3647 +3648 +3649 +3650 +3651 +3652 +3653 +3654 +3655 +3656 +3657 +3658 +3659 +3660 +3661 +3662 +3663 +3664 +3665 +3666 +3667 +3668 +3669 +3670 +3671 +3672 +3673 +3674 +3675 +3676 +3677 +3678 +3679 +3680 +3681 +3682 +3683 +3684 +3685 +3686 +3687 +3688 +3689 +3690 +3691 +3692 +3693 +3694 +3695 +3696 +3697 +3698 +3699 +3700 +3701 +3702 +3703 +3704 +3705 +3706 +3707 +3708 +3709 +3710 +3711 +3712 +3713 +3714 +3715 +3716 +3717 +3718 +3719 +3720 +3721 +3722 +3723 +3724 +3725 +3726 +3727 +3728 +3729 +3730 +3731 +3732 +3733 +3734 +3735 +3736 +3737 +3738 +3739 +3740 +3741 +3742 +3743 +3744 +3745 +3746 +3747 +3748 +3749 +3750 +3751 +3752 +3753 +3754 +3755 +3756 +3757 +3758 +3759 +3760 +3761 +3762 +3763 +3764 +3765 +3766 +3767 +3768 +3769 +3770 +3771 +3772 +3773 +3774 +3775 +3776 +3777 +3778 +3779 +3780 +3781 +3782 +3783 +3784 +3785 +3786 +3787 +3788 +3789 +3790 +3791 +3792 +3793 +3794 +3795 +3796 +3797 +3798 +3799 +3800 +3801 +3802 +3803 +3804 +3805 +3806 +3807 +3808 +3809 +3810 +3811 +3812 +3813 +3814 +3815 +3816 +3817 +3818 +3819 +3820 +3821 +3822 +3823 +3824 +3825 +3826 +3827 +3828 +3829 +3830 +3831 +3832 +3833 +3834 +3835 +3836 +3837 +3838 +3839 +3840 +3841 +3842 +3843 +3844 +3845 +3846 +3847 +3848 +3849 +3850 +3851 +3852 +3853 +3854 +3855 +3856 +3857 +3858 +3859 +3860 +3861 +3862 +3863 +3864 +3865 +3866 +3867 +3868 +3869 +3870 +3871 +3872 +3873 +3874 +3875 +3876 +3877 +3878 +3879 +3880 +3881 +3882 +3883 +3884 +3885 +3886 +3887 +3888 +3889 +3890 +3891 +3892 +3893 +3894 +3895 +3896 +3897 +3898 +3899 +3900 +3901 +3902 +3903 +3904 +3905 +3906 +3907 +3908 +3909 +3910 +3911 +3912 +3913 +3914 +3915 +3916 +3917 +3918 +3919 +3920 +3921 +3922 +3923 +3924 +3925 +3926 +3927 +3928 +3929 +3930 +3931 +3932 +3933 +3934 +3935 +3936 +3937 +3938 +3939 +3940 +3941 +3942 +3943 +3944 +3945 +3946 +3947 +3948 +3949 +3950 +3951 +3952 +3953 +3954 +3955 +3956 +3957 +3958 +3959 +3960 +3961 +3962 +3963 +3964 +3965 +3966 +3967 +3968 +3969 +3970 +3971 +3972 +3973 +3974 +3975 +3976 +3977 +3978 +3979 +3980 +3981 +3982 +3983 +3984 +3985 +3986 +3987 +3988 +3989 +3990 +3991 +3992 +3993 +3994 +3995 +3996 +3997 +3998 +3999 +4000 +4001 +4002 +4003 +4004 +4005 +4006 +4007 +4008 +4009 +4010 +4011 +4012 +4013 +4014 +4015 +4016 +4017 +4018 +4019 +4020 +4021 +4022 +4023 +4024 +4025 +4026 +4027 +4028 +4029 +4030 +4031 +4032 +4033 +4034 +4035 +4036 +4037 +4038 +4039 +4040 +4041 +4042 +4043 +4044 +4045 +4046 +4047 +4048 +4049 +4050 +4051 +4052 +4053 +4054 +4055 +4056 +4057 +4058 +4059 +4060 +4061 +4062 +4063 +4064 +4065 +4066 +4067 +4068 +4069 +4070 +4071 +4072 +4073 +4074 +4075 +4076 +4077 +4078 +4079 +4080 +4081 +4082 +4083 +4084 +4085 +4086 +4087 +4088 +4089 +4090 +4091 +4092 +4093 +4094 +4095 +4096 +4097 +4098 +4099 +4100 +4101 +4102 +4103 +4104 +4105 +4106 +4107 +4108 +4109 +4110 +4111 +4112 +4113 +4114 +4115 +4116 +4117 +4118 +4119 +4120 +4121 +4122 +4123 +4124 +4125 +4126 +4127 +4128 +4129 +4130 +4131 +4132 +4133 +4134 +4135 +4136 +4137 +4138 +4139 +4140 +4141 +4142 +4143 +4144 +4145 +4146 +4147 +4148 +4149 +4150 +4151 +4152 +4153 +4154 +4155 +4156 +4157 +4158 +4159 +4160 +4161 +4162 +4163 +4164 +4165 +4166 +4167 +4168 +4169 +4170 +4171 +4172 +4173 +4174 +4175 +4176 +4177 +4178 +4179 +4180 +4181 +4182 +4183 +4184 +4185 +4186 +4187 +4188 +4189 +4190 +4191 +4192 +4193 +4194 +4195 +4196 +4197 +4198 +4199 +4200 +4201 +4202 +4203 +4204 +4205 +4206 +4207 +4208 +4209 +4210 +4211 +4212 +4213 +4214 +4215 +4216 +4217 +4218 +4219 +4220 +4221 +4222 +4223 +4224 +4225 +4226 +4227 +4228 +4229 +4230 +4231 +4232 +4233 +4234 +4235 +4236 +4237 +4238 +4239 +4240 +4241 +4242 +4243 +4244 +4245 +4246 +4247 +4248 +4249 +4250 +4251 +4252 +4253 +4254 +4255 +4256 +4257 +4258 +4259 +4260 +4261 +4262 +4263 +4264 +4265 +4266 +4267 +4268 +4269 +4270 +4271 +4272 +4273 +4274 +4275 +4276 +4277 +4278 +4279 +4280 +4281 +4282 +4283 +4284 +4285 +4286 +4287 +4288 +4289 +4290 +4291 +4292 +4293 +4294 +4295 +4296 +4297 +4298 +4299 +4300 +4301 +4302 +4303 +4304 +4305 +4306 +4307 +4308 +4309 +4310 +4311 +4312 +4313 +4314 +4315 +4316 +4317 +4318 +4319 +4320 +4321 +4322 +4323 +4324 +4325 +4326 +4327 +4328 +4329 +4330 +4331 +4332 +4333 +4334 +4335 +4336 +4337 +4338 +4339 +4340 +4341 +4342 +4343 +4344 +4345 +4346 +4347 +4348 +4349 +4350 +4351 +4352 +4353 +4354 +4355 +4356 +4357 +4358 +4359 +4360 +4361 +4362 +4363 +4364 +4365 +4366 +4367 +4368 +4369 +4370 +4371 +4372 +4373 +4374 +4375 +4376 +4377 +4378 +4379 +4380 +4381 +4382 +4383 +4384 +4385 +4386 +4387 +4388 +4389 +4390 +4391 +4392 +4393 +4394 +4395 +4396 +4397 +4398 +4399 +4400 +4401 +4402 +4403 +4404 +4405 +4406 +4407 +4408 +4409 +4410 +4411 +4412 +4413 +4414 +4415 +4416 +4417 +4418 +4419 +4420 +4421 +4422 +4423 +4424 +4425 +4426 +4427 +4428 +4429 +4430 +4431 +4432 +4433 +4434 +4435 +4436 +4437 +4438 +4439 +4440 +4441 +4442 +4443 +4444 +4445 +4446 +4447 +4448 +4449 +4450 +4451 +4452 +4453 +4454 +4455 +4456 +4457 +4458 +4459 +4460 +4461 +4462 +4463 +4464 +4465 +4466 +4467 +4468 +4469 +4470 +4471 +4472 +4473 +4474 +4475 +4476 +4477 +4478 +4479 +4480 +4481 +4482 +4483 +4484 +4485 +4486 +4487 +4488 +4489 +4490 +4491 +4492 +4493 +4494 +4495 +4496 +4497 +4498 +4499 +4500 +4501 +4502 +4503 +4504 +4505 +4506 +4507 +4508 +4509 +4510 +4511 +4512 +4513 +4514 +4515 +4516 +4517 +4518 +4519 +4520 +4521 +4522 +4523 +4524 +4525 +4526 +4527 +4528 +4529 +4530 +4531 +4532 +4533 +4534 +4535 +4536 +4537 +4538 +4539 +4540 +4541 +4542 +4543 +4544 +4545 +4546 +4547 +4548 +4549 +4550 +4551 +4552 +4553 +4554 +4555 +4556 +4557 +4558 +4559 +4560 +4561 +4562 +4563 +4564 +4565 +4566 +4567 +4568 +4569 +4570 +4571 +4572 +4573 +4574 +4575 +4576 +4577 +4578 +4579 +4580 +4581 +4582 +4583 +4584 +4585 +4586 +4587 +4588 +4589 +4590 +4591 +4592 +4593 +4594 +4595 +4596 +4597 +4598 +4599 +4600 +4601 +4602 +4603 +4604 +4605 +4606 +4607 +4608 +4609 +4610 +4611 +4612 +4613 +4614 +4615 +4616 +4617 +4618 +4619 +4620 +4621 +4622 +4623 +4624 +4625 +4626 +4627 +4628 +4629 +4630 +4631 +4632 +4633 +4634 +4635 +4636 +4637 +4638 +4639 +4640 +4641 +4642 +4643 +4644 +4645 +4646 +4647 +4648 +4649 +4650 +4651 +4652 +4653 +4654 +4655 +4656 +4657 +4658 +4659 +4660 +4661 +4662 +4663 +4664 +4665 +4666 +4667 +4668 +4669 +4670 +4671 +4672 +4673 +4674 +4675 +4676 +4677 +4678 +4679 +4680 +4681 +4682 +4683 +4684 +4685 +4686 +4687 +4688 +4689 +4690 +4691 +4692 +4693 +4694 +4695 +4696 +4697 +4698 +4699 +4700 +4701 +4702 +4703 +4704 +4705 +4706 +4707 +4708 +4709 +4710 +4711 +4712 +4713 +4714 +4715 +4716 +4717 +4718 +4719 +4720 +4721 +4722 +4723 +4724 +4725 +4726 +4727 +4728 +4729 +4730 +4731 +4732 +4733 +4734 +4735 +4736 +4737 +4738 +4739 +4740 +4741 +4742 +4743 +4744 +4745 +4746 +4747 +4748 +4749 +4750 +4751 +4752 +4753 +4754 +4755 +4756 +4757 +4758 +4759 +4760 +4761 +4762 +4763 +4764 +4765 +4766 +4767 +4768 +4769 +4770 +4771 +4772 +4773 +4774 +4775 +4776 +4777 +4778 +4779 +4780 +4781 +4782 +4783 +4784 +4785 +4786 +4787 +4788 +4789 +4790 +4791 +4792 +4793 +4794 +4795 +4796 +4797 +4798 +4799 +4800 +4801 +4802 +4803 +4804 +4805 +4806 +4807 +4808 +4809 +4810 +4811 +4812 +4813 +4814 +4815 +4816 +4817 +4818 +4819 +4820 +4821 +4822 +4823 +4824 +4825 +4826 +4827 +4828 +4829 +4830 +4831 +4832 +4833 +4834 +4835 +4836 +4837 +4838 +4839 +4840 +4841 +4842 +4843 +4844 +4845 +4846 +4847 +4848 +4849 +4850 +4851 +4852 +4853 +4854 +4855 +4856 +4857 +4858 +4859 +4860 +4861 +4862 +4863 +4864 +4865 +4866 +4867 +4868 +4869 +4870 +4871 +4872 +4873 +4874 +4875 +4876 +4877 +4878 +4879 +4880 +4881 +4882 +4883 +4884 +4885 +4886 +4887 +4888 +4889 +4890 +4891 +4892 +4893 +4894 +4895 +4896 +4897 +4898 +4899 +4900 +4901 +4902 +4903 +4904 +4905 +4906 +4907 +4908 +4909 +4910 +4911 +4912 +4913 +4914 +4915 +4916 +4917 +4918 +4919 +4920 +4921 +4922 +4923 +4924 +4925 +4926 +4927 +4928 +4929 +4930 +4931 +4932 +4933 +4934 +4935 +4936 +4937 +4938 +4939 +4940 +4941 +4942 +4943 +4944 +4945 +4946 +4947 +4948 +4949 +4950 +4951 +4952 +4953 +4954 +4955 +4956 +4957 +4958 +4959 +4960 +4961 +4962 +4963 +4964 +4965 +4966 +4967 +4968 +4969 +4970 +4971 +4972 +4973 +4974 +4975 +4976 +4977 +4978 +4979 +4980 +4981 +4982 +4983 +4984 +4985 +4986 +4987 +4988 +4989 +4990 +4991 +4992 +4993 +4994 +4995 +4996 +4997 +4998 +4999 +5000 +5001 +5002 +5003 +5004 +5005 +5006 +5007 +5008 +5009 +5010 +5011 +5012 +5013 +5014 +5015 +5016 +5017 +5018 +5019 +5020 +5021 +5022 +5023 +5024 +5025 +5026 +5027 +5028 +5029 +5030 +5031 +5032 +5033 +5034 +5035 +5036 +5037 +5038 +5039 +5040 +5041 +5042 +5043 +5044 +5045 +5046 +5047 +5048 +5049 +5050 +5051 +5052 +5053 +5054 +5055 +5056 +5057 +5058 +5059 +5060 +5061 +5062 +5063 +5064 +5065 +5066 +5067 +5068 +5069 +5070 +5071 +5072 +5073 +5074 +5075 +5076 +5077 +5078 +5079 +5080 +5081 +5082 +5083 +5084 +5085 +5086 +5087 +5088 +5089 +5090 +5091 +5092 +5093 +5094 +5095 +5096 +5097 +5098 +5099 +5100 +5101 +5102 +5103 +5104 +5105 +5106 +5107 +5108 +5109 +5110 +5111 +5112 +5113 +5114 +5115 +5116 +5117 +5118 +5119 +5120 +5121 +5122 +5123 +5124 +5125 +5126 +5127 +5128 +5129 +5130 +5131 +5132 +5133 +5134 +5135 +5136 +5137 +5138 +5139 +5140 +5141 +5142 +5143 +5144 +5145 +5146 +5147 +5148 +5149 +5150 +5151 +5152 +5153 +5154 +5155 +5156 +5157 +5158 +5159 +5160 +5161 +5162 +5163 +5164 +5165 +5166 +5167 +5168 +5169 +5170 +5171 +5172 +5173 +5174 +5175 +5176 +5177 +5178 +5179 +5180 +5181 +5182 +5183 +5184 +5185 +5186 +5187 +5188 +5189 +5190 +5191 +5192 +5193 +5194 +5195 +5196 +5197 +5198 +5199 +5200 +5201 +5202 +5203 +5204 +5205 +5206 +5207 +5208 +5209 +5210 +5211 +5212 +5213 +5214 +5215 +5216 +5217 +5218 +5219 +5220 +5221 +5222 +5223 +5224 +5225 +5226 +5227 +5228 +5229 +5230 +5231 +5232 +5233 +5234 +5235 +5236 +5237 +5238 +5239 +5240 +5241 +5242 +5243 +5244 +5245 +5246 +5247 +5248 +5249 +5250 +5251 +5252 +5253 +5254 +5255 +5256 +5257 +5258 +5259 +5260 +5261 +5262 +5263 +5264 +5265 +5266 +5267 +5268 +5269 +5270 +5271 +5272 +5273 +5274 +5275 +5276 +5277 +5278 +5279 +5280 +5281 +5282 +5283 +5284 +5285 +5286 +5287 +5288 +5289 +5290 +5291 +5292 +5293 +5294 +5295 +5296 +5297 +5298 +5299 +5300 +5301 +5302 +5303 +5304 +5305 +5306 +5307 +5308 +5309 +5310 +5311 +5312 +5313 +5314 +5315 +5316 +5317 +5318 +5319 +5320 +5321 +5322 +5323 +5324 +5325 +5326 +5327 +5328 +5329 +5330 +5331 +5332 +5333 +5334 +5335 +5336 +5337 +5338 +5339 +5340 +5341 +5342 +5343 +5344 +5345 +5346 +5347 +5348 +5349 +5350 +5351 +5352 +5353 +5354 +5355 +5356 +5357 +5358 +5359 +5360 +5361 +5362 +5363 +5364 +5365 +5366 +5367 +5368 +5369 +5370 +5371 +5372 +5373 +5374 +5375 +5376 +5377 +5378 +5379 +5380 +5381 +5382 +5383 +5384 +5385 +5386 +5387 +5388 +5389 +5390 +5391 +5392 +5393 +5394 +5395 +5396 +5397 +5398 +5399 +5400 +5401 +5402 +5403 +5404 +5405 +5406 +5407 +5408 +5409 +5410 +5411 +5412 +5413 +5414 +5415 +5416 +5417 +5418 +5419 +5420 +5421 +5422 +5423 +5424 +5425 +5426 +5427 +5428 +5429 +5430 +5431 +5432 +5433 +5434 +5435 +5436 +5437 +5438 +5439 +5440 +5441 +5442 +5443 +5444 +5445 +5446 +5447 +5448 +5449 +5450 +5451 +5452 +5453 +5454 +5455 +5456 +5457 +5458 +5459 +5460 +5461 +5462 +5463 +5464 +5465 +5466 +5467 +5468 +5469 +5470 +5471 +5472 +5473 +5474 +5475 +5476 +5477 +5478 +5479 +5480 +5481 +5482 +5483 +5484 +5485 +5486 +5487 +5488 +5489 +5490 +5491 +5492 +5493 +5494 +5495 +5496 +5497 +5498 +5499 +5500 +5501 +5502 +5503 +5504 +5505 +5506 +5507 +5508 +5509 +5510 +5511 +5512 +5513 +5514 +5515 +5516 +5517 +5518 +5519 +5520 +5521 +5522 +5523 +5524 +5525 +5526 +5527 +5528 +5529 +5530 +5531 +5532 +5533 +5534 +5535 +5536 +5537 +5538 +5539 +5540 +5541 +5542 +5543 +5544 +5545 +5546 +5547 +5548 +5549 +5550 +5551 +5552 +5553 +5554 +5555 +5556 +5557 +5558 +5559 +5560 +5561 +5562 +5563 +5564 +5565 +5566 +5567 +5568 +5569 +5570 +5571 +5572 +5573 +5574 +5575 +5576 +5577 +5578 +5579 +5580 +5581 +5582 +5583 +5584 +5585 +5586 +5587 +5588 +5589 +5590 +5591 +5592 +5593 +5594 +5595 +5596 +5597 +5598 +5599 +5600 +5601 +5602 +5603 +5604 +5605 +5606 +5607 +5608 +5609 +5610 +5611 +5612 +5613 +5614 +5615 +5616 +5617 +5618 +5619 +5620 +5621 +5622 +5623 +5624 +5625 +5626 +5627 +5628 +5629 +5630 +5631 +5632 +5633 +5634 +5635 +5636 +5637 +5638 +5639 +5640 +5641 +5642 +5643 +5644 +5645 +5646 +5647 +5648 +5649 +5650 +5651 +5652 +5653 +5654 +5655 +5656 +5657 +5658 +5659 +5660 +5661 +5662 +5663 +5664 +5665 +5666 +5667 +5668 +5669 +5670 +5671 +5672 +5673 +5674 +5675 +5676 +5677 +5678 +5679 +5680 +5681 +5682 +5683 +5684 +5685 +5686 +5687 +5688 +5689 +5690 +5691 +5692 +5693 +5694 +5695 +5696 +5697 +5698 +5699 +5700 +5701 +5702 +5703 +5704 +5705 +5706 +5707 +5708 +5709 +5710 +5711 +5712 +5713 +5714 +5715 +5716 +5717 +5718 +5719 +5720 +5721 +5722 +5723 +5724 +5725 +5726 +5727 +5728 +5729 +5730 +5731 +5732 +5733 +5734 +5735 +5736 +5737 +5738 +5739 +5740 +5741 +5742 +5743 +5744 +5745 +5746 +5747 +5748 +5749 +5750  +  +  +  +  +  +  +  +1 +  +  +1 +  +  +1 +  +  +1 +  +  +1 +1 +1 +  +  +  +1 +  +  +1 +  +  +1 +  +  +1 +  +  +1 +  +  +  +  +1 +  +  +  +  +  +1 +  +  +1 +  +  +1 +  +  +1 +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +1 +  +  +1 +  +  +1 +  +  +1 +  +  +  +  +  +  +1 +  +  +  +  +  +1 +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +1 +1 +1 +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +  +  +  +11 +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +11 +  +  +11 +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +11 +11 +11 +11 +11 +11 +11 +11 +11 +  +  +11 +11 +11 +11 +11 +  +11 +11 +11 +77 +77 +693 +198 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +31 +  +  +  +  +  +  +  +  +  +  +  +11 +  +11 +11 +  +  +  +11 +33 +11 +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +11 +11 +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +646 +  +  +646 +5289 +394 +  +  +252 +  +  +  +  +  +  +  +  +  +  +11 +12 +  +  +  +  +  +  +  +  +  +  +  +11 +46 +  +  +46 +46 +  +  +  +46 +24 +13 +  +11 +11 +  +  +22 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +45 +  +  +  +  +45 +14 +14 +  +31 +9 +1 +  +8 +  +  +44 +  +  +28 +  +  +28 +2 +  +28 +9 +  +  +  +28 +  +1 +  +  +  +1 +1 +  +27 +  +44 +  +  +  +  +  +  +  +  +  +  +  +  +11 +37 +  +37 +  +  +  +  +  +  +37 +  +  +  +  +  +  +  +  +  +  +37 +484 +  +  +37 +16 +  +  +37 +152 +152 +  +  +152 +  +  +152 +  +  +  +  +37 +225 +225 +  +  +225 +  +  +225 +111 +  +114 +  +  +  +  +37 +3 +225 +  +3 +  +  +  +37 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +66 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +66 +110 +341 +  +  +66 +66 +  +  +66 +  +  +  +  +  +  +66 +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +11 +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +6 +  +  +  +  +  +  +  +  +  +  +11 +673 +  +  +  +  +  +  +  +  +  +  +11 +145 +145 +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +11 +43 +  +  +11 +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +11 +22 +  +52 +13 +13 +13 +  +52 +10 +  +52 +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +1 +  +  +  +1 +  +  +  +  +  +  +  +  +1 +  +  +  +  +  +  +  +  +  +1 +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +72 +72 +53 +  +72 +  +  +  +72 +80 +  +72 +  +  +  +  +  +  +  +  +  +11 +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +35 +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +501 +35 +  +466 +  +  +  +466 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +107 +  +  +  +107 +6 +6 +6 +  +107 +7 +  +  +  +7 +7 +2 +  +5 +  +  +105 +105 +43 +43 +2 +  +41 +  +  +103 +71 +  +  +  +32 +32 +  +  +1 +  +  +  +2 +  +  +2 +  +  +27 +27 +  +27 +27 +29 +2 +  +  +  +25 +  +  +25 +6 +1 +  +6 +1 +  +  +  +  +25 +25 +  +  +25 +55 +  +  +25 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +33 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +11 +11 +11 +10 +3 +3 +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +31 +31 +908 +872 +  +  +31 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +28 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +19 +  +  +  +  +19 +62 +62 +  +19 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +24 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +24 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +29 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +29 +29 +13 +  +16 +  +  +16 +  +  +6 +  +10 +4 +  +10 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +163 +163 +11 +11 +11 +7 +  +  +  +156 +  +70 +  +86 +  +  +  +86 +  +  +51 +  +  +  +35 +9 +  +  +26 +  +  +26 +3 +  +26 +2 +  +26 +  +  +26 +  +  +  +  +1 +  +  +  +1 +  +  +  +  +  +  +  +  +3 +  +21 +21 +  +14 +  +  +  +14 +  +  +  +14 +  +  +  +14 +  +  +  +1 +  +  +  +  +  +20 +20 +  +20 +20 +6 +2 +  +  +18 +18 +  +  +18 +18 +  +  +18 +6 +6 +  +  +6 +6 +  +  +  +6 +11 +  +  +11 +1 +1 +1 +  +  +10 +2 +  +  +6 +  +  +  +12 +25 +  +25 +  +25 +  +  +  +12 +  +9 +23 +  +22 +  +  +  +12 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +32 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +1000 +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +835 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +24 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +23 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +49 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +77 +47 +  +30 +  +  +30 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +24 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +81 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +23 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +47 +  +  +  +47 +7 +  +40 +17 +  +  +  +23 +23 +  +  +  +23 +21 +  +23 +1 +22 +6 +  +  +40 +44 +54 +  +  +  +  +54 +  +22 +22 +36 +3 +3 +  +  +22 +19 +19 +7 +7 +2 +  +  +19 +17 +  +  +  +  +19 +19 +  +  +19 +17 +  +  +  +  +32 +5 +5 +4 +  +  +32 +30 +  +  +54 +  +  +40 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +17 +  +  +  +17 +4 +  +13 +  +17 +22 +  +  +  +12 +  +  +17 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +7 +  +  +  +  +7 +  +  +  +7 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +16 +16 +12 +  +  +  +12 +56 +56 +52 +  +  +  +4 +4 +7 +2 +  +  +  +16 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +13 +13 +  +13 +13 +3 +  +10 +  +  +10 +  +  +13 +16 +  +13 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +57 +  +  +  +  +57 +44 +  +57 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +14 +  +  +  +  +14 +  +  +14 +14 +  +14 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +56 +  +  +  +  +56 +56 +22 +  +  +  +  +34 +33 +7 +  +  +  +56 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +9 +9 +  +9 +4 +4 +  +9 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +25 +25 +  +25 +11 +  +  +11 +1020 +3 +  +  +  +14 +  +  +  +25 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +45 +45 +  +45 +16 +  +  +16 +173 +173 +138 +  +  +  +29 +3 +2 +  +  +  +45 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +27 +  +27 +6 +  +  +6 +12 +12 +4 +  +  +  +21 +21 +  +  +  +  +  +21 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +277 +178 +  +  +178 +1833 +1 +  +  +  +99 +  +277 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +13 +13 +  +13 +16 +16 +  +13 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +8 +  +  +  +  +  +8 +3 +  +8 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +171 +  +  +  +171 +171 +129 +797 +  +  +42 +45 +  +  +171 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +22 +  +  +22 +11 +  +  +11 +21 +21 +11 +  +  +  +11 +  +  +  +11 +10 +10 +9 +9 +  +  +  +22 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +11 +  +  +11 +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +11 +10 +10 +3 +3 +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +29 +29 +  +29 +6 +  +  +6 +2 +  +6 +9 +  +  +23 +6 +  +  +  +  +29 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +20 +  +  +  +20 +1 +1 +19 +  +  +20 +20 +13 +13 +  +  +  +20 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +9 +9 +127 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +8 +  +  +  +8 +3 +3 +3 +  +8 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +19 +19 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +18 +18 +  +18 +4 +  +  +4 +5 +3 +  +  +  +14 +  +  +  +18 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +11 +  +  +  +11 +11 +25 +  +  +  +  +  +  +11 +11 +11 +25 +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +12 +5 +  +  +  +7 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +8 +  +  +  +8 +5 +5 +3 +  +  +8 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +21 +  +  +  +  +  +21 +317 +317 +116 +  +  +21 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +12 +  +  +12 +12 +11 +4 +  +  +8 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +38 +17 +  +  +17 +7 +7 +7 +11 +  +  +10 +10 +7 +  +  +10 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +33 +  +  +  +33 +44 +44 +10 +  +  +44 +20 +  +24 +  +  +33 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +126 +8 +8 +118 +2 +2 +  +124 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +23 +14 +  +9 +  +  +9 +5 +5 +5 +7 +  +  +4 +  +9 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +10 +  +  +  +  +  +  +  +  +10 +10 +84 +84 +9 +9 +9 +9 +5 +  +  +4 +  +  +10 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +22 +15 +  +  +15 +7 +7 +7 +11 +  +  +8 +8 +5 +  +  +10 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +18 +18 +8 +  +18 +33 +8 +  +  +10 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +24 +24 +  +24 +16 +16 +  +  +  +24 +  +  +  +24 +36 +36 +  +24 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +37 +5 +  +  +  +5 +5 +7 +  +  +32 +  +37 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +13 +  +  +  +13 +13 +  +13 +41 +41 +  +  +  +13 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +9 +9 +  +9 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +35 +  +  +  +  +  +  +35 +266 +  +  +266 +  +  +  +36 +17 +  +36 +  +  +35 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +18 +  +  +  +18 +22 +  +18 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +10 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +14 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +14 +  +  +  +14 +  +  +  +  +  +  +  +14 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +24 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +4 +  +  +  +4 +6 +6 +  +4 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +8 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +520 +205 +  +315 +315 +71 +50 +102 +  +  +21 +21 +67 +  +67 +70 +38 +  +  +67 +  +  +244 +201 +  +43 +5 +8 +  +  +38 +3 +3 +  +  +35 +4 +8 +  +  +31 +54 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +10 +  +  +  +  +  +  +10 +12 +12 +12 +7 +  +  +10 +2 +2 +8 +6 +6 +  +10 +14 +14 +  +  +  +14 +  +14 +5 +  +14 +14 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +11 +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +1 +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +2 +3 +  +  +3 +  +  +  +2 +2 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +2 +  +  +2 +4 +2 +  +2 +2 +  +  +1 +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +7 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +7 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +13 +  +  +  +  +  +  +  +13 +17 +17 +15 +15 +  +  +13 +1 +12 +6 +6 +  +13 +16403 +16403 +2 +  +16403 +16403 +16403 +  +16403 +14 +14 +14 +14 +  +16389 +20 +  +16403 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +12 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +49 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +18 +737 +  +737 +6 +  +  +6 +6 +6 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +7 +7 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +15 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +1012 +4 +  +1012 +1012 +6 +6 +  +1006 +  +1012 +1012 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +8 +8 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +54 +54 +  +  +54 +  +54 +  +  +  +54 +  +  +  +  +  +54 +  +  +  +  +  +  +54 +554 +  +  +554 +  +  +554 +  +  +554 +324 +324 +  +554 +176 +  +554 +  +  +  +554 +  +  +54 +  +  +  +54 +  +  +54 +53 +53 +  +  +54 +  +  +  +  +54 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +54 +  +54 +54 +  +1 +1 +  +53 +3 +  +  +  +  +50 +50 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +19 +19 +  +  +19 +19 +183 +  +19 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +12 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +11 +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +3 +  +  +  +  +  +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +  +  +11 +11 +11 +11 +11 +11 +11 +11 +11 +  +  +11 +  +  +11 +11 +  +  +  +  +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +11 +  +  +11 +11 +11 +11 +11 +11 +11 +11 +  +11 +1331 +583 +25 +25 +25 +  +  +  +  +  +  +  +11 +11 +  +  +11 +11 +  +11 +1375 +44 +16 +16 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +  +  +11 +11 +11 +  +  +11 +33 +33 +4 +  +  +  +  +11 +44 +44 +  +  +  +  +  +  +11 +33 +33 +3 +  +  +  +  +  +11 +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +11 +11 +11 +  +11 +  +  +  +  +  +1 +  +  +1 +  +  +  +  +  +  +  +  +  +  +  +  +  +1 +  +1 +1 +  +  +  +  +  +  +  +  +  +  +  + 
/**
+ * @license
+ * Lo-Dash 1.2.1 <http://lodash.com/>
+ * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
+ * Based on Underscore.js 1.4.4 <http://underscorejs.org/>
+ * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
+ * Available under MIT license <http://lodash.com/license>
+ */
+;(function(window) {
+ 
+  /** Used as a safe reference for `undefined` in pre ES5 environments */
+  var undefined;
+ 
+  /** Detect free variable `exports` */
+  var freeExports = typeof exports == 'object' && exports;
+ 
+  /** Detect free variable `module` */
+  var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
+ 
+  /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
+  var freeGlobal = typeof global == 'object' && global;
+  Eif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
+    window = freeGlobal;
+  }
+ 
+  /** Used to generate unique IDs */
+  var idCounter = 0;
+ 
+  /** Used internally to indicate various things */
+  var indicatorObject = {};
+ 
+  /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
+  var keyPrefix = +new Date + '';
+ 
+  /** Used as the size when optimizations are enabled for large arrays */
+  var largeArraySize = 75;
+ 
+  /** Used to match empty string literals in compiled template source */
+  var reEmptyStringLeading = /\b__p \+= '';/g,
+      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
+      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
+ 
+  /** Used to match HTML entities */
+  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
+ 
+  /**
+   * Used to match ES6 template delimiters
+   * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6
+   */
+  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
+ 
+  /** Used to match regexp flags from their coerced string values */
+  var reFlags = /\w*$/;
+ 
+  /** Used to match "interpolate" template delimiters */
+  var reInterpolate = /<%=([\s\S]+?)%>/g;
+ 
+  /** Used to detect functions containing a `this` reference */
+  var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis;
+ 
+  /** Used to detect and test whitespace */
+  var whitespace = (
+    // whitespace
+    ' \t\x0B\f\xA0\ufeff' +
+ 
+    // line terminators
+    '\n\r\u2028\u2029' +
+ 
+    // unicode category "Zs" space separators
+    '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
+  );
+ 
+  /** Used to match leading whitespace and zeros to be removed */
+  var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)');
+ 
+  /** Used to ensure capturing order of template delimiters */
+  var reNoMatch = /($^)/;
+ 
+  /** Used to match HTML characters */
+  var reUnescapedHtml = /[&<>"']/g;
+ 
+  /** Used to match unescaped characters in compiled string literals */
+  var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
+ 
+  /** Used to assign default `context` object properties */
+  var contextProps = [
+    'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object',
+    'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN',
+    'parseInt', 'setImmediate', 'setTimeout'
+  ];
+ 
+  /** Used to fix the JScript [[DontEnum]] bug */
+  var shadowedProps = [
+    'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
+    'toLocaleString', 'toString', 'valueOf'
+  ];
+ 
+  /** Used to make template sourceURLs easier to identify */
+  var templateCounter = 0;
+ 
+  /** `Object#toString` result shortcuts */
+  var argsClass = '[object Arguments]',
+      arrayClass = '[object Array]',
+      boolClass = '[object Boolean]',
+      dateClass = '[object Date]',
+      errorClass = '[object Error]',
+      funcClass = '[object Function]',
+      numberClass = '[object Number]',
+      objectClass = '[object Object]',
+      regexpClass = '[object RegExp]',
+      stringClass = '[object String]';
+ 
+  /** Used to identify object classifications that `_.clone` supports */
+  var cloneableClasses = {};
+  cloneableClasses[funcClass] = false;
+  cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
+  cloneableClasses[boolClass] = cloneableClasses[dateClass] =
+  cloneableClasses[numberClass] = cloneableClasses[objectClass] =
+  cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;
+ 
+  /** Used to determine if values are of the language type Object */
+  var objectTypes = {
+    'boolean': false,
+    'function': true,
+    'object': true,
+    'number': false,
+    'string': false,
+    'undefined': false
+  };
+ 
+  /** Used to escape characters for inclusion in compiled string literals */
+  var stringEscapes = {
+    '\\': '\\',
+    "'": "'",
+    '\n': 'n',
+    '\r': 'r',
+    '\t': 't',
+    '\u2028': 'u2028',
+    '\u2029': 'u2029'
+  };
+ 
+  /*--------------------------------------------------------------------------*/
+ 
+  /**
+   * Create a new `lodash` function using the given `context` object.
+   *
+   * @static
+   * @memberOf _
+   * @category Utilities
+   * @param {Object} [context=window] The context object.
+   * @returns {Function} Returns the `lodash` function.
+   */
+  function runInContext(context) {
+    // Avoid issues with some ES3 environments that attempt to use values, named
+    // after built-in constructors like `Object`, for the creation of literals.
+    // ES5 clears this up by stating that literals must use built-in constructors.
+    // See http://es5.github.com/#x11.1.5.
+    context = context ? _.defaults(window.Object(), context, _.pick(window, contextProps)) : window;
+ 
+    /** Native constructor references */
+    var Array = context.Array,
+        Boolean = context.Boolean,
+        Date = context.Date,
+        Error = context.Error,
+        Function = context.Function,
+        Math = context.Math,
+        Number = context.Number,
+        Object = context.Object,
+        RegExp = context.RegExp,
+        String = context.String,
+        TypeError = context.TypeError;
+ 
+    /** Used for `Array` and `Object` method references */
+    var arrayProto = Array.prototype,
+        errorProto = Error.prototype,
+        objectProto = Object.prototype,
+        stringProto = String.prototype;
+ 
+    /** Used to restore the original `_` reference in `noConflict` */
+    var oldDash = context._;
+ 
+    /** Used to detect if a method is native */
+    var reNative = RegExp('^' +
+      String(objectProto.valueOf)
+        .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+        .replace(/valueOf|for [^\]]+/g, '.+?') + '$'
+    );
+ 
+    /** Native method shortcuts */
+    var ceil = Math.ceil,
+        clearTimeout = context.clearTimeout,
+        concat = arrayProto.concat,
+        floor = Math.floor,
+        fnToString = Function.prototype.toString,
+        getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
+        hasOwnProperty = objectProto.hasOwnProperty,
+        push = arrayProto.push,
+        propertyIsEnumerable = objectProto.propertyIsEnumerable,
+        setImmediate = context.setImmediate,
+        setTimeout = context.setTimeout,
+        toString = objectProto.toString;
+ 
+    /* Native method shortcuts for methods with the same name as other `lodash` methods */
+    var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
+        nativeCreate = reNative.test(nativeCreate =  Object.create) && nativeCreate,
+        nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray,
+        nativeIsFinite = context.isFinite,
+        nativeIsNaN = context.isNaN,
+        nativeKeys = reNative.test(nativeKeys = Object.keys) && nativeKeys,
+        nativeMax = Math.max,
+        nativeMin = Math.min,
+        nativeParseInt = context.parseInt,
+        nativeRandom = Math.random,
+        nativeSlice = arrayProto.slice;
+ 
+    /** Detect various environments */
+    var isIeOpera = reNative.test(context.attachEvent),
+        isV8 = nativeBind && !/\n|true/.test(nativeBind + isIeOpera);
+ 
+    /** Used to lookup a built-in constructor by [[Class]] */
+    var ctorByClass = {};
+    ctorByClass[arrayClass] = Array;
+    ctorByClass[boolClass] = Boolean;
+    ctorByClass[dateClass] = Date;
+    ctorByClass[funcClass] = Function;
+    ctorByClass[objectClass] = Object;
+    ctorByClass[numberClass] = Number;
+    ctorByClass[regexpClass] = RegExp;
+    ctorByClass[stringClass] = String;
+ 
+    /** Used to avoid iterating non-enumerable properties in IE < 9 */
+    var nonEnumProps = {};
+    nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
+    nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
+    nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
+    nonEnumProps[objectClass] = { 'constructor': true };
+ 
+    (function() {
+      var length = shadowedProps.length;
+      while (length--) {
+        var prop = shadowedProps[length];
+        for (var className in nonEnumProps) {
+          if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], prop)) {
+            nonEnumProps[className][prop] = false;
+          }
+        }
+      }
+    }());
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * Creates a `lodash` object, which wraps the given `value`, to enable method
+     * chaining.
+     *
+     * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
+     * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
+     * and `unshift`
+     *
+     * Chaining is supported in custom builds as long as the `value` method is
+     * implicitly or explicitly included in the build.
+     *
+     * The chainable wrapper functions are:
+     * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,
+     * `compose`, `concat`, `countBy`, `createCallback`, `debounce`, `defaults`,
+     * `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forIn`,
+     * `forOwn`, `functions`, `groupBy`, `initial`, `intersection`, `invert`,
+     * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
+     * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`,
+     * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`,
+     * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`,
+     * `unzip`, `values`, `where`, `without`, `wrap`, and `zip`
+     *
+     * The non-chainable wrapper functions are:
+     * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`,
+     * `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`,
+     * `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`,
+     * `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`,
+     * `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `parseInt`,
+     * `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`,
+     * `sortedIndex`, `runInContext`, `template`, `unescape`, `uniqueId`, and `value`
+     *
+     * The wrapper functions `first` and `last` return wrapped values when `n` is
+     * passed, otherwise they return unwrapped values.
+     *
+     * @name _
+     * @constructor
+     * @alias chain
+     * @category Chaining
+     * @param {Mixed} value The value to wrap in a `lodash` instance.
+     * @returns {Object} Returns a `lodash` instance.
+     * @example
+     *
+     * var wrapped = _([1, 2, 3]);
+     *
+     * // returns an unwrapped value
+     * wrapped.reduce(function(sum, num) {
+     *   return sum + num;
+     * });
+     * // => 6
+     *
+     * // returns a wrapped value
+     * var squares = wrapped.map(function(num) {
+     *   return num * num;
+     * });
+     *
+     * _.isArray(squares);
+     * // => false
+     *
+     * _.isArray(squares.value());
+     * // => true
+     */
+    function lodash(value) {
+      // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
+      return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__'))
+       ? value
+       : new lodashWrapper(value);
+    }
+ 
+    /**
+     * An object used to flag environments features.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    var support = lodash.support = {};
+ 
+    (function() {
+      var ctor = function() { this.x = 1; },
+          object = { '0': 1, 'length': 1 },
+          props = [];
+ 
+      ctor.prototype = { 'valueOf': 1, 'y': 1 };
+      for (var prop in new ctor) { props.push(prop); }
+      for (prop in arguments) { }
+ 
+      /**
+       * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5).
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.argsObject = arguments.constructor == Object && !(arguments instanceof Array);
+ 
+      /**
+       * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9).
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.argsClass = isArguments(arguments);
+ 
+      /**
+       * Detect if `name` or `message` properties of `Error.prototype` are
+       * enumerable by default. (IE < 9, Safari < 5.1)
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
+ 
+      /**
+       * Detect if `prototype` properties are enumerable by default.
+       *
+       * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
+       * (if the prototype or a property on the prototype has been set)
+       * incorrectly sets a function's `prototype` property [[Enumerable]]
+       * value to `true`.
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
+ 
+      /**
+       * Detect if `Function#bind` exists and is inferred to be fast (all but V8).
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.fastBind = nativeBind && !isV8;
+ 
+      /**
+       * Detect if own properties are iterated after inherited properties (all but IE < 9).
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.ownLast = props[0] != 'x';
+ 
+      /**
+       * Detect if `arguments` object indexes are non-enumerable
+       * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1).
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.nonEnumArgs = prop != 0;
+ 
+      /**
+       * Detect if properties shadowing those on `Object.prototype` are non-enumerable.
+       *
+       * In IE < 9 an objects own properties, shadowing non-enumerable ones, are
+       * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug).
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.nonEnumShadows = !/valueOf/.test(props);
+ 
+      /**
+       * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly.
+       *
+       * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
+       * and `splice()` functions that fail to remove the last element, `value[0]`,
+       * of array-like objects even though the `length` property is set to `0`.
+       * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
+       * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]);
+ 
+      /**
+       * Detect lack of support for accessing string characters by index.
+       *
+       * IE < 8 can't access characters by index and IE 8 can only access
+       * characters by index on string literals.
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
+ 
+      /**
+       * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9)
+       * and that the JS engine errors when attempting to coerce an object to
+       * a string without a `toString` function.
+       *
+       * @memberOf _.support
+       * @type Boolean
+       */
+      try {
+        support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
+      } catch(e) {
+        support.nodeClass = true;
+      }
+    }(1));
+ 
+    /**
+     * By default, the template delimiters used by Lo-Dash are similar to those in
+     * embedded Ruby (ERB). Change the following template settings to use alternative
+     * delimiters.
+     *
+     * @static
+     * @memberOf _
+     * @type Object
+     */
+    lodash.templateSettings = {
+ 
+      /**
+       * Used to detect `data` property values to be HTML-escaped.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'escape': /<%-([\s\S]+?)%>/g,
+ 
+      /**
+       * Used to detect code to be evaluated.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'evaluate': /<%([\s\S]+?)%>/g,
+ 
+      /**
+       * Used to detect `data` property values to inject.
+       *
+       * @memberOf _.templateSettings
+       * @type RegExp
+       */
+      'interpolate': reInterpolate,
+ 
+      /**
+       * Used to reference the data object in the template text.
+       *
+       * @memberOf _.templateSettings
+       * @type String
+       */
+      'variable': '',
+ 
+      /**
+       * Used to import variables into the compiled template.
+       *
+       * @memberOf _.templateSettings
+       * @type Object
+       */
+      'imports': {
+ 
+        /**
+         * A reference to the `lodash` function.
+         *
+         * @memberOf _.templateSettings.imports
+         * @type Function
+         */
+        '_': lodash
+      }
+    };
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * The template used to create iterator functions.
+     *
+     * @private
+     * @param {Object} data The data object used to populate the text.
+     * @returns {String} Returns the interpolated text.
+     */
+    var iteratorTemplate = template(
+      // the `iterable` may be reassigned by the `top` snippet
+      'var index, iterable = <%= firstArg %>, ' +
+      // assign the `result` variable an initial value
+      'result = <%= init %>;\n' +
+      // exit early if the first argument is falsey
+      'if (!iterable) return result;\n' +
+      // add code before the iteration branches
+      '<%= top %>;' +
+ 
+      // array-like iteration:
+      '<% if (arrays) { %>\n' +
+      'var length = iterable.length; index = -1;\n' +
+      'if (<%= arrays %>) {' +
+ 
+      // add support for accessing string characters by index if needed
+      '  <% if (support.unindexedChars) { %>\n' +
+      '  if (isString(iterable)) {\n' +
+      "    iterable = iterable.split('')\n" +
+      '  }' +
+      '  <% } %>\n' +
+ 
+      // iterate over the array-like value
+      '  while (++index < length) {\n' +
+      '    <%= loop %>;\n' +
+      '  }\n' +
+      '}\n' +
+      'else {' +
+ 
+      // object iteration:
+      // add support for iterating over `arguments` objects if needed
+      '  <% } else if (support.nonEnumArgs) { %>\n' +
+      '  var length = iterable.length; index = -1;\n' +
+      '  if (length && isArguments(iterable)) {\n' +
+      '    while (++index < length) {\n' +
+      "      index += '';\n" +
+      '      <%= loop %>;\n' +
+      '    }\n' +
+      '  } else {' +
+      '  <% } %>' +
+ 
+      // avoid iterating over `prototype` properties in older Firefox, Opera, and Safari
+      '  <% if (support.enumPrototypes) { %>\n' +
+      "  var skipProto = typeof iterable == 'function';\n" +
+      '  <% } %>' +
+ 
+      // avoid iterating over `Error.prototype` properties in older IE and Safari
+      '  <% if (support.enumErrorProps) { %>\n' +
+      '  var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n' +
+      '  <% } %>' +
+ 
+      // define conditions used in the loop
+      '  <%' +
+      '    var conditions = [];' +
+      '    if (support.enumPrototypes) { conditions.push(\'!(skipProto && index == "prototype")\'); }' +
+      '    if (support.enumErrorProps)  { conditions.push(\'!(skipErrorProps && (index == "message" || index == "name"))\'); }' +
+      '  %>' +
+ 
+      // iterate own properties using `Object.keys`
+      '  <% if (useHas && useKeys) { %>\n' +
+      '  var ownIndex = -1,\n' +
+      '      ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n' +
+      '      length = ownProps.length;\n\n' +
+      '  while (++ownIndex < length) {\n' +
+      '    index = ownProps[ownIndex];\n<%' +
+      "    if (conditions.length) { %>    if (<%= conditions.join(' && ') %>) {\n  <% } %>" +
+      '    <%= loop %>;' +
+      '    <% if (conditions.length) { %>\n    }<% } %>\n' +
+      '  }' +
+ 
+      // else using a for-in loop
+      '  <% } else { %>\n' +
+      '  for (index in iterable) {\n<%' +
+      '    if (useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); }' +
+      "    if (conditions.length) { %>    if (<%= conditions.join(' && ') %>) {\n  <% } %>" +
+      '    <%= loop %>;' +
+      '    <% if (conditions.length) { %>\n    }<% } %>\n' +
+      '  }' +
+ 
+      // Because IE < 9 can't set the `[[Enumerable]]` attribute of an
+      // existing property and the `constructor` property of a prototype
+      // defaults to non-enumerable, Lo-Dash skips the `constructor`
+      // property when it infers it's iterating over a `prototype` object.
+      '    <% if (support.nonEnumShadows) { %>\n\n' +
+      '  if (iterable !== objectProto) {\n' +
+      "    var ctor = iterable.constructor,\n" +
+      '        isProto = iterable === (ctor && ctor.prototype),\n' +
+      '        className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n' +
+      '        nonEnum = nonEnumProps[className];\n' +
+      '      <% for (k = 0; k < 7; k++) { %>\n' +
+      "    index = '<%= shadowedProps[k] %>';\n" +
+      '    if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))<%' +
+      '        if (!useHas) { %> || (!nonEnum[index] && iterable[index] !== objectProto[index])<% }' +
+      '      %>) {\n' +
+      '      <%= loop %>;\n' +
+      '    }' +
+      '      <% } %>\n' +
+      '  }' +
+      '    <% } %>' +
+      '  <% } %>' +
+      '  <% if (arrays || support.nonEnumArgs) { %>\n}<% } %>\n' +
+ 
+      // add code to the bottom of the iteration function
+      '<%= bottom %>;\n' +
+      // finally, return the `result`
+      'return result'
+    );
+ 
+    /** Reusable iterator options for `assign` and `defaults` */
+    var defaultsIteratorOptions = {
+      'args': 'object, source, guard',
+      'top':
+        'var args = arguments,\n' +
+        '    argsIndex = 0,\n' +
+        "    argsLength = typeof guard == 'number' ? 2 : args.length;\n" +
+        'while (++argsIndex < argsLength) {\n' +
+        '  iterable = args[argsIndex];\n' +
+        '  if (iterable && objectTypes[typeof iterable]) {',
+      'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]",
+      'bottom': '  }\n}'
+    };
+ 
+    /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */
+    var eachIteratorOptions = {
+      'args': 'collection, callback, thisArg',
+      'top': "callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg)",
+      'arrays': "typeof length == 'number'",
+      'loop': 'if (callback(iterable[index], index, collection) === false) return result'
+    };
+ 
+    /** Reusable iterator options for `forIn` and `forOwn` */
+    var forOwnIteratorOptions = {
+      'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top,
+      'arrays': false
+    };
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * A basic version of `_.indexOf` without support for binary searches
+     * or `fromIndex` constraints.
+     *
+     * @private
+     * @param {Array} array The array to search.
+     * @param {Mixed} value The value to search for.
+     * @param {Number} [fromIndex=0] The index to search from.
+     * @returns {Number} Returns the index of the matched value or `-1`.
+     */
+    function basicIndexOf(array, value, fromIndex) {
+      var index = (fromIndex || 0) - 1,
+          length = array.length;
+ 
+      while (++index < length) {
+        if (array[index] === value) {
+          return index;
+        }
+      }
+      return -1;
+    }
+ 
+    /**
+     * Used by `_.max` and `_.min` as the default `callback` when a given
+     * `collection` is a string value.
+     *
+     * @private
+     * @param {String} value The character to inspect.
+     * @returns {Number} Returns the code unit of given character.
+     */
+    function charAtCallback(value) {
+      return value.charCodeAt(0);
+    }
+ 
+    /**
+     * Used by `sortBy` to compare transformed `collection` values, stable sorting
+     * them in ascending order.
+     *
+     * @private
+     * @param {Object} a The object to compare to `b`.
+     * @param {Object} b The object to compare to `a`.
+     * @returns {Number} Returns the sort order indicator of `1` or `-1`.
+     */
+    function compareAscending(a, b) {
+      var ai = a.index,
+          bi = b.index;
+ 
+      a = a.criteria;
+      b = b.criteria;
+ 
+      // ensure a stable sort in V8 and other engines
+      // http://code.google.com/p/v8/issues/detail?id=90
+      if (a !== b) {
+        if (a > b || typeof a == 'undefined') {
+          return 1;
+        }
+        Eif (a < b || typeof b == 'undefined') {
+          return -1;
+        }
+      }
+      return ai < bi ? -1 : 1;
+    }
+ 
+    /**
+     * Creates a function that, when called, invokes `func` with the `this` binding
+     * of `thisArg` and prepends any `partialArgs` to the arguments passed to the
+     * bound function.
+     *
+     * @private
+     * @param {Function|String} func The function to bind or the method name.
+     * @param {Mixed} [thisArg] The `this` binding of `func`.
+     * @param {Array} partialArgs An array of arguments to be partially applied.
+     * @param {Object} [idicator] Used to indicate binding by key or partially
+     *  applying arguments from the right.
+     * @returns {Function} Returns the new bound function.
+     */
+    function createBound(func, thisArg, partialArgs, indicator) {
+      var isFunc = isFunction(func),
+          isPartial = !partialArgs,
+          key = thisArg;
+ 
+      // juggle arguments
+      if (isPartial) {
+        var rightIndicator = indicator;
+        partialArgs = thisArg;
+      }
+      else if (!isFunc) {
+        if (!indicator) {
+          throw new TypeError;
+        }
+        thisArg = func;
+      }
+ 
+      function bound() {
+        // `Function#bind` spec
+        // http://es5.github.com/#x15.3.4.5
+        var args = arguments,
+            thisBinding = isPartial ? this : thisArg;
+ 
+        if (!isFunc) {
+          func = thisArg[key];
+        }
+        if (partialArgs.length) {
+          args = args.length
+            ? (args = nativeSlice.call(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args))
+            : partialArgs;
+        }
+        if (this instanceof bound) {
+          // ensure `new bound` is an instance of `func`
+          thisBinding = createObject(func.prototype);
+ 
+          // mimic the constructor's `return` behavior
+          // http://es5.github.com/#x13.2.2
+          var result = func.apply(thisBinding, args);
+          return isObject(result) ? result : thisBinding;
+        }
+        return func.apply(thisBinding, args);
+      }
+      return bound;
+    }
+ 
+ 
+    /**
+     * Creates a function optimized to search large arrays for a given `value`,
+     * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`.
+     *
+     * @private
+     * @param {Array} [array=[]] The array to search.
+     * @param {Mixed} value The value to search for.
+     * @returns {Boolean} Returns `true`, if `value` is found, else `false`.
+     */
+    function createCache(array) {
+      array || (array = []);
+ 
+      var bailout,
+          index = -1,
+          indexOf = getIndexOf(),
+          length = array.length,
+          isLarge = length >= largeArraySize && lodash.indexOf != indexOf,
+          objCache = {};
+ 
+      var caches = {
+        'false': false,
+        'function': false,
+        'null': false,
+        'number': {},
+        'object': objCache,
+        'string': {},
+        'true': false,
+        'undefined': false
+      };
+ 
+      function basicContains(value) {
+        return indexOf(array, value) > -1;
+      }
+ 
+      function basicPush(value) {
+        array.push(value);
+      }
+ 
+      function cacheContains(value) {
+        var type = typeof value;
+        Iif (type == 'boolean' || value == null) {
+          return caches[value];
+        }
+        var cache = caches[type] || (type = 'object', objCache),
+            key = type == 'number' ? value : keyPrefix + value;
+ 
+        return type == 'object'
+          ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false)
+          : !!cache[key];
+      }
+ 
+      function cachePush(value) {
+        var type = typeof value;
+        Iif (type == 'boolean' || value == null) {
+          caches[value] = true;
+        } else {
+          var cache = caches[type] || (type = 'object', objCache),
+              key = type == 'number' ? value : keyPrefix + value;
+ 
+          if (type == 'object') {
+            bailout = (cache[key] || (cache[key] = [])).push(value) == length;
+          } else {
+            cache[key] = true;
+          }
+        }
+      }
+ 
+      if (isLarge) {
+        while (++index < length) {
+          cachePush(array[index]);
+        }
+        Iif (bailout) {
+          isLarge = caches = objCache = null;
+        }
+      }
+      return isLarge
+        ? { 'contains': cacheContains, 'push': cachePush }
+        : { 'contains': basicContains, 'push': basicPush };
+    }
+ 
+    /**
+     * Creates compiled iteration functions.
+     *
+     * @private
+     * @param {Object} [options1, options2, ...] The compile options object(s).
+     *  arrays - A string of code to determine if the iterable is an array or array-like.
+     *  useHas - A boolean to specify using `hasOwnProperty` checks in the object loop.
+     *  useKeys - A boolean to specify using `_.keys` for own property iteration.
+     *  args - A string of comma separated arguments the iteration function will accept.
+     *  top - A string of code to execute before the iteration branches.
+     *  loop - A string of code to execute in the object loop.
+     *  bottom - A string of code to execute after the iteration branches.
+     * @returns {Function} Returns the compiled function.
+     */
+    function createIterator() {
+      var data = {
+        // data properties
+        'shadowedProps': shadowedProps,
+        'support': support,
+ 
+        // iterator options
+        'arrays': '',
+        'bottom': '',
+        'init': 'iterable',
+        'loop': '',
+        'top': '',
+        'useHas': true,
+        'useKeys': !!keys
+      };
+ 
+      // merge options into a template data object
+      for (var object, index = 0; object = arguments[index]; index++) {
+        for (var key in object) {
+          data[key] = object[key];
+        }
+      }
+      var args = data.args;
+      data.firstArg = /^[^,]+/.exec(args)[0];
+ 
+      // create the function factory
+      var factory = Function(
+          'errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, ' +
+          'keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, ' +
+          'stringProto, toString',
+        'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
+      );
+      // return the compiled function
+      return factory(
+        errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString,
+        keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass,
+        stringProto, toString
+      );
+    }
+ 
+    /**
+     * Creates a new object with the specified `prototype`.
+     *
+     * @private
+     * @param {Object} prototype The prototype object.
+     * @returns {Object} Returns the new object.
+     */
+    function createObject(prototype) {
+      return isObject(prototype) ? nativeCreate(prototype) : {};
+    }
+    // fallback for browsers without `Object.create`
+    Iif  (!nativeCreate) {
+      var createObject = function(prototype) {
+        if (isObject(prototype)) {
+          noop.prototype = prototype;
+          var result = new noop;
+          noop.prototype = null;
+        }
+        return result || {};
+      };
+    }
+ 
+    /**
+     * Used by `escape` to convert characters to HTML entities.
+     *
+     * @private
+     * @param {String} match The matched character to escape.
+     * @returns {String} Returns the escaped character.
+     */
+    function escapeHtmlChar(match) {
+      return htmlEscapes[match];
+    }
+ 
+    /**
+     * Used by `template` to escape characters for inclusion in compiled
+     * string literals.
+     *
+     * @private
+     * @param {String} match The matched character to escape.
+     * @returns {String} Returns the escaped character.
+     */
+    function escapeStringChar(match) {
+      return '\\' + stringEscapes[match];
+    }
+ 
+    /**
+     * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
+     * customized, this method returns the custom method, otherwise it returns
+     * the `basicIndexOf` function.
+     *
+     * @private
+     * @returns {Function} Returns the "indexOf" function.
+     */
+    function getIndexOf(array, value, fromIndex) {
+      var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result;
+      return result;
+    }
+ 
+    /**
+     * Checks if `value` is a DOM node in IE < 9.
+     *
+     * @private
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true` if the `value` is a DOM node, else `false`.
+     */
+    function isNode(value) {
+      // IE < 9 presents DOM nodes as `Object` objects except they have `toString`
+      // methods that are `typeof` "string" and still can coerce nodes to strings
+      return typeof value.toString != 'function' && typeof (value + '') == 'string';
+    }
+ 
+    /**
+     * A fast path for creating `lodash` wrapper objects.
+     *
+     * @private
+     * @param {Mixed} value The value to wrap in a `lodash` instance.
+     * @returns {Object} Returns a `lodash` instance.
+     */
+    function lodashWrapper(value) {
+      this.__wrapped__ = value;
+    }
+    // ensure `new lodashWrapper` is an instance of `lodash`
+    lodashWrapper.prototype = lodash.prototype;
+ 
+    /**
+     * A no-operation function.
+     *
+     * @private
+     */
+    function noop() {
+      // no operation performed
+    }
+ 
+    /**
+     * Creates a function that juggles arguments, allowing argument overloading
+     * for `_.flatten` and `_.uniq`, before passing them to the given `func`.
+     *
+     * @private
+     * @param {Function} func The function to wrap.
+     * @returns {Function} Returns the new function.
+     */
+    function overloadWrapper(func) {
+      return function(array, flag, callback, thisArg) {
+        // juggle arguments
+        if (typeof flag != 'boolean' && flag != null) {
+          thisArg = callback;
+          callback = !(thisArg && thisArg[flag] === array) ? flag : undefined;
+          flag = false;
+        }
+        if (callback != null) {
+          callback = lodash.createCallback(callback, thisArg);
+        }
+        return func(array, flag, callback, thisArg);
+      };
+    }
+ 
+    /**
+     * A fallback implementation of `isPlainObject` which checks if a given `value`
+     * is an object created by the `Object` constructor, assuming objects created
+     * by the `Object` constructor have no inherited enumerable properties and that
+     * there are no `Object.prototype` extensions.
+     *
+     * @private
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`.
+     */
+    function shimIsPlainObject(value) {
+      var ctor,
+          result;
+ 
+      // avoid non Object objects, `arguments` objects, and DOM elements
+      Iif (!(value && toString.call(value) == objectClass) ||
+          (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) ||
+          (!support.argsClass && isArguments(value)) ||
+          (!support.nodeClass && isNode(value))) {
+        return false;
+      }
+      // IE < 9 iterates inherited properties before own properties. If the first
+      // iterated property is an object's own property then there are no inherited
+      // enumerable properties.
+      Iif (support.ownLast) {
+        forIn(value, function(value, key, object) {
+          result = hasOwnProperty.call(object, key);
+          return false;
+        });
+        return result !== false;
+      }
+      // In most environments an object's own properties are iterated before
+      // its inherited properties. If the last iterated property is an object's
+      // own property then there are no inherited enumerable properties.
+      forIn(value, function(value, key) {
+        result = key;
+      });
+      return result === undefined || hasOwnProperty.call(value, result);
+    }
+ 
+    /**
+     * Slices the `collection` from the `start` index up to, but not including,
+     * the `end` index.
+     *
+     * Note: This function is used, instead of `Array#slice`, to support node lists
+     * in IE < 9 and to ensure dense arrays are returned.
+     *
+     * @private
+     * @param {Array|Object|String} collection The collection to slice.
+     * @param {Number} start The start index.
+     * @param {Number} end The end index.
+     * @returns {Array} Returns the new array.
+     */
+    function slice(array, start, end) {
+      start || (start = 0);
+      if (typeof end == 'undefined') {
+        end = array ? array.length : 0;
+      }
+      var index = -1,
+          length = end - start || 0,
+          result = Array(length < 0 ? 0 : length);
+ 
+      while (++index < length) {
+        result[index] = array[start + index];
+      }
+      return result;
+    }
+ 
+    /**
+     * Used by `unescape` to convert HTML entities to characters.
+     *
+     * @private
+     * @param {String} match The matched character to unescape.
+     * @returns {String} Returns the unescaped character.
+     */
+    function unescapeHtmlChar(match) {
+      return htmlUnescapes[match];
+    }
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * Checks if `value` is an `arguments` object.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`.
+     * @example
+     *
+     * (function() { return _.isArguments(arguments); })(1, 2, 3);
+     * // => true
+     *
+     * _.isArguments([1, 2, 3]);
+     * // => false
+     */
+    function isArguments(value) {
+      return toString.call(value) == argsClass;
+    }
+    // fallback for browsers that can't detect `arguments` objects by [[Class]]
+    Iif (!support.argsClass) {
+      isArguments = function(value) {
+        return value ? hasOwnProperty.call(value, 'callee') : false;
+      };
+    }
+ 
+    /**
+     * Checks if `value` is an array.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is an array, else `false`.
+     * @example
+     *
+     * (function() { return _.isArray(arguments); })();
+     * // => false
+     *
+     * _.isArray([1, 2, 3]);
+     * // => true
+     */
+    var isArray = nativeIsArray || function(value) {
+      return value ? (typeof value == 'object' && toString.call(value) == arrayClass) : false;
+    };
+ 
+    /**
+     * A fallback implementation of `Object.keys` which produces an array of the
+     * given object's own enumerable property names.
+     *
+     * @private
+     * @type Function
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns a new array of property names.
+     */
+    var shimKeys = createIterator({
+      'args': 'object',
+      'init': '[]',
+      'top': 'if (!(objectTypes[typeof object])) return result',
+      'loop': 'result.push(index)'
+    });
+ 
+    /**
+     * Creates an array composed of the own enumerable property names of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns a new array of property names.
+     * @example
+     *
+     * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => ['one', 'two', 'three'] (order is not guaranteed)
+     */
+    var keys = !nativeKeys ? shimKeys : function(object) {
+      if (!isObject(object)) {
+        return [];
+      }
+      Iif ((support.enumPrototypes && typeof object == 'function') ||
+          (support.nonEnumArgs && object.length && isArguments(object))) {
+        return shimKeys(object);
+      }
+      return nativeKeys(object);
+    };
+ 
+    /**
+     * A function compiled to iterate `arguments` objects, arrays, objects, and
+     * strings consistenly across environments, executing the `callback` for each
+     * element in the `collection`. The `callback` is bound to `thisArg` and invoked
+     * with three arguments; (value, index|key, collection). Callbacks may exit
+     * iteration early by explicitly returning `false`.
+     *
+     * @private
+     * @type Function
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|String} Returns `collection`.
+     */
+    var basicEach = createIterator(eachIteratorOptions);
+ 
+    /**
+     * Used to convert characters to HTML entities:
+     *
+     * Though the `>` character is escaped for symmetry, characters like `>` and `/`
+     * don't require escaping in HTML and have no special meaning unless they're part
+     * of a tag or an unquoted attribute value.
+     * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
+     */
+    var htmlEscapes = {
+      '&': '&amp;',
+      '<': '&lt;',
+      '>': '&gt;',
+      '"': '&quot;',
+      "'": '&#39;'
+    };
+ 
+    /** Used to convert HTML entities to characters */
+    var htmlUnescapes = invert(htmlEscapes);
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object. Subsequent sources will overwrite property assignments of previous
+     * sources. If a `callback` function is passed, it will be executed to produce
+     * the assigned values. The `callback` is bound to `thisArg` and invoked with
+     * two arguments; (objectValue, sourceValue).
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @alias extend
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {Object} [source1, source2, ...] The source objects.
+     * @param {Function} [callback] The function to customize assigning values.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * _.assign({ 'name': 'moe' }, { 'age': 40 });
+     * // => { 'name': 'moe', 'age': 40 }
+     *
+     * var defaults = _.partialRight(_.assign, function(a, b) {
+     *   return typeof a == 'undefined' ? b : a;
+     * });
+     *
+     * var food = { 'name': 'apple' };
+     * defaults(food, { 'name': 'banana', 'type': 'fruit' });
+     * // => { 'name': 'apple', 'type': 'fruit' }
+     */
+    var assign = createIterator(defaultsIteratorOptions, {
+      'top':
+        defaultsIteratorOptions.top.replace(';',
+          ';\n' +
+          "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
+          '  var callback = lodash.createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
+          "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
+          '  callback = args[--argsLength];\n' +
+          '}'
+        ),
+      'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
+    });
+ 
+    /**
+     * Creates a clone of `value`. If `deep` is `true`, nested objects will also
+     * be cloned, otherwise they will be assigned by reference. If a `callback`
+     * function is passed, it will be executed to produce the cloned values. If
+     * `callback` returns `undefined`, cloning will be handled by the method instead.
+     * The `callback` is bound to `thisArg` and invoked with one argument; (value).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to clone.
+     * @param {Boolean} [deep=false] A flag to indicate a deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @param- {Array} [stackA=[]] Tracks traversed source objects.
+     * @param- {Array} [stackB=[]] Associates clones with source counterparts.
+     * @returns {Mixed} Returns the cloned `value`.
+     * @example
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * var shallow = _.clone(stooges);
+     * shallow[0] === stooges[0];
+     * // => true
+     *
+     * var deep = _.clone(stooges, true);
+     * deep[0] === stooges[0];
+     * // => false
+     *
+     * _.mixin({
+     *   'clone': _.partialRight(_.clone, function(value) {
+     *     return _.isElement(value) ? value.cloneNode(false) : undefined;
+     *   })
+     * });
+     *
+     * var clone = _.clone(document.body);
+     * clone.childNodes.length;
+     * // => 0
+     */
+    function clone(value, deep, callback, thisArg, stackA, stackB) {
+      var result = value;
+ 
+      // allows working with "Collections" methods without using their `callback`
+      // argument, `index|key`, for this method's `callback`
+      if (typeof deep != 'boolean' && deep != null) {
+        thisArg = callback;
+        callback = deep;
+        deep = false;
+      }
+      if (typeof callback == 'function') {
+        callback = (typeof thisArg == 'undefined')
+          ? callback
+          : lodash.createCallback(callback, thisArg, 1);
+ 
+        result = callback(result);
+        if (typeof result != 'undefined') {
+          return result;
+        }
+        result = value;
+      }
+      // inspect [[Class]]
+      var isObj = isObject(result);
+      if (isObj) {
+        var className = toString.call(result);
+        if (!cloneableClasses[className] || (!support.nodeClass && isNode(result))) {
+          return result;
+        }
+        var isArr = isArray(result);
+      }
+      // shallow clone
+      if (!isObj || !deep) {
+        return isObj
+          ? (isArr ? slice(result) : assign({}, result))
+          : result;
+      }
+      var ctor = ctorByClass[className];
+      switch (className) {
+        case boolClass:
+        case dateClass:
+          return new ctor(+result);
+ 
+        case numberClass:
+        case stringClass:
+          return new ctor(result);
+ 
+        case regexpClass:
+          return ctor(result.source, reFlags.exec(result));
+      }
+      // check for circular references and return corresponding clone
+      stackA || (stackA = []);
+      stackB || (stackB = []);
+ 
+      var length = stackA.length;
+      while (length--) {
+        if (stackA[length] == value) {
+          return stackB[length];
+        }
+      }
+      // init cloned object
+      result = isArr ? ctor(result.length) : {};
+ 
+      // add array properties assigned by `RegExp#exec`
+      if (isArr) {
+        if (hasOwnProperty.call(value, 'index')) {
+          result.index = value.index;
+        }
+        if (hasOwnProperty.call(value, 'input')) {
+          result.input = value.input;
+        }
+      }
+      // add the source value to the stack of traversed objects
+      // and associate it with its clone
+      stackA.push(value);
+      stackB.push(result);
+ 
+      // recursively populate clone (susceptible to call stack limits)
+      (isArr ? basicEach : forOwn)(value, function(objValue, key) {
+        result[key] = clone(objValue, deep, callback, undefined, stackA, stackB);
+      });
+ 
+      return result;
+    }
+ 
+    /**
+     * Creates a deep clone of `value`. If a `callback` function is passed,
+     * it will be executed to produce the cloned values. If `callback` returns
+     * `undefined`, cloning will be handled by the method instead. The `callback`
+     * is bound to `thisArg` and invoked with one argument; (value).
+     *
+     * Note: This function is loosely based on the structured clone algorithm. Functions
+     * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and
+     * objects created by constructors other than `Object` are cloned to plain `Object` objects.
+     * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to deep clone.
+     * @param {Function} [callback] The function to customize cloning values.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the deep cloned `value`.
+     * @example
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * var deep = _.cloneDeep(stooges);
+     * deep[0] === stooges[0];
+     * // => false
+     *
+     * var view = {
+     *   'label': 'docs',
+     *   'node': element
+     * };
+     *
+     * var clone = _.cloneDeep(view, function(value) {
+     *   return _.isElement(value) ? value.cloneNode(true) : undefined;
+     * });
+     *
+     * clone.node == view.node;
+     * // => false
+     */
+    function cloneDeep(value, callback, thisArg) {
+      return clone(value, true, callback, thisArg);
+    }
+ 
+    /**
+     * Assigns own enumerable properties of source object(s) to the destination
+     * object for all destination properties that resolve to `undefined`. Once a
+     * property is set, additional defaults of the same property will be ignored.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {Object} [source1, source2, ...] The source objects.
+     * @param- {Object} [guard] Allows working with `_.reduce` without using its
+     *  callback's `key` and `object` arguments as sources.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * var food = { 'name': 'apple' };
+     * _.defaults(food, { 'name': 'banana', 'type': 'fruit' });
+     * // => { 'name': 'apple', 'type': 'fruit' }
+     */
+    var defaults = createIterator(defaultsIteratorOptions);
+ 
+    /**
+     * This method is similar to `_.find`, except that it returns the key of the
+     * element that passes the callback check, instead of the element itself.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to search.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the key of the found element, else `undefined`.
+     * @example
+     *
+     * _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
+     *   return num % 2 == 0;
+     * });
+     * // => 'b'
+     */
+    function findKey(object, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg);
+      forOwn(object, function(value, key, object) {
+        if (callback(value, key, object)) {
+          result = key;
+          return false;
+        }
+      });
+      return result;
+    }
+ 
+    /**
+     * Iterates over `object`'s own and inherited enumerable properties, executing
+     * the `callback` for each property. The `callback` is bound to `thisArg` and
+     * invoked with three arguments; (value, key, object). Callbacks may exit iteration
+     * early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * function Dog(name) {
+     *   this.name = name;
+     * }
+     *
+     * Dog.prototype.bark = function() {
+     *   alert('Woof, woof!');
+     * };
+     *
+     * _.forIn(new Dog('Dagny'), function(value, key) {
+     *   alert(key);
+     * });
+     * // => alerts 'name' and 'bark' (order is not guaranteed)
+     */
+    var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, {
+      'useHas': false
+    });
+ 
+    /**
+     * Iterates over an object's own enumerable properties, executing the `callback`
+     * for each property. The `callback` is bound to `thisArg` and invoked with three
+     * arguments; (value, key, object). Callbacks may exit iteration early by explicitly
+     * returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Objects
+     * @param {Object} object The object to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
+     *   alert(key);
+     * });
+     * // => alerts '0', '1', and 'length' (order is not guaranteed)
+     */
+    var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions);
+ 
+    /**
+     * Creates a sorted array of all enumerable properties, own and inherited,
+     * of `object` that have function values.
+     *
+     * @static
+     * @memberOf _
+     * @alias methods
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns a new array of property names that have function values.
+     * @example
+     *
+     * _.functions(_);
+     * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...]
+     */
+    function functions(object) {
+      var result = [];
+      forIn(object, function(value, key) {
+        if (isFunction(value)) {
+          result.push(key);
+        }
+      });
+      return result.sort();
+    }
+ 
+    /**
+     * Checks if the specified object `property` exists and is a direct property,
+     * instead of an inherited property.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to check.
+     * @param {String} property The property to check for.
+     * @returns {Boolean} Returns `true` if key is a direct property, else `false`.
+     * @example
+     *
+     * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
+     * // => true
+     */
+    function has(object, property) {
+      return object ? hasOwnProperty.call(object, property) : false;
+    }
+ 
+    /**
+     * Creates an object composed of the inverted keys and values of the given `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to invert.
+     * @returns {Object} Returns the created inverted object.
+     * @example
+     *
+     *  _.invert({ 'first': 'moe', 'second': 'larry' });
+     * // => { 'moe': 'first', 'larry': 'second' }
+     */
+    function invert(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = {};
+ 
+      while (++index < length) {
+        var key = props[index];
+        result[object[key]] = key;
+      }
+      return result;
+    }
+ 
+    /**
+     * Checks if `value` is a boolean value.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`.
+     * @example
+     *
+     * _.isBoolean(null);
+     * // => false
+     */
+    function isBoolean(value) {
+      return value === true || value === false || toString.call(value) == boolClass;
+    }
+ 
+    /**
+     * Checks if `value` is a date.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is a date, else `false`.
+     * @example
+     *
+     * _.isDate(new Date);
+     * // => true
+     */
+    function isDate(value) {
+      return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false;
+    }
+ 
+    /**
+     * Checks if `value` is a DOM element.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`.
+     * @example
+     *
+     * _.isElement(document.body);
+     * // => true
+     */
+    function isElement(value) {
+      return value ? value.nodeType === 1 : false;
+    }
+ 
+    /**
+     * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a
+     * length of `0` and objects with no own enumerable properties are considered
+     * "empty".
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Array|Object|String} value The value to inspect.
+     * @returns {Boolean} Returns `true`, if the `value` is empty, else `false`.
+     * @example
+     *
+     * _.isEmpty([1, 2, 3]);
+     * // => false
+     *
+     * _.isEmpty({});
+     * // => true
+     *
+     * _.isEmpty('');
+     * // => true
+     */
+    function isEmpty(value) {
+      var result = true;
+      if (!value) {
+        return result;
+      }
+      var className = toString.call(value),
+          length = value.length;
+ 
+      if ((className == arrayClass || className == stringClass ||
+          (support.argsClass ? className == argsClass : isArguments(value))) ||
+          (className == objectClass && typeof length == 'number' && isFunction(value.splice))) {
+        return !length;
+      }
+      forOwn(value, function() {
+        return (result = false);
+      });
+      return result;
+    }
+ 
+    /**
+     * Performs a deep comparison between two values to determine if they are
+     * equivalent to each other. If `callback` is passed, it will be executed to
+     * compare values. If `callback` returns `undefined`, comparisons will be handled
+     * by the method instead. The `callback` is bound to `thisArg` and invoked with
+     * two arguments; (a, b).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} a The value to compare.
+     * @param {Mixed} b The other value to compare.
+     * @param {Function} [callback] The function to customize comparing values.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @param- {Array} [stackA=[]] Tracks traversed `a` objects.
+     * @param- {Array} [stackB=[]] Tracks traversed `b` objects.
+     * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`.
+     * @example
+     *
+     * var moe = { 'name': 'moe', 'age': 40 };
+     * var copy = { 'name': 'moe', 'age': 40 };
+     *
+     * moe == copy;
+     * // => false
+     *
+     * _.isEqual(moe, copy);
+     * // => true
+     *
+     * var words = ['hello', 'goodbye'];
+     * var otherWords = ['hi', 'goodbye'];
+     *
+     * _.isEqual(words, otherWords, function(a, b) {
+     *   var reGreet = /^(?:hello|hi)$/i,
+     *       aGreet = _.isString(a) && reGreet.test(a),
+     *       bGreet = _.isString(b) && reGreet.test(b);
+     *
+     *   return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;
+     * });
+     * // => true
+     */
+    function isEqual(a, b, callback, thisArg, stackA, stackB) {
+      // used to indicate that when comparing objects, `a` has at least the properties of `b`
+      var whereIndicator = callback === indicatorObject;
+      if (typeof callback == 'function' && !whereIndicator) {
+        callback = lodash.createCallback(callback, thisArg, 2);
+        var result = callback(a, b);
+        if (typeof result != 'undefined') {
+          return !!result;
+        }
+      }
+      // exit early for identical values
+      if (a === b) {
+        // treat `+0` vs. `-0` as not equal
+        return a !== 0 || (1 / a == 1 / b);
+      }
+      var type = typeof a,
+          otherType = typeof b;
+ 
+      // exit early for unlike primitive values
+      if (a === a &&
+          (!a || (type != 'function' && type != 'object')) &&
+          (!b || (otherType != 'function' && otherType != 'object'))) {
+        return false;
+      }
+      // exit early for `null` and `undefined`, avoiding ES3's Function#call behavior
+      // http://es5.github.com/#x15.3.4.4
+      if (a == null || b == null) {
+        return a === b;
+      }
+      // compare [[Class]] names
+      var className = toString.call(a),
+          otherClass = toString.call(b);
+ 
+      if (className == argsClass) {
+        className = objectClass;
+      }
+      if (otherClass == argsClass) {
+        otherClass = objectClass;
+      }
+      Iif (className != otherClass) {
+        return false;
+      }
+      switch (className) {
+        case boolClass:
+        case dateClass:
+          // coerce dates and booleans to numbers, dates to milliseconds and booleans
+          // to `1` or `0`, treating invalid dates coerced to `NaN` as not equal
+          return +a == +b;
+ 
+        case numberClass:
+          // treat `NaN` vs. `NaN` as equal
+          return (a != +a)
+            ? b != +b
+            // but treat `+0` vs. `-0` as not equal
+            : (a == 0 ? (1 / a == 1 / b) : a == +b);
+ 
+        case regexpClass:
+        case stringClass:
+          // coerce regexes to strings (http://es5.github.com/#x15.10.6.4)
+          // treat string primitives and their corresponding object instances as equal
+          return a == String(b);
+      }
+      var isArr = className == arrayClass;
+      if (!isArr) {
+        // unwrap any `lodash` wrapped values
+        Iif (hasOwnProperty.call(a, '__wrapped__ ') || hasOwnProperty.call(b, '__wrapped__')) {
+          return isEqual(a.__wrapped__ || a, b.__wrapped__ || b, callback, thisArg, stackA, stackB);
+        }
+        // exit for functions and DOM nodes
+        Iif (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
+          return false;
+        }
+        // in older versions of Opera, `arguments` objects have `Array` constructors
+        var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
+            ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
+ 
+        // non `Object` object instances with different constructors are not equal
+        if (ctorA != ctorB && !(
+              isFunction(ctorA) && ctorA instanceof ctorA &&
+              isFunction(ctorB) && ctorB instanceof ctorB
+            )) {
+          return false;
+        }
+      }
+      // assume cyclic structures are equal
+      // the algorithm for detecting cyclic structures is adapted from ES 5.1
+      // section 15.12.3, abstract operation `JO` (http://es5.github.com/#x15.12.3)
+      stackA || (stackA = []);
+      stackB || (stackB = []);
+ 
+      var length = stackA.length;
+      while (length--) {
+        if (stackA[length] == a) {
+          return stackB[length] == b;
+        }
+      }
+      var size = 0;
+      result = true;
+ 
+      // add `a` and `b` to the stack of traversed objects
+      stackA.push(a);
+      stackB.push(b);
+ 
+      // recursively compare objects and arrays (susceptible to call stack limits)
+      if (isArr) {
+        length = a.length;
+        size = b.length;
+ 
+        // compare lengths to determine if a deep comparison is necessary
+        result = size == a.length;
+        Iif (!result && !whereIndicator) {
+          return result;
+        }
+        // deep compare the contents, ignoring non-numeric properties
+        while (size--) {
+          var index = length,
+              value = b[size];
+ 
+          if (whereIndicator) {
+            while (index--) {
+              Eif ((result = isEqual(a[index], value, callback, thisArg, stackA, stackB))) {
+                break;
+              }
+            }
+          } else if (!(result = isEqual(a[size], value, callback, thisArg, stackA, stackB))) {
+            break;
+          }
+        }
+        return result;
+      }
+      // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
+      // which, in this case, is more costly
+      forIn(b, function(value, key, b) {
+        Eif (hasOwnProperty.call(b, key)) {
+          // count the number of properties.
+          size++;
+          // deep compare each property value.
+          return (result = hasOwnProperty.call(a, key) && isEqual(a[key], value, callback, thisArg, stackA, stackB));
+        }
+      });
+ 
+      if (result && !whereIndicator) {
+        // ensure both objects have the same number of properties
+        forIn(a, function(value, key, a) {
+          if (hasOwnProperty.call(a, key)) {
+            // `size` will be `-1` if `a` has more properties than `b`
+            return (result = --size > -1);
+          }
+        });
+      }
+      return result;
+    }
+ 
+    /**
+     * Checks if `value` is, or can be coerced to, a finite number.
+     *
+     * Note: This is not the same as native `isFinite`, which will return true for
+     * booleans and empty strings. See http://es5.github.com/#x15.1.2.5.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is finite, else `false`.
+     * @example
+     *
+     * _.isFinite(-101);
+     * // => true
+     *
+     * _.isFinite('10');
+     * // => true
+     *
+     * _.isFinite(true);
+     * // => false
+     *
+     * _.isFinite('');
+     * // => false
+     *
+     * _.isFinite(Infinity);
+     * // => false
+     */
+    function isFinite(value) {
+      return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));
+    }
+ 
+    /**
+     * Checks if `value` is a function.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is a function, else `false`.
+     * @example
+     *
+     * _.isFunction(_);
+     * // => true
+     */
+    function isFunction(value) {
+      return typeof value == 'function';
+    }
+    // fallback for older versions of Chrome and Safari
+    Iif (isFunction(/x/)) {
+      isFunction = function(value) {
+        return typeof value == 'function' && toString.call(value) == funcClass;
+      };
+    }
+ 
+    /**
+     * Checks if `value` is the language type of Object.
+     * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is an object, else `false`.
+     * @example
+     *
+     * _.isObject({});
+     * // => true
+     *
+     * _.isObject([1, 2, 3]);
+     * // => true
+     *
+     * _.isObject(1);
+     * // => false
+     */
+    function isObject(value) {
+      // check if the value is the ECMAScript language type of Object
+      // http://es5.github.com/#x8
+      // and avoid a V8 bug
+      // http://code.google.com/p/v8/issues/detail?id=2291
+      return !!(value && objectTypes[typeof value]);
+    }
+ 
+    /**
+     * Checks if `value` is `NaN`.
+     *
+     * Note: This is not the same as native `isNaN`, which will return `true` for
+     * `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`.
+     * @example
+     *
+     * _.isNaN(NaN);
+     * // => true
+     *
+     * _.isNaN(new Number(NaN));
+     * // => true
+     *
+     * isNaN(undefined);
+     * // => true
+     *
+     * _.isNaN(undefined);
+     * // => false
+     */
+    function isNaN(value) {
+      // `NaN` as a primitive is the only value that is not equal to itself
+      // (perform the [[Class]] check first to avoid errors with some host objects in IE)
+      return isNumber(value) && value != +value
+    }
+ 
+    /**
+     * Checks if `value` is `null`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`.
+     * @example
+     *
+     * _.isNull(null);
+     * // => true
+     *
+     * _.isNull(undefined);
+     * // => false
+     */
+    function isNull(value) {
+      return value === null;
+    }
+ 
+    /**
+     * Checks if `value` is a number.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is a number, else `false`.
+     * @example
+     *
+     * _.isNumber(8.4 * 5);
+     * // => true
+     */
+    function isNumber(value) {
+      return typeof value == 'number' || toString.call(value) == numberClass;
+    }
+ 
+    /**
+     * Checks if a given `value` is an object created by the `Object` constructor.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`.
+     * @example
+     *
+     * function Stooge(name, age) {
+     *   this.name = name;
+     *   this.age = age;
+     * }
+     *
+     * _.isPlainObject(new Stooge('moe', 40));
+     * // => false
+     *
+     * _.isPlainObject([1, 2, 3]);
+     * // => false
+     *
+     * _.isPlainObject({ 'name': 'moe', 'age': 40 });
+     * // => true
+     */
+    var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
+      if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) {
+        return false;
+      }
+      var valueOf = value.valueOf,
+          objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
+ 
+      return objProto
+        ? (value == objProto || getPrototypeOf(value) == objProto)
+        : shimIsPlainObject(value);
+    };
+ 
+    /**
+     * Checks if `value` is a regular expression.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`.
+     * @example
+     *
+     * _.isRegExp(/moe/);
+     * // => true
+     */
+    function isRegExp(value) {
+      return !!(value && objectTypes[typeof value]) && toString.call(value) == regexpClass;
+    }
+ 
+    /**
+     * Checks if `value` is a string.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is a string, else `false`.
+     * @example
+     *
+     * _.isString('moe');
+     * // => true
+     */
+    function isString(value) {
+      return typeof value == 'string' || toString.call(value) == stringClass;
+    }
+ 
+    /**
+     * Checks if `value` is `undefined`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Mixed} value The value to check.
+     * @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`.
+     * @example
+     *
+     * _.isUndefined(void 0);
+     * // => true
+     */
+    function isUndefined(value) {
+      return typeof value == 'undefined';
+    }
+ 
+    /**
+     * Recursively merges own enumerable properties of the source object(s), that
+     * don't resolve to `undefined`, into the destination object. Subsequent sources
+     * will overwrite property assignments of previous sources. If a `callback` function
+     * is passed, it will be executed to produce the merged values of the destination
+     * and source properties. If `callback` returns `undefined`, merging will be
+     * handled by the method instead. The `callback` is bound to `thisArg` and
+     * invoked with two arguments; (objectValue, sourceValue).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The destination object.
+     * @param {Object} [source1, source2, ...] The source objects.
+     * @param {Function} [callback] The function to customize merging properties.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @param- {Object} [deepIndicator] Indicates that `stackA` and `stackB` are
+     *  arrays of traversed objects, instead of source objects.
+     * @param- {Array} [stackA=[]] Tracks traversed source objects.
+     * @param- {Array} [stackB=[]] Associates values with source counterparts.
+     * @returns {Object} Returns the destination object.
+     * @example
+     *
+     * var names = {
+     *   'stooges': [
+     *     { 'name': 'moe' },
+     *     { 'name': 'larry' }
+     *   ]
+     * };
+     *
+     * var ages = {
+     *   'stooges': [
+     *     { 'age': 40 },
+     *     { 'age': 50 }
+     *   ]
+     * };
+     *
+     * _.merge(names, ages);
+     * // => { 'stooges': [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }] }
+     *
+     * var food = {
+     *   'fruits': ['apple'],
+     *   'vegetables': ['beet']
+     * };
+     *
+     * var otherFood = {
+     *   'fruits': ['banana'],
+     *   'vegetables': ['carrot']
+     * };
+     *
+     * _.merge(food, otherFood, function(a, b) {
+     *   return _.isArray(a) ? a.concat(b) : undefined;
+     * });
+     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }
+     */
+    function merge(object, source, deepIndicator) {
+      var args = arguments,
+          index = 0,
+          length = 2;
+ 
+      if (!isObject(object)) {
+        return object;
+      }
+      if (deepIndicator === indicatorObject) {
+        var callback = args[3],
+            stackA = args[4],
+            stackB = args[5];
+      } else {
+        stackA = [];
+        stackB = [];
+ 
+        // allows working with `_.reduce` and `_.reduceRight` without
+        // using their `callback` arguments, `index|key` and `collection`
+        if (typeof deepIndicator != 'number') {
+          length = args.length;
+        }
+        if (length > 3 && typeof args[length - 2] == 'function') {
+          callback = lodash.createCallback(args[--length - 1], args[length--], 2);
+        } else if (length > 2 && typeof args[length - 1] == 'function') {
+          callback = args[--length];
+        }
+      }
+      while (++index < length) {
+        (isArray(args[index]) ? forEach : forOwn)(args[index], function(source, key) {
+          var found,
+              isArr,
+              result = source,
+              value = object[key];
+ 
+          if (source && ((isArr = isArray(source)) || isPlainObject(source))) {
+            // avoid merging previously merged cyclic sources
+            var stackLength = stackA.length;
+            while (stackLength--) {
+              if ((found = stackA[stackLength] == source)) {
+                value = stackB[stackLength];
+                break;
+              }
+            }
+            if (!found) {
+              var isShallow;
+              if (callback) {
+                result = callback(value, source);
+                if ((isShallow = typeof result != 'undefined')) {
+                  value = result;
+                }
+              }
+              if (!isShallow) {
+                value = isArr
+                  ? (isArray(value) ? value : [])
+                  : (isPlainObject(value) ? value : {});
+              }
+              // add `source` and associated `value` to the stack of traversed objects
+              stackA.push(source);
+              stackB.push(value);
+ 
+              // recursively merge objects and arrays (susceptible to call stack limits)
+              if (!isShallow) {
+                value = merge(value, source, indicatorObject, callback, stackA, stackB);
+              }
+            }
+          }
+          else {
+            if (callback) {
+              result = callback(value, source);
+              if (typeof result == 'undefined') {
+                result = source;
+              }
+            }
+            if (typeof result != 'undefined') {
+              value = result;
+            }
+          }
+          object[key] = value;
+        });
+      }
+      return object;
+    }
+ 
+    /**
+     * Creates a shallow clone of `object` excluding the specified properties.
+     * Property names may be specified as individual arguments or as arrays of
+     * property names. If a `callback` function is passed, it will be executed
+     * for each property in the `object`, omitting the properties `callback`
+     * returns truthy for. The `callback` is bound to `thisArg` and invoked
+     * with three arguments; (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The source object.
+     * @param {Function|String} callback|[prop1, prop2, ...] The properties to omit
+     *  or the function called per iteration.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns an object without the omitted properties.
+     * @example
+     *
+     * _.omit({ 'name': 'moe', 'age': 40 }, 'age');
+     * // => { 'name': 'moe' }
+     *
+     * _.omit({ 'name': 'moe', 'age': 40 }, function(value) {
+     *   return typeof value == 'number';
+     * });
+     * // => { 'name': 'moe' }
+     */
+    function omit(object, callback, thisArg) {
+      var indexOf = getIndexOf(),
+          isFunc = typeof callback == 'function',
+          result = {};
+ 
+      if (isFunc) {
+        callback = lodash.createCallback(callback, thisArg);
+      } else {
+        var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1));
+      }
+      forIn(object, function(value, key, object) {
+        if (isFunc
+              ? !callback(value, key, object)
+              : indexOf(props, key) < 0
+            ) {
+          result[key] = value;
+        }
+      });
+      return result;
+    }
+ 
+    /**
+     * Creates a two dimensional array of the given object's key-value pairs,
+     * i.e. `[[key1, value1], [key2, value2]]`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns new array of key-value pairs.
+     * @example
+     *
+     * _.pairs({ 'moe': 30, 'larry': 40 });
+     * // => [['moe', 30], ['larry', 40]] (order is not guaranteed)
+     */
+    function pairs(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+ 
+      while (++index < length) {
+        var key = props[index];
+        result[index] = [key, object[key]];
+      }
+      return result;
+    }
+ 
+    /**
+     * Creates a shallow clone of `object` composed of the specified properties.
+     * Property names may be specified as individual arguments or as arrays of property
+     * names. If `callback` is passed, it will be executed for each property in the
+     * `object`, picking the properties `callback` returns truthy for. The `callback`
+     * is bound to `thisArg` and invoked with three arguments; (value, key, object).
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The source object.
+     * @param {Array|Function|String} callback|[prop1, prop2, ...] The function called
+     *  per iteration or properties to pick, either as individual arguments or arrays.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns an object composed of the picked properties.
+     * @example
+     *
+     * _.pick({ 'name': 'moe', '_userid': 'moe1' }, 'name');
+     * // => { 'name': 'moe' }
+     *
+     * _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) {
+     *   return key.charAt(0) != '_';
+     * });
+     * // => { 'name': 'moe' }
+     */
+    function pick(object, callback, thisArg) {
+      var result = {};
+      if (typeof callback != 'function') {
+        var index = -1,
+            props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
+            length = isObject(object) ? props.length : 0;
+ 
+        while (++index < length) {
+          var key = props[index];
+          if (key in object) {
+            result[key] = object[key];
+          }
+        }
+      } else {
+        callback = lodash.createCallback(callback, thisArg);
+        forIn(object, function(value, key, object) {
+          if (callback(value, key, object)) {
+            result[key] = value;
+          }
+        });
+      }
+      return result;
+    }
+ 
+    /**
+     * Transforms an `object` to a new `accumulator` object which is the result
+     * of running each of its elements through the `callback`, with each `callback`
+     * execution potentially mutating the `accumulator` object. The `callback` is
+     * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object).
+     * Callbacks may exit iteration early by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Array|Object} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {Mixed} [accumulator] The custom accumulator value.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the accumulated value.
+     * @example
+     *
+     * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) {
+     *   num *= num;
+     *   if (num % 2) {
+     *     return result.push(num) < 3;
+     *   }
+     * });
+     * // => [1, 9, 25]
+     *
+     * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+     *   result[key] = num * 3;
+     * });
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     */
+    function transform(object, callback, accumulator, thisArg) {
+      var isArr = isArray(object);
+      callback = lodash.createCallback(callback, thisArg, 4);
+ 
+      Eif (accumulator == null) {
+        if (isArr) {
+          accumulator = [];
+        } else {
+          var ctor = object && object.constructor,
+              proto = ctor && ctor.prototype;
+ 
+          accumulator = createObject(proto);
+        }
+      }
+      (isArr ? basicEach : forOwn)(object, function(value, index, object) {
+        return callback(accumulator, value, index, object);
+      });
+      return accumulator;
+    }
+ 
+    /**
+     * Creates an array composed of the own enumerable property values of `object`.
+     *
+     * @static
+     * @memberOf _
+     * @category Objects
+     * @param {Object} object The object to inspect.
+     * @returns {Array} Returns a new array of property values.
+     * @example
+     *
+     * _.values({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => [1, 2, 3] (order is not guaranteed)
+     */
+    function values(object) {
+      var index = -1,
+          props = keys(object),
+          length = props.length,
+          result = Array(length);
+ 
+      while (++index < length) {
+        result[index] = object[props[index]];
+      }
+      return result;
+    }
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * Creates an array of elements from the specified indexes, or keys, of the
+     * `collection`. Indexes may be specified as individual arguments or as arrays
+     * of indexes.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Array|Number|String} [index1, index2, ...] The indexes of
+     *  `collection` to retrieve, either as individual arguments or arrays.
+     * @returns {Array} Returns a new array of elements corresponding to the
+     *  provided indexes.
+     * @example
+     *
+     * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
+     * // => ['a', 'c', 'e']
+     *
+     * _.at(['moe', 'larry', 'curly'], 0, 2);
+     * // => ['moe', 'curly']
+     */
+    function at(collection) {
+      var index = -1,
+          props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
+          length = props.length,
+          result = Array(length);
+ 
+      Iif (support.unindexedChars && isString(collection)) {
+        collection = collection.split('');
+      }
+      while(++index < length) {
+        result[index] = collection[props[index]];
+      }
+      return result;
+    }
+ 
+    /**
+     * Checks if a given `target` element is present in a `collection` using strict
+     * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
+     * as the offset from the end of the collection.
+     *
+     * @static
+     * @memberOf _
+     * @alias include
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Mixed} target The value to check for.
+     * @param {Number} [fromIndex=0] The index to search from.
+     * @returns {Boolean} Returns `true` if the `target` element is found, else `false`.
+     * @example
+     *
+     * _.contains([1, 2, 3], 1);
+     * // => true
+     *
+     * _.contains([1, 2, 3], 1, 2);
+     * // => false
+     *
+     * _.contains({ 'name': 'moe', 'age': 40 }, 'moe');
+     * // => true
+     *
+     * _.contains('curly', 'ur');
+     * // => true
+     */
+    function contains(collection, target, fromIndex) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = collection ? collection.length : 0,
+          result = false;
+ 
+      fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
+      if (length && typeof length == 'number') {
+        result = (isString(collection)
+          ? collection.indexOf(target, fromIndex)
+          : indexOf(collection, target, fromIndex)
+        ) > -1;
+      } else {
+        basicEach(collection, function(value) {
+          if (++index >= fromIndex) {
+            return !(result = value === target);
+          }
+        });
+      }
+      return result;
+    }
+ 
+    /**
+     * Creates an object composed of keys returned from running each element of the
+     * `collection` through the given `callback`. The corresponding value of each key
+     * is the number of times the key was returned by the `callback`. The `callback`
+     * is bound to `thisArg` and invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+     * // => { '4': 1, '6': 2 }
+     *
+     * _.countBy(['one', 'two', 'three'], 'length');
+     * // => { '3': 2, '5': 1 }
+     */
+    function countBy(collection, callback, thisArg) {
+      var result = {};
+      callback = lodash.createCallback(callback, thisArg);
+ 
+      forEach(collection, function(value, key, collection) {
+        key = String(callback(value, key, collection));
+        (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1);
+      });
+      return result;
+    }
+ 
+    /**
+     * Checks if the `callback` returns a truthy value for **all** elements of a
+     * `collection`. The `callback` is bound to `thisArg` and invoked with three
+     * arguments; (value, index|key, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias all
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Boolean} Returns `true` if all elements pass the callback check,
+     *  else `false`.
+     * @example
+     *
+     * _.every([true, 1, null, 'yes'], Boolean);
+     * // => false
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.every(stooges, 'age');
+     * // => true
+     *
+     * // using "_.where" callback shorthand
+     * _.every(stooges, { 'age': 50 });
+     * // => false
+     */
+    function every(collection, callback, thisArg) {
+      var result = true;
+      callback = lodash.createCallback(callback, thisArg);
+ 
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+ 
+        while (++index < length) {
+          if (!(result = !!callback(collection[index], index, collection))) {
+            break;
+          }
+        }
+      } else {
+        basicEach(collection, function(value, index, collection) {
+          return (result = !!callback(value, index, collection));
+        });
+      }
+      return result;
+    }
+ 
+    /**
+     * Examines each element in a `collection`, returning an array of all elements
+     * the `callback` returns truthy for. The `callback` is bound to `thisArg` and
+     * invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias select
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of elements that passed the callback check.
+     * @example
+     *
+     * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+     * // => [2, 4, 6]
+     *
+     * var food = [
+     *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
+     *   { 'name': 'carrot', 'organic': true,  'type': 'vegetable' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.filter(food, 'organic');
+     * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }]
+     *
+     * // using "_.where" callback shorthand
+     * _.filter(food, { 'type': 'fruit' });
+     * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }]
+     */
+    function filter(collection, callback, thisArg) {
+      var result = [];
+      callback = lodash.createCallback(callback, thisArg);
+ 
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+ 
+        while (++index < length) {
+          var value = collection[index];
+          if (callback(value, index, collection)) {
+            result.push(value);
+          }
+        }
+      } else {
+        basicEach(collection, function(value, index, collection) {
+          if (callback(value, index, collection)) {
+            result.push(value);
+          }
+        });
+      }
+      return result;
+    }
+ 
+    /**
+     * Examines each element in a `collection`, returning the first that the `callback`
+     * returns truthy for. The `callback` is bound to `thisArg` and invoked with three
+     * arguments; (value, index|key, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias detect, findWhere
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the found element, else `undefined`.
+     * @example
+     *
+     * _.find([1, 2, 3, 4], function(num) {
+     *   return num % 2 == 0;
+     * });
+     * // => 2
+     *
+     * var food = [
+     *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
+     *   { 'name': 'banana', 'organic': true,  'type': 'fruit' },
+     *   { 'name': 'beet',   'organic': false, 'type': 'vegetable' }
+     * ];
+     *
+     * // using "_.where" callback shorthand
+     * _.find(food, { 'type': 'vegetable' });
+     * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' }
+     *
+     * // using "_.pluck" callback shorthand
+     * _.find(food, 'organic');
+     * // => { 'name': 'banana', 'organic': true, 'type': 'fruit' }
+     */
+    function find(collection, callback, thisArg) {
+      callback = lodash.createCallback(callback, thisArg);
+ 
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+ 
+        while (++index < length) {
+          var value = collection[index];
+          if (callback(value, index, collection)) {
+            return value;
+          }
+        }
+      } else {
+        var result;
+        basicEach(collection, function(value, index, collection) {
+          if (callback(value, index, collection)) {
+            result = value;
+            return false;
+          }
+        });
+        return result;
+      }
+    }
+ 
+    /**
+     * Iterates over a `collection`, executing the `callback` for each element in
+     * the `collection`. The `callback` is bound to `thisArg` and invoked with three
+     * arguments; (value, index|key, collection). Callbacks may exit iteration early
+     * by explicitly returning `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias each
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array|Object|String} Returns `collection`.
+     * @example
+     *
+     * _([1, 2, 3]).forEach(alert).join(',');
+     * // => alerts each number and returns '1,2,3'
+     *
+     * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
+     * // => alerts each number value (order is not guaranteed)
+     */
+    function forEach(collection, callback, thisArg) {
+      if (callback && typeof thisArg == 'undefined' && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+ 
+        while (++index < length) {
+          if (callback(collection[index], index, collection) === false) {
+            break;
+          }
+        }
+      } else {
+        basicEach(collection, callback, thisArg);
+      }
+      return collection;
+    }
+ 
+    /**
+     * Creates an object composed of keys returned from running each element of the
+     * `collection` through the `callback`. The corresponding value of each key is
+     * an array of elements passed to `callback` that returned the key. The `callback`
+     * is bound to `thisArg` and invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Object} Returns the composed aggregate object.
+     * @example
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
+     * // => { '4': [4.2], '6': [6.1, 6.4] }
+     *
+     * // using "_.pluck" callback shorthand
+     * _.groupBy(['one', 'two', 'three'], 'length');
+     * // => { '3': ['one', 'two'], '5': ['three'] }
+     */
+    function groupBy(collection, callback, thisArg) {
+      var result = {};
+      callback = lodash.createCallback(callback, thisArg);
+ 
+      forEach(collection, function(value, key, collection) {
+        key = String(callback(value, key, collection));
+        (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);
+      });
+      return result;
+    }
+ 
+    /**
+     * Invokes the method named by `methodName` on each element in the `collection`,
+     * returning an array of the results of each invoked method. Additional arguments
+     * will be passed to each invoked method. If `methodName` is a function, it will
+     * be invoked for, and `this` bound to, each element in the `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|String} methodName The name of the method to invoke or
+     *  the function invoked per iteration.
+     * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the method with.
+     * @returns {Array} Returns a new array of the results of each invoked method.
+     * @example
+     *
+     * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
+     * // => [[1, 5, 7], [1, 2, 3]]
+     *
+     * _.invoke([123, 456], String.prototype.split, '');
+     * // => [['1', '2', '3'], ['4', '5', '6']]
+     */
+    function invoke(collection, methodName) {
+      var args = nativeSlice.call(arguments, 2),
+          index = -1,
+          isFunc = typeof methodName == 'function',
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+ 
+      forEach(collection, function(value) {
+        result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
+      });
+      return result;
+    }
+ 
+    /**
+     * Creates an array of values by running each element in the `collection`
+     * through the `callback`. The `callback` is bound to `thisArg` and invoked with
+     * three arguments; (value, index|key, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias collect
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of the results of each `callback` execution.
+     * @example
+     *
+     * _.map([1, 2, 3], function(num) { return num * 3; });
+     * // => [3, 6, 9]
+     *
+     * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
+     * // => [3, 6, 9] (order is not guaranteed)
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.map(stooges, 'name');
+     * // => ['moe', 'larry']
+     */
+    function map(collection, callback, thisArg) {
+      var index = -1,
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+ 
+      callback = lodash.createCallback(callback, thisArg);
+      if (isArray(collection)) {
+        while (++index < length) {
+          result[index] = callback(collection[index], index, collection);
+        }
+      } else {
+        basicEach(collection, function(value, key, collection) {
+          result[++index] = callback(value, key, collection);
+        });
+      }
+      return result;
+    }
+ 
+    /**
+     * Retrieves the maximum value of an `array`. If `callback` is passed,
+     * it will be executed for each value in the `array` to generate the
+     * criterion by which the value is ranked. The `callback` is bound to
+     * `thisArg` and invoked with three arguments; (value, index, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the maximum value.
+     * @example
+     *
+     * _.max([4, 2, 8, 6]);
+     * // => 8
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * _.max(stooges, function(stooge) { return stooge.age; });
+     * // => { 'name': 'larry', 'age': 50 };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.max(stooges, 'age');
+     * // => { 'name': 'larry', 'age': 50 };
+     */
+    function max(collection, callback, thisArg) {
+      var computed = -Infinity,
+          result = computed;
+ 
+      if (!callback && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+ 
+        while (++index < length) {
+          var value = collection[index];
+          if (value > result) {
+            result = value;
+          }
+        }
+      } else {
+        callback = (!callback && isString(collection))
+          ? charAtCallback
+          : lodash.createCallback(callback, thisArg);
+ 
+        basicEach(collection, function(value, index, collection) {
+          var current = callback(value, index, collection);
+          if (current > computed) {
+            computed = current;
+            result = value;
+          }
+        });
+      }
+      return result;
+    }
+ 
+    /**
+     * Retrieves the minimum value of an `array`. If `callback` is passed,
+     * it will be executed for each value in the `array` to generate the
+     * criterion by which the value is ranked. The `callback` is bound to `thisArg`
+     * and invoked with three arguments; (value, index, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the minimum value.
+     * @example
+     *
+     * _.min([4, 2, 8, 6]);
+     * // => 2
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * _.min(stooges, function(stooge) { return stooge.age; });
+     * // => { 'name': 'moe', 'age': 40 };
+     *
+     * // using "_.pluck" callback shorthand
+     * _.min(stooges, 'age');
+     * // => { 'name': 'moe', 'age': 40 };
+     */
+    function min(collection, callback, thisArg) {
+      var computed = Infinity,
+          result = computed;
+ 
+      Iif (!callback && isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+ 
+        while (++index < length) {
+          var value = collection[index];
+          if (value < result) {
+            result = value;
+          }
+        }
+      } else {
+        callback = (!callback && isString(collection))
+          ? charAtCallback
+          : lodash.createCallback(callback, thisArg);
+ 
+        basicEach(collection, function(value, index, collection) {
+          var current = callback(value, index, collection);
+          if (current < computed) {
+            computed = current;
+            result = value;
+          }
+        });
+      }
+      return result;
+    }
+ 
+    /**
+     * Retrieves the value of a specified property from all elements in the `collection`.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {String} property The property to pluck.
+     * @returns {Array} Returns a new array of property values.
+     * @example
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * _.pluck(stooges, 'name');
+     * // => ['moe', 'larry']
+     */
+    var pluck = map;
+ 
+    /**
+     * Reduces a `collection` to a value which is the accumulated result of running
+     * each element in the `collection` through the `callback`, where each successive
+     * `callback` execution consumes the return value of the previous execution.
+     * If `accumulator` is not passed, the first element of the `collection` will be
+     * used as the initial `accumulator` value. The `callback` is bound to `thisArg`
+     * and invoked with four arguments; (accumulator, value, index|key, collection).
+     *
+     * @static
+     * @memberOf _
+     * @alias foldl, inject
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {Mixed} [accumulator] Initial value of the accumulator.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the accumulated value.
+     * @example
+     *
+     * var sum = _.reduce([1, 2, 3], function(sum, num) {
+     *   return sum + num;
+     * });
+     * // => 6
+     *
+     * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
+     *   result[key] = num * 3;
+     *   return result;
+     * }, {});
+     * // => { 'a': 3, 'b': 6, 'c': 9 }
+     */
+    function reduce(collection, callback, accumulator, thisArg) {
+      var noaccum = arguments.length < 3;
+      callback = lodash.createCallback(callback, thisArg, 4);
+ 
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+ 
+        if (noaccum) {
+          accumulator = collection[++index];
+        }
+        while (++index < length) {
+          accumulator = callback(accumulator, collection[index], index, collection);
+        }
+      } else {
+        basicEach(collection, function(value, index, collection) {
+          accumulator = noaccum
+            ? (noaccum = false, value)
+            : callback(accumulator, value, index, collection)
+        });
+      }
+      return accumulator;
+    }
+ 
+    /**
+     * This method is similar to `_.reduce`, except that it iterates over a
+     * `collection` from right to left.
+     *
+     * @static
+     * @memberOf _
+     * @alias foldr
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function} [callback=identity] The function called per iteration.
+     * @param {Mixed} [accumulator] Initial value of the accumulator.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the accumulated value.
+     * @example
+     *
+     * var list = [[0, 1], [2, 3], [4, 5]];
+     * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
+     * // => [4, 5, 2, 3, 0, 1]
+     */
+    function reduceRight(collection, callback, accumulator, thisArg) {
+      var iterable = collection,
+          length = collection ? collection.length : 0,
+          noaccum = arguments.length < 3;
+ 
+      if (typeof length != 'number') {
+        var props = keys(collection);
+        length = props.length;
+      } else Iif (support.unindexedChars && isString(collection)) {
+        iterable = collection.split('');
+      }
+      callback = lodash.createCallback(callback, thisArg, 4);
+      forEach(collection, function(value, index, collection) {
+        index = props ? props[--length] : --length;
+        accumulator = noaccum
+          ? (noaccum = false, iterable[index])
+          : callback(accumulator, iterable[index], index, collection);
+      });
+      return accumulator;
+    }
+ 
+    /**
+     * The opposite of `_.filter`, this method returns the elements of a
+     * `collection` that `callback` does **not** return truthy for.
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of elements that did **not** pass the
+     *  callback check.
+     * @example
+     *
+     * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
+     * // => [1, 3, 5]
+     *
+     * var food = [
+     *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
+     *   { 'name': 'carrot', 'organic': true,  'type': 'vegetable' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.reject(food, 'organic');
+     * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }]
+     *
+     * // using "_.where" callback shorthand
+     * _.reject(food, { 'type': 'fruit' });
+     * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }]
+     */
+    function reject(collection, callback, thisArg) {
+      callback = lodash.createCallback(callback, thisArg);
+      return filter(collection, function(value, index, collection) {
+        return !callback(value, index, collection);
+      });
+    }
+ 
+    /**
+     * Creates an array of shuffled `array` values, using a version of the
+     * Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to shuffle.
+     * @returns {Array} Returns a new shuffled collection.
+     * @example
+     *
+     * _.shuffle([1, 2, 3, 4, 5, 6]);
+     * // => [4, 1, 6, 3, 5, 2]
+     */
+    function shuffle(collection) {
+      var index = -1,
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+ 
+      forEach(collection, function(value) {
+        var rand = floor(nativeRandom() * (++index + 1));
+        result[index] = result[rand];
+        result[rand] = value;
+      });
+      return result;
+    }
+ 
+    /**
+     * Gets the size of the `collection` by returning `collection.length` for arrays
+     * and array-like objects or the number of own enumerable properties for objects.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to inspect.
+     * @returns {Number} Returns `collection.length` or number of own enumerable properties.
+     * @example
+     *
+     * _.size([1, 2]);
+     * // => 2
+     *
+     * _.size({ 'one': 1, 'two': 2, 'three': 3 });
+     * // => 3
+     *
+     * _.size('curly');
+     * // => 5
+     */
+    function size(collection) {
+      var length = collection ? collection.length : 0;
+      return typeof length == 'number' ? length : keys(collection).length;
+    }
+ 
+    /**
+     * Checks if the `callback` returns a truthy value for **any** element of a
+     * `collection`. The function returns as soon as it finds passing value, and
+     * does not iterate over the entire `collection`. The `callback` is bound to
+     * `thisArg` and invoked with three arguments; (value, index|key, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias any
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Boolean} Returns `true` if any element passes the callback check,
+     *  else `false`.
+     * @example
+     *
+     * _.some([null, 0, 'yes', false], Boolean);
+     * // => true
+     *
+     * var food = [
+     *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
+     *   { 'name': 'carrot', 'organic': true,  'type': 'vegetable' }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.some(food, 'organic');
+     * // => true
+     *
+     * // using "_.where" callback shorthand
+     * _.some(food, { 'type': 'meat' });
+     * // => false
+     */
+    function some(collection, callback, thisArg) {
+      var result;
+      callback = lodash.createCallback(callback, thisArg);
+ 
+      if (isArray(collection)) {
+        var index = -1,
+            length = collection.length;
+ 
+        while (++index < length) {
+          if ((result = callback(collection[index], index, collection))) {
+            break;
+          }
+        }
+      } else {
+        basicEach(collection, function(value, index, collection) {
+          return !(result = callback(value, index, collection));
+        });
+      }
+      return !!result;
+    }
+ 
+    /**
+     * Creates an array of elements, sorted in ascending order by the results of
+     * running each element in the `collection` through the `callback`. This method
+     * performs a stable sort, that is, it will preserve the original sort order of
+     * equal elements. The `callback` is bound to `thisArg` and invoked with three
+     * arguments; (value, index|key, collection).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of sorted elements.
+     * @example
+     *
+     * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); });
+     * // => [3, 1, 2]
+     *
+     * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);
+     * // => [3, 1, 2]
+     *
+     * // using "_.pluck" callback shorthand
+     * _.sortBy(['banana', 'strawberry', 'apple'], 'length');
+     * // => ['apple', 'banana', 'strawberry']
+     */
+    function sortBy(collection, callback, thisArg) {
+      var index = -1,
+          length = collection ? collection.length : 0,
+          result = Array(typeof length == 'number' ? length : 0);
+ 
+      callback = lodash.createCallback(callback, thisArg);
+      forEach(collection, function(value, key, collection) {
+        result[++index] = {
+          'criteria': callback(value, key, collection),
+          'index': index,
+          'value': value
+        };
+      });
+ 
+      length = result.length;
+      result.sort(compareAscending);
+      while (length--) {
+        result[length] = result[length].value;
+      }
+      return result;
+    }
+ 
+    /**
+     * Converts the `collection` to an array.
+     *
+     * @static
+     * @memberOf _
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to convert.
+     * @returns {Array} Returns the new converted array.
+     * @example
+     *
+     * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
+     * // => [2, 3, 4]
+     */
+    function toArray(collection) {
+      if (collection && typeof collection.length == 'number') {
+        return (support.unindexedChars && isString(collection))
+          ? collection.split('')
+          : slice(collection);
+      }
+      return values(collection);
+    }
+ 
+    /**
+     * Examines each element in a `collection`, returning an array of all elements
+     * that have the given `properties`. When checking `properties`, this method
+     * performs a deep comparison between values to determine if they are equivalent
+     * to each other.
+     *
+     * @static
+     * @memberOf _
+     * @type Function
+     * @category Collections
+     * @param {Array|Object|String} collection The collection to iterate over.
+     * @param {Object} properties The object of property values to filter by.
+     * @returns {Array} Returns a new array of elements that have the given `properties`.
+     * @example
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * _.where(stooges, { 'age': 40 });
+     * // => [{ 'name': 'moe', 'age': 40 }]
+     */
+    var where = filter;
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * Creates an array with all falsey values of `array` removed. The values
+     * `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to compact.
+     * @returns {Array} Returns a new filtered array.
+     * @example
+     *
+     * _.compact([0, 1, false, 2, '', 3]);
+     * // => [1, 2, 3]
+     */
+    function compact(array) {
+      var index = -1,
+          length = array ? array.length : 0,
+          result = [];
+ 
+      while (++index < length) {
+        var value = array[index];
+        if (value) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+ 
+    /**
+     * Creates an array of `array` elements not present in the other arrays
+     * using strict equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @param {Array} [array1, array2, ...] Arrays to check.
+     * @returns {Array} Returns a new array of `array` elements not present in the
+     *  other arrays.
+     * @example
+     *
+     * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
+     * // => [1, 3, 4]
+     */
+    function difference(array) {
+      var index = -1,
+          length = array ? array.length : 0,
+          flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
+          contains = createCache(flattened).contains,
+          result = [];
+ 
+      while (++index < length) {
+        var value = array[index];
+        if (!contains(value)) {
+          result.push(value);
+        }
+      }
+      return result;
+    }
+ 
+    /**
+     * This method is similar to `_.find`, except that it returns the index of
+     * the element that passes the callback check, instead of the element itself.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the index of the found element, else `-1`.
+     * @example
+     *
+     * _.findIndex(['apple', 'banana', 'beet'], function(food) {
+     *   return /^b/.test(food);
+     * });
+     * // => 1
+     */
+    function findIndex(array, callback, thisArg) {
+      var index = -1,
+          length = array ? array.length : 0;
+ 
+      callback = lodash.createCallback(callback, thisArg);
+      while (++index < length) {
+        if (callback(array[index], index, array)) {
+          return index;
+        }
+      }
+      return -1;
+    }
+ 
+    /**
+     * Gets the first element of the `array`. If a number `n` is passed, the first
+     * `n` elements of the `array` are returned. If a `callback` function is passed,
+     * elements at the beginning of the array are returned as long as the `callback`
+     * returns truthy. The `callback` is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias head, take
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|Number|String} [callback|n] The function called
+     *  per element or the number of elements to return. If a property name or
+     *  object is passed, it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the first element(s) of `array`.
+     * @example
+     *
+     * _.first([1, 2, 3]);
+     * // => 1
+     *
+     * _.first([1, 2, 3], 2);
+     * // => [1, 2]
+     *
+     * _.first([1, 2, 3], function(num) {
+     *   return num < 3;
+     * });
+     * // => [1, 2]
+     *
+     * var food = [
+     *   { 'name': 'banana', 'organic': true },
+     *   { 'name': 'beet',   'organic': false },
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.first(food, 'organic');
+     * // => [{ 'name': 'banana', 'organic': true }]
+     *
+     * var food = [
+     *   { 'name': 'apple',  'type': 'fruit' },
+     *   { 'name': 'banana', 'type': 'fruit' },
+     *   { 'name': 'beet',   'type': 'vegetable' }
+     * ];
+     *
+     * // using "_.where" callback shorthand
+     * _.first(food, { 'type': 'fruit' });
+     * // => [{ 'name': 'apple', 'type': 'fruit' }, { 'name': 'banana', 'type': 'fruit' }]
+     */
+    function first(array, callback, thisArg) {
+      if (array) {
+        var n = 0,
+            length = array.length;
+ 
+        if (typeof callback != 'number' && callback != null) {
+          var index = -1;
+          callback = lodash.createCallback(callback, thisArg);
+          while (++index < length && callback(array[index], index, array)) {
+            n++;
+          }
+        } else {
+          n = callback;
+          if (n == null || thisArg) {
+            return array[0];
+          }
+        }
+        return slice(array, 0, nativeMin(nativeMax(0, n), length));
+      }
+    }
+ 
+    /**
+     * Flattens a nested array (the nesting can be to any depth). If `isShallow`
+     * is truthy, `array` will only be flattened a single level. If `callback`
+     * is passed, each element of `array` is passed through a `callback` before
+     * flattening. The `callback` is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to flatten.
+     * @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new flattened array.
+     * @example
+     *
+     * _.flatten([1, [2], [3, [[4]]]]);
+     * // => [1, 2, 3, 4];
+     *
+     * _.flatten([1, [2], [3, [[4]]]], true);
+     * // => [1, 2, 3, [[4]]];
+     *
+     * var stooges = [
+     *   { 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
+     *   { 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.flatten(stooges, 'quotes');
+     * // => ['Oh, a wise guy, eh?', 'Poifect!', 'Spread out!', 'You knucklehead!']
+     */
+    var flatten = overloadWrapper(function flatten(array, isShallow, callback) {
+      var index = -1,
+          length = array ? array.length : 0,
+          result = [];
+ 
+      while (++index < length) {
+        var value = array[index];
+        if (callback) {
+          value = callback(value, index, array);
+        }
+        // recursively flatten arrays (susceptible to call stack limits)
+        if (isArray(value)) {
+          push.apply(result, isShallow ? value : flatten(value));
+        } else {
+          result.push(value);
+        }
+      }
+      return result;
+    });
+ 
+    /**
+     * Gets the index at which the first occurrence of `value` is found using
+     * strict equality for comparisons, i.e. `===`. If the `array` is already
+     * sorted, passing `true` for `fromIndex` will run a faster binary search.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Mixed} value The value to search for.
+     * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` to
+     *  perform a binary search on a sorted `array`.
+     * @returns {Number} Returns the index of the matched value or `-1`.
+     * @example
+     *
+     * _.indexOf([1, 2, 3, 1, 2, 3], 2);
+     * // => 1
+     *
+     * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
+     * // => 4
+     *
+     * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
+     * // => 2
+     */
+    function indexOf(array, value, fromIndex) {
+      if (typeof fromIndex == 'number') {
+        var length = array ? array.length : 0;
+        fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
+      } else if (fromIndex) {
+        var index = sortedIndex(array, value);
+        return array[index] === value ? index : -1;
+      }
+      return array ? basicIndexOf(array, value, fromIndex) : -1;
+    }
+ 
+    /**
+     * Gets all but the last element of `array`. If a number `n` is passed, the
+     * last `n` elements are excluded from the result. If a `callback` function
+     * is passed, elements at the end of the array are excluded from the result
+     * as long as the `callback` returns truthy. The `callback` is bound to
+     * `thisArg` and invoked with three arguments; (value, index, array).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|Number|String} [callback|n=1] The function called
+     *  per element or the number of elements to exclude. If a property name or
+     *  object is passed, it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a slice of `array`.
+     * @example
+     *
+     * _.initial([1, 2, 3]);
+     * // => [1, 2]
+     *
+     * _.initial([1, 2, 3], 2);
+     * // => [1]
+     *
+     * _.initial([1, 2, 3], function(num) {
+     *   return num > 1;
+     * });
+     * // => [1]
+     *
+     * var food = [
+     *   { 'name': 'beet',   'organic': false },
+     *   { 'name': 'carrot', 'organic': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.initial(food, 'organic');
+     * // => [{ 'name': 'beet',   'organic': false }]
+     *
+     * var food = [
+     *   { 'name': 'banana', 'type': 'fruit' },
+     *   { 'name': 'beet',   'type': 'vegetable' },
+     *   { 'name': 'carrot', 'type': 'vegetable' }
+     * ];
+     *
+     * // using "_.where" callback shorthand
+     * _.initial(food, { 'type': 'vegetable' });
+     * // => [{ 'name': 'banana', 'type': 'fruit' }]
+     */
+    function initial(array, callback, thisArg) {
+      if (!array) {
+        return [];
+      }
+      var n = 0,
+          length = array.length;
+ 
+      if (typeof callback != 'number' && callback != null) {
+        var index = length;
+        callback = lodash.createCallback(callback, thisArg);
+        while (index-- && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = (callback == null || thisArg) ? 1 : callback || n;
+      }
+      return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
+    }
+ 
+    /**
+     * Computes the intersection of all the passed-in arrays using strict equality
+     * for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} [array1, array2, ...] Arrays to process.
+     * @returns {Array} Returns a new array of unique elements that are present
+     *  in **all** of the arrays.
+     * @example
+     *
+     * _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
+     * // => [1, 2]
+     */
+    function intersection(array) {
+      var args = arguments,
+          argsLength = args.length,
+          cache = createCache(),
+          caches = {},
+          index = -1,
+          length = array ? array.length : 0,
+          isLarge = length >= largeArraySize,
+          result = [];
+ 
+      outer:
+      while (++index < length) {
+        var value = array[index];
+        if (!cache.contains(value)) {
+          var argsIndex = argsLength;
+          cache.push(value);
+          while (--argsIndex) {
+            if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) {
+              continue outer;
+            }
+          }
+          result.push(value);
+        }
+      }
+      return result;
+    }
+ 
+    /**
+     * Gets the last element of the `array`. If a number `n` is passed, the
+     * last `n` elements of the `array` are returned. If a `callback` function
+     * is passed, elements at the end of the array are returned as long as the
+     * `callback` returns truthy. The `callback` is bound to `thisArg` and
+     * invoked with three arguments;(value, index, array).
+     *
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|Number|String} [callback|n] The function called
+     *  per element or the number of elements to return. If a property name or
+     *  object is passed, it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Mixed} Returns the last element(s) of `array`.
+     * @example
+     *
+     * _.last([1, 2, 3]);
+     * // => 3
+     *
+     * _.last([1, 2, 3], 2);
+     * // => [2, 3]
+     *
+     * _.last([1, 2, 3], function(num) {
+     *   return num > 1;
+     * });
+     * // => [2, 3]
+     *
+     * var food = [
+     *   { 'name': 'beet',   'organic': false },
+     *   { 'name': 'carrot', 'organic': true }
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.last(food, 'organic');
+     * // => [{ 'name': 'carrot', 'organic': true }]
+     *
+     * var food = [
+     *   { 'name': 'banana', 'type': 'fruit' },
+     *   { 'name': 'beet',   'type': 'vegetable' },
+     *   { 'name': 'carrot', 'type': 'vegetable' }
+     * ];
+     *
+     * // using "_.where" callback shorthand
+     * _.last(food, { 'type': 'vegetable' });
+     * // => [{ 'name': 'beet', 'type': 'vegetable' }, { 'name': 'carrot', 'type': 'vegetable' }]
+     */
+    function last(array, callback, thisArg) {
+      if (array) {
+        var n = 0,
+            length = array.length;
+ 
+        if (typeof callback != 'number' && callback != null) {
+          var index = length;
+          callback = lodash.createCallback(callback, thisArg);
+          while (index-- && callback(array[index], index, array)) {
+            n++;
+          }
+        } else {
+          n = callback;
+          if (n == null || thisArg) {
+            return array[length - 1];
+          }
+        }
+        return slice(array, nativeMax(0, length - n));
+      }
+    }
+ 
+    /**
+     * Gets the index at which the last occurrence of `value` is found using strict
+     * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
+     * as the offset from the end of the collection.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to search.
+     * @param {Mixed} value The value to search for.
+     * @param {Number} [fromIndex=array.length-1] The index to search from.
+     * @returns {Number} Returns the index of the matched value or `-1`.
+     * @example
+     *
+     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
+     * // => 4
+     *
+     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
+     * // => 1
+     */
+    function lastIndexOf(array, value, fromIndex) {
+      var index = array ? array.length : 0;
+      if (typeof fromIndex == 'number') {
+        index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;
+      }
+      while (index--) {
+        if (array[index] === value) {
+          return index;
+        }
+      }
+      return -1;
+    }
+ 
+    /**
+     * Creates an array of numbers (positive and/or negative) progressing from
+     * `start` up to but not including `end`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Number} [start=0] The start of the range.
+     * @param {Number} end The end of the range.
+     * @param {Number} [step=1] The value to increment or decrement by.
+     * @returns {Array} Returns a new range array.
+     * @example
+     *
+     * _.range(10);
+     * // => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+     *
+     * _.range(1, 11);
+     * // => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+     *
+     * _.range(0, 30, 5);
+     * // => [0, 5, 10, 15, 20, 25]
+     *
+     * _.range(0, -10, -1);
+     * // => [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
+     *
+     * _.range(0);
+     * // => []
+     */
+    function range(start, end, step) {
+      start = +start || 0;
+      step = +step || 1;
+ 
+      if (end == null) {
+        end = start;
+        start = 0;
+      }
+      // use `Array(length)` so V8 will avoid the slower "dictionary" mode
+      // http://youtu.be/XAqIpGU8ZZk#t=17m25s
+      var index = -1,
+          length = nativeMax(0, ceil((end - start) / step)),
+          result = Array(length);
+ 
+      while (++index < length) {
+        result[index] = start;
+        start += step;
+      }
+      return result;
+    }
+ 
+    /**
+     * The opposite of `_.initial`, this method gets all but the first value of
+     * `array`. If a number `n` is passed, the first `n` values are excluded from
+     * the result. If a `callback` function is passed, elements at the beginning
+     * of the array are excluded from the result as long as the `callback` returns
+     * truthy. The `callback` is bound to `thisArg` and invoked with three
+     * arguments; (value, index, array).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias drop, tail
+     * @category Arrays
+     * @param {Array} array The array to query.
+     * @param {Function|Object|Number|String} [callback|n=1] The function called
+     *  per element or the number of elements to exclude. If a property name or
+     *  object is passed, it will be used to create a "_.pluck" or "_.where"
+     *  style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a slice of `array`.
+     * @example
+     *
+     * _.rest([1, 2, 3]);
+     * // => [2, 3]
+     *
+     * _.rest([1, 2, 3], 2);
+     * // => [3]
+     *
+     * _.rest([1, 2, 3], function(num) {
+     *   return num < 3;
+     * });
+     * // => [3]
+     *
+     * var food = [
+     *   { 'name': 'banana', 'organic': true },
+     *   { 'name': 'beet',   'organic': false },
+     * ];
+     *
+     * // using "_.pluck" callback shorthand
+     * _.rest(food, 'organic');
+     * // => [{ 'name': 'beet', 'organic': false }]
+     *
+     * var food = [
+     *   { 'name': 'apple',  'type': 'fruit' },
+     *   { 'name': 'banana', 'type': 'fruit' },
+     *   { 'name': 'beet',   'type': 'vegetable' }
+     * ];
+     *
+     * // using "_.where" callback shorthand
+     * _.rest(food, { 'type': 'fruit' });
+     * // => [{ 'name': 'beet', 'type': 'vegetable' }]
+     */
+    function rest(array, callback, thisArg) {
+      if (typeof callback != 'number' && callback != null) {
+        var n = 0,
+            index = -1,
+            length = array ? array.length : 0;
+ 
+        callback = lodash.createCallback(callback, thisArg);
+        while (++index < length && callback(array[index], index, array)) {
+          n++;
+        }
+      } else {
+        n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
+      }
+      return slice(array, n);
+    }
+ 
+    /**
+     * Uses a binary search to determine the smallest index at which the `value`
+     * should be inserted into `array` in order to maintain the sort order of the
+     * sorted `array`. If `callback` is passed, it will be executed for `value` and
+     * each element in `array` to compute their sort ranking. The `callback` is
+     * bound to `thisArg` and invoked with one argument; (value).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to inspect.
+     * @param {Mixed} value The value to evaluate.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Number} Returns the index at which the value should be inserted
+     *  into `array`.
+     * @example
+     *
+     * _.sortedIndex([20, 30, 50], 40);
+     * // => 2
+     *
+     * // using "_.pluck" callback shorthand
+     * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
+     * // => 2
+     *
+     * var dict = {
+     *   'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
+     * };
+     *
+     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+     *   return dict.wordToNumber[word];
+     * });
+     * // => 2
+     *
+     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
+     *   return this.wordToNumber[word];
+     * }, dict);
+     * // => 2
+     */
+    function sortedIndex(array, value, callback, thisArg) {
+      var low = 0,
+          high = array ? array.length : low;
+ 
+      // explicitly reference `identity` for better inlining in Firefox
+      callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity;
+      value = callback(value);
+ 
+      while (low < high) {
+        var mid = (low + high) >>> 1;
+        (callback(array[mid]) < value)
+          ? low = mid + 1
+          : high = mid;
+      }
+      return low;
+    }
+ 
+    /**
+     * Computes the union of the passed-in arrays using strict equality for
+     * comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} [array1, array2, ...] Arrays to process.
+     * @returns {Array} Returns a new array of unique values, in order, that are
+     *  present in one or more of the arrays.
+     * @example
+     *
+     * _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
+     * // => [1, 2, 3, 101, 10]
+     */
+    function union(array) {
+      Eif (!isArray(array)) {
+        arguments[0] = array ? nativeSlice.call(array) : arrayProto;
+      }
+      return uniq(concat.apply(arrayProto, arguments));
+    }
+ 
+    /**
+     * Creates a duplicate-value-free version of the `array` using strict equality
+     * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true`
+     * for `isSorted` will run a faster algorithm. If `callback` is passed, each
+     * element of `array` is passed through the `callback` before uniqueness is computed.
+     * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array).
+     *
+     * If a property name is passed for `callback`, the created "_.pluck" style
+     * callback will return the property value of the given element.
+     *
+     * If an object is passed for `callback`, the created "_.where" style callback
+     * will return `true` for elements that have the properties of the given object,
+     * else `false`.
+     *
+     * @static
+     * @memberOf _
+     * @alias unique
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted.
+     * @param {Function|Object|String} [callback=identity] The function called per
+     *  iteration. If a property name or object is passed, it will be used to create
+     *  a "_.pluck" or "_.where" style callback, respectively.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a duplicate-value-free array.
+     * @example
+     *
+     * _.uniq([1, 2, 1, 3, 1]);
+     * // => [1, 2, 3]
+     *
+     * _.uniq([1, 1, 2, 2, 3], true);
+     * // => [1, 2, 3]
+     *
+     * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });
+     * // => ['A', 'b', 'C']
+     *
+     * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
+     * // => [1, 2.5, 3]
+     *
+     * // using "_.pluck" callback shorthand
+     * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
+     * // => [{ 'x': 1 }, { 'x': 2 }]
+     */
+    var uniq = overloadWrapper(function(array, isSorted, callback) {
+      var index = -1,
+          indexOf = getIndexOf(),
+          length = array ? array.length : 0,
+          isLarge = !isSorted && length >= largeArraySize,
+          result = [],
+          seen = isLarge ? createCache() : (callback ? [] : result);
+ 
+      while (++index < length) {
+        var value = array[index],
+            computed = callback ? callback(value, index, array) : value;
+ 
+        if (isSorted
+              ? !index || seen[seen.length - 1] !== computed
+              : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0)
+            ) {
+          if (callback || isLarge) {
+            seen.push(computed);
+          }
+          result.push(value);
+        }
+      }
+      return result;
+    });
+ 
+    /**
+     * The inverse of `_.zip`, this method splits groups of elements into arrays
+     * composed of elements from each group at their corresponding indexes.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to process.
+     * @returns {Array} Returns a new array of the composed arrays.
+     * @example
+     *
+     * _.unzip([['moe', 30, true], ['larry', 40, false]]);
+     * // => [['moe', 'larry'], [30, 40], [true, false]];
+     */
+    function unzip(array) {
+      var index = -1,
+          length = array ? max(pluck(array, 'length')) : 0,
+          result = Array(length < 0 ? 0 : length);
+ 
+      while (++index < length) {
+        result[index] = pluck(array, index);
+      }
+      return result;
+    }
+ 
+    /**
+     * Creates an array with all occurrences of the passed values removed using
+     * strict equality for comparisons, i.e. `===`.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} array The array to filter.
+     * @param {Mixed} [value1, value2, ...] Values to remove.
+     * @returns {Array} Returns a new filtered array.
+     * @example
+     *
+     * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
+     * // => [2, 3, 4]
+     */
+    function without(array) {
+      return difference(array, nativeSlice.call(arguments, 1));
+    }
+ 
+    /**
+     * Groups the elements of each array at their corresponding indexes. Useful for
+     * separate data sources that are coordinated through matching array indexes.
+     * For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix
+     * in a similar fashion.
+     *
+     * @static
+     * @memberOf _
+     * @category Arrays
+     * @param {Array} [array1, array2, ...] Arrays to process.
+     * @returns {Array} Returns a new array of grouped elements.
+     * @example
+     *
+     * _.zip(['moe', 'larry'], [30, 40], [true, false]);
+     * // => [['moe', 30, true], ['larry', 40, false]]
+     */
+    function zip(array) {
+      return array ? unzip(arguments) : [];
+    }
+ 
+    /**
+     * Creates an object composed from arrays of `keys` and `values`. Pass either
+     * a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or
+     * two arrays, one of `keys` and one of corresponding `values`.
+     *
+     * @static
+     * @memberOf _
+     * @alias object
+     * @category Arrays
+     * @param {Array} keys The array of keys.
+     * @param {Array} [values=[]] The array of values.
+     * @returns {Object} Returns an object composed of the given keys and
+     *  corresponding values.
+     * @example
+     *
+     * _.zipObject(['moe', 'larry'], [30, 40]);
+     * // => { 'moe': 30, 'larry': 40 }
+     */
+    function zipObject(keys, values) {
+      var index = -1,
+          length = keys ? keys.length : 0,
+          result = {};
+ 
+      while (++index < length) {
+        var key = keys[index];
+        if (values) {
+          result[key] = values[index];
+        } else {
+          result[key[0]] = key[1];
+        }
+      }
+      return result;
+    }
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * If `n` is greater than `0`, a function is created that is restricted to
+     * executing `func`, with the `this` binding and arguments of the created
+     * function, only after it is called `n` times. If `n` is less than `1`,
+     * `func` is executed immediately, without a `this` binding or additional
+     * arguments, and its result is returned.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Number} n The number of times the function must be called before
+     * it is executed.
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var renderNotes = _.after(notes.length, render);
+     * _.forEach(notes, function(note) {
+     *   note.asyncSave({ 'success': renderNotes });
+     * });
+     * // `renderNotes` is run once, after all notes have saved
+     */
+    function after(n, func) {
+      if (n < 1) {
+        return func();
+      }
+      return function() {
+        if (--n < 1) {
+          return func.apply(this, arguments);
+        }
+      };
+    }
+ 
+    /**
+     * Creates a function that, when called, invokes `func` with the `this`
+     * binding of `thisArg` and prepends any additional `bind` arguments to those
+     * passed to the bound function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to bind.
+     * @param {Mixed} [thisArg] The `this` binding of `func`.
+     * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var func = function(greeting) {
+     *   return greeting + ' ' + this.name;
+     * };
+     *
+     * func = _.bind(func, { 'name': 'moe' }, 'hi');
+     * func();
+     * // => 'hi moe'
+     */
+    function bind(func, thisArg) {
+      // use `Function#bind` if it exists and is fast
+      // (in V8 `Function#bind` is slower except when partially applied)
+      return support.fastBind || (nativeBind && arguments.length > 2)
+        ? nativeBind.call.apply(nativeBind, arguments)
+        : createBound(func, thisArg, nativeSlice.call(arguments, 2));
+    }
+ 
+    /**
+     * Binds methods on `object` to `object`, overwriting the existing method.
+     * Method names may be specified as individual arguments or as arrays of method
+     * names. If no method names are provided, all the function properties of `object`
+     * will be bound.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Object} object The object to bind and assign the bound methods to.
+     * @param {String} [methodName1, methodName2, ...] Method names on the object to bind.
+     * @returns {Object} Returns `object`.
+     * @example
+     *
+     * var view = {
+     *  'label': 'docs',
+     *  'onClick': function() { alert('clicked ' + this.label); }
+     * };
+     *
+     * _.bindAll(view);
+     * jQuery('#docs').on('click', view.onClick);
+     * // => alerts 'clicked docs', when the button is clicked
+     */
+    function bindAll(object) {
+      var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object),
+          index = -1,
+          length = funcs.length;
+ 
+      while (++index < length) {
+        var key = funcs[index];
+        object[key] = bind(object[key], object);
+      }
+      return object;
+    }
+ 
+    /**
+     * Creates a function that, when called, invokes the method at `object[key]`
+     * and prepends any additional `bindKey` arguments to those passed to the bound
+     * function. This method differs from `_.bind` by allowing bound functions to
+     * reference methods that will be redefined or don't yet exist.
+     * See http://michaux.ca/articles/lazy-function-definition-pattern.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Object} object The object the method belongs to.
+     * @param {String} key The key of the method.
+     * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
+     * @returns {Function} Returns the new bound function.
+     * @example
+     *
+     * var object = {
+     *   'name': 'moe',
+     *   'greet': function(greeting) {
+     *     return greeting + ' ' + this.name;
+     *   }
+     * };
+     *
+     * var func = _.bindKey(object, 'greet', 'hi');
+     * func();
+     * // => 'hi moe'
+     *
+     * object.greet = function(greeting) {
+     *   return greeting + ', ' + this.name + '!';
+     * };
+     *
+     * func();
+     * // => 'hi, moe!'
+     */
+    function bindKey(object, key) {
+      return createBound(object, key, nativeSlice.call(arguments, 2), indicatorObject);
+    }
+ 
+    /**
+     * Creates a function that is the composition of the passed functions,
+     * where each function consumes the return value of the function that follows.
+     * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
+     * Each function is executed with the `this` binding of the composed function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} [func1, func2, ...] Functions to compose.
+     * @returns {Function} Returns the new composed function.
+     * @example
+     *
+     * var greet = function(name) { return 'hi ' + name; };
+     * var exclaim = function(statement) { return statement + '!'; };
+     * var welcome = _.compose(exclaim, greet);
+     * welcome('moe');
+     * // => 'hi moe!'
+     */
+    function compose() {
+      var funcs = arguments;
+      return function() {
+        var args = arguments,
+            length = funcs.length;
+ 
+        while (length--) {
+          args = [funcs[length].apply(this, args)];
+        }
+        return args[0];
+      };
+    }
+ 
+    /**
+     * Produces a callback bound to an optional `thisArg`. If `func` is a property
+     * name, the created callback will return the property value for a given element.
+     * If `func` is an object, the created callback will return `true` for elements
+     * that contain the equivalent object properties, otherwise it will return `false`.
+     *
+     * Note: All Lo-Dash methods, that accept a `callback` argument, use `_.createCallback`.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Mixed} [func=identity] The value to convert to a callback.
+     * @param {Mixed} [thisArg] The `this` binding of the created callback.
+     * @param {Number} [argCount=3] The number of arguments the callback accepts.
+     * @returns {Function} Returns a callback function.
+     * @example
+     *
+     * var stooges = [
+     *   { 'name': 'moe', 'age': 40 },
+     *   { 'name': 'larry', 'age': 50 }
+     * ];
+     *
+     * // wrap to create custom callback shorthands
+     * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {
+     *   var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
+     *   return !match ? func(callback, thisArg) : function(object) {
+     *     return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
+     *   };
+     * });
+     *
+     * _.filter(stooges, 'age__gt45');
+     * // => [{ 'name': 'larry', 'age': 50 }]
+     *
+     * // create mixins with support for "_.pluck" and "_.where" callback shorthands
+     * _.mixin({
+     *   'toLookup': function(collection, callback, thisArg) {
+     *     callback = _.createCallback(callback, thisArg);
+     *     return _.reduce(collection, function(result, value, index, collection) {
+     *       return (result[callback(value, index, collection)] = value, result);
+     *     }, {});
+     *   }
+     * });
+     *
+     * _.toLookup(stooges, 'name');
+     * // => { 'moe': { 'name': 'moe', 'age': 40 }, 'larry': { 'name': 'larry', 'age': 50 } }
+     */
+    function createCallback(func, thisArg, argCount) {
+      if (func == null) {
+        return identity;
+      }
+      var type = typeof func;
+      if (type != 'function') {
+        if (type != 'object') {
+          return function(object) {
+            return object[func];
+          };
+        }
+        var props = keys(func);
+        return function(object) {
+          var length = props.length,
+              result = false;
+          while (length--) {
+            if (!(result = isEqual(object[props[length]], func[props[length]], indicatorObject))) {
+              break;
+            }
+          }
+          return result;
+        };
+      }
+      if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) {
+        return func;
+      }
+      if (argCount === 1) {
+        return function(value) {
+          return func.call(thisArg, value);
+        };
+      }
+      if (argCount === 2) {
+        return function(a, b) {
+          return func.call(thisArg, a, b);
+        };
+      }
+      if (argCount === 4) {
+        return function(accumulator, value, index, collection) {
+          return func.call(thisArg, accumulator, value, index, collection);
+        };
+      }
+      return function(value, index, collection) {
+        return func.call(thisArg, value, index, collection);
+      };
+    }
+ 
+    /**
+     * Creates a function that will delay the execution of `func` until after
+     * `wait` milliseconds have elapsed since the last time it was invoked. Pass
+     * an `options` object to indicate that `func` should be invoked on the leading
+     * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced
+     * function will return the result of the last `func` call.
+     *
+     * Note: If `leading` and `trailing` options are `true`, `func` will be called
+     * on the trailing edge of the timeout only if the the debounced function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to debounce.
+     * @param {Number} wait The number of milliseconds to delay.
+     * @param {Object} options The options object.
+     *  [leading=false] A boolean to specify execution on the leading edge of the timeout.
+     *  [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
+     * @returns {Function} Returns the new debounced function.
+     * @example
+     *
+     * var lazyLayout = _.debounce(calculateLayout, 300);
+     * jQuery(window).on('resize', lazyLayout);
+     *
+     * jQuery('#postbox').on('click', _.debounce(sendMail, 200, {
+     *   'leading': true,
+     *   'trailing': false
+     * });
+     */
+    function debounce(func, wait, options) {
+      var args,
+          result,
+          thisArg,
+          callCount = 0,
+          timeoutId = null,
+          trailing = true;
+ 
+      function delayed() {
+        var isCalled = trailing && (!leading || callCount > 1);
+        callCount = timeoutId = 0;
+        if (isCalled) {
+          result = func.apply(thisArg, args);
+        }
+      }
+      if (options === true) {
+        var leading = true;
+        trailing = false;
+      } else if (isObject(options)) {
+        leading = options.leading;
+        trailing = 'trailing' in options ? options.trailing : trailing;
+      }
+      return function() {
+        args = arguments;
+        thisArg = this;
+ 
+        // avoid issues with Titanium and `undefined` timeout ids
+        // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192
+        clearTimeout(timeoutId);
+ 
+        if (leading && ++callCount < 2) {
+          result = func.apply(thisArg, args);
+        }
+        timeoutId = setTimeout(delayed, wait);
+        return result;
+      };
+    }
+ 
+    /**
+     * Defers executing the `func` function until the current call stack has cleared.
+     * Additional arguments will be passed to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to defer.
+     * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the function with.
+     * @returns {Number} Returns the timer id.
+     * @example
+     *
+     * _.defer(function() { alert('deferred'); });
+     * // returns from the function before `alert` is called
+     */
+    function defer(func) {
+      var args = nativeSlice.call(arguments, 1);
+      return setTimeout(function() { func.apply(undefined, args); }, 1);
+    }
+    // use `setImmediate` if it's available in Node.js
+    Eif (isV8 && freeModule && typeof setImmediate == 'function') {
+      defer = bind(setImmediate, context);
+    }
+ 
+    /**
+     * Executes the `func` function after `wait` milliseconds. Additional arguments
+     * will be passed to `func` when it is invoked.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to delay.
+     * @param {Number} wait The number of milliseconds to delay execution.
+     * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the function with.
+     * @returns {Number} Returns the timer id.
+     * @example
+     *
+     * var log = _.bind(console.log, console);
+     * _.delay(log, 1000, 'logged later');
+     * // => 'logged later' (Appears after one second.)
+     */
+    function delay(func, wait) {
+      var args = nativeSlice.call(arguments, 2);
+      return setTimeout(function() { func.apply(undefined, args); }, wait);
+    }
+ 
+    /**
+     * Creates a function that memoizes the result of `func`. If `resolver` is
+     * passed, it will be used to determine the cache key for storing the result
+     * based on the arguments passed to the memoized function. By default, the first
+     * argument passed to the memoized function is used as the cache key. The `func`
+     * is executed with the `this` binding of the memoized function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to have its output memoized.
+     * @param {Function} [resolver] A function used to resolve the cache key.
+     * @returns {Function} Returns the new memoizing function.
+     * @example
+     *
+     * var fibonacci = _.memoize(function(n) {
+     *   return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
+     * });
+     */
+    function memoize(func, resolver) {
+      function memoized() {
+        var cache = memoized.cache,
+            key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
+ 
+        return hasOwnProperty.call(cache, key)
+          ? cache[key]
+          : (cache[key] = func.apply(this, arguments));
+      }
+      memoized.cache = {};
+      return memoized;
+    }
+ 
+    /**
+     * Creates a function that is restricted to execute `func` once. Repeat calls to
+     * the function will return the value of the first call. The `func` is executed
+     * with the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to restrict.
+     * @returns {Function} Returns the new restricted function.
+     * @example
+     *
+     * var initialize = _.once(createApplication);
+     * initialize();
+     * initialize();
+     * // `initialize` executes `createApplication` once
+     */
+    function once(func) {
+      var ran,
+          result;
+ 
+      return function() {
+        if (ran) {
+          return result;
+        }
+        ran = true;
+        result = func.apply(this, arguments);
+ 
+        // clear the `func` variable so the function may be garbage collected
+        func = null;
+        return result;
+      };
+    }
+ 
+    /**
+     * Creates a function that, when called, invokes `func` with any additional
+     * `partial` arguments prepended to those passed to the new function. This
+     * method is similar to `_.bind`, except it does **not** alter the `this` binding.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var greet = function(greeting, name) { return greeting + ' ' + name; };
+     * var hi = _.partial(greet, 'hi');
+     * hi('moe');
+     * // => 'hi moe'
+     */
+    function partial(func) {
+      return createBound(func, nativeSlice.call(arguments, 1));
+    }
+ 
+    /**
+     * This method is similar to `_.partial`, except that `partial` arguments are
+     * appended to those passed to the new function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to partially apply arguments to.
+     * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
+     * @returns {Function} Returns the new partially applied function.
+     * @example
+     *
+     * var defaultsDeep = _.partialRight(_.merge, _.defaults);
+     *
+     * var options = {
+     *   'variable': 'data',
+     *   'imports': { 'jq': $ }
+     * };
+     *
+     * defaultsDeep(options, _.templateSettings);
+     *
+     * options.variable
+     * // => 'data'
+     *
+     * options.imports
+     * // => { '_': _, 'jq': $ }
+     */
+    function partialRight(func) {
+      return createBound(func, nativeSlice.call(arguments, 1), null, indicatorObject);
+    }
+ 
+    /**
+     * Creates a function that, when executed, will only call the `func` function
+     * at most once per every `wait` milliseconds. Pass an `options` object to
+     * indicate that `func` should be invoked on the leading and/or trailing edge
+     * of the `wait` timeout. Subsequent calls to the throttled function will
+     * return the result of the last `func` call.
+     *
+     * Note: If `leading` and `trailing` options are `true`, `func` will be called
+     * on the trailing edge of the timeout only if the the throttled function is
+     * invoked more than once during the `wait` timeout.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Function} func The function to throttle.
+     * @param {Number} wait The number of milliseconds to throttle executions to.
+     * @param {Object} options The options object.
+     *  [leading=true] A boolean to specify execution on the leading edge of the timeout.
+     *  [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
+     * @returns {Function} Returns the new throttled function.
+     * @example
+     *
+     * var throttled = _.throttle(updatePosition, 100);
+     * jQuery(window).on('scroll', throttled);
+     *
+     * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
+     *   'trailing': false
+     * }));
+     */
+    function throttle(func, wait, options) {
+      var args,
+          result,
+          thisArg,
+          lastCalled = 0,
+          leading = true,
+          timeoutId = null,
+          trailing = true;
+ 
+      function trailingCall() {
+        timeoutId = null;
+        if (trailing) {
+          lastCalled = new Date;
+          result = func.apply(thisArg, args);
+        }
+      }
+      if (options === false) {
+        leading = false;
+      } else if (isObject(options)) {
+        leading = 'leading' in options ? options.leading : leading;
+        trailing = 'trailing' in options ? options.trailing : trailing;
+      }
+      return function() {
+        var now = new Date;
+        if (!timeoutId && !leading) {
+          lastCalled = now;
+        }
+        var remaining = wait - (now - lastCalled);
+        args = arguments;
+        thisArg = this;
+ 
+        if (remaining <= 0) {
+          clearTimeout(timeoutId);
+          timeoutId = null;
+          lastCalled = now;
+          result = func.apply(thisArg, args);
+        }
+        else if (!timeoutId) {
+          timeoutId = setTimeout(trailingCall, remaining);
+        }
+        return result;
+      };
+    }
+ 
+    /**
+     * Creates a function that passes `value` to the `wrapper` function as its
+     * first argument. Additional arguments passed to the function are appended
+     * to those passed to the `wrapper` function. The `wrapper` is executed with
+     * the `this` binding of the created function.
+     *
+     * @static
+     * @memberOf _
+     * @category Functions
+     * @param {Mixed} value The value to wrap.
+     * @param {Function} wrapper The wrapper function.
+     * @returns {Function} Returns the new function.
+     * @example
+     *
+     * var hello = function(name) { return 'hello ' + name; };
+     * hello = _.wrap(hello, function(func) {
+     *   return 'before, ' + func('moe') + ', after';
+     * });
+     * hello();
+     * // => 'before, hello moe, after'
+     */
+    function wrap(value, wrapper) {
+      return function() {
+        var args = [value];
+        push.apply(args, arguments);
+        return wrapper.apply(this, args);
+      };
+    }
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
+     * corresponding HTML entities.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {String} string The string to escape.
+     * @returns {String} Returns the escaped string.
+     * @example
+     *
+     * _.escape('Moe, Larry & Curly');
+     * // => 'Moe, Larry &amp; Curly'
+     */
+    function escape(string) {
+      return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
+    }
+ 
+    /**
+     * This function returns the first argument passed to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Mixed} value Any value.
+     * @returns {Mixed} Returns `value`.
+     * @example
+     *
+     * var moe = { 'name': 'moe' };
+     * moe === _.identity(moe);
+     * // => true
+     */
+    function identity(value) {
+      return value;
+    }
+ 
+    /**
+     * Adds functions properties of `object` to the `lodash` function and chainable
+     * wrapper.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Object} object The object of function properties to add to `lodash`.
+     * @example
+     *
+     * _.mixin({
+     *   'capitalize': function(string) {
+     *     return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
+     *   }
+     * });
+     *
+     * _.capitalize('moe');
+     * // => 'Moe'
+     *
+     * _('moe').capitalize();
+     * // => 'Moe'
+     */
+    function mixin(object) {
+      forEach(functions(object), function(methodName) {
+        var func = lodash[methodName] = object[methodName];
+ 
+        lodash.prototype[methodName] = function() {
+          var value = this.__wrapped__,
+              args = [value];
+ 
+          push.apply(args, arguments);
+          var result = func.apply(lodash, args);
+          return (value && typeof value == 'object' && value == result)
+            ? this
+            : new lodashWrapper(result);
+        };
+      });
+    }
+ 
+    /**
+     * Reverts the '_' variable to its previous value and returns a reference to
+     * the `lodash` function.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @returns {Function} Returns the `lodash` function.
+     * @example
+     *
+     * var lodash = _.noConflict();
+     */
+    function noConflict() {
+      context._ = oldDash;
+      return this;
+    }
+ 
+    /**
+     * Converts the given `value` into an integer of the specified `radix`.
+     * If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the
+     * `value` is a hexadecimal, in which case a `radix` of `16` is used.
+     *
+     * Note: This method avoids differences in native ES3 and ES5 `parseInt`
+     * implementations. See http://es5.github.com/#E.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {String} value The value to parse.
+     * @param {Number} [radix] The radix used to interpret the value to parse.
+     * @returns {Number} Returns the new integer value.
+     * @example
+     *
+     * _.parseInt('08');
+     * // => 8
+     */
+    var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) {
+      // Firefox and Opera still follow the ES3 specified implementation of `parseInt`
+      return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0);
+    };
+ 
+    /**
+     * Produces a random number between `min` and `max` (inclusive). If only one
+     * argument is passed, a number between `0` and the given number will be returned.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Number} [min=0] The minimum possible value.
+     * @param {Number} [max=1] The maximum possible value.
+     * @returns {Number} Returns a random number.
+     * @example
+     *
+     * _.random(0, 5);
+     * // => a number between 0 and 5
+     *
+     * _.random(5);
+     * // => also a number between 0 and 5
+     */
+    function random(min, max) {
+      if (min == null && max == null) {
+        max = 1;
+      }
+      min = +min || 0;
+      if (max == null) {
+        max = min;
+        min = 0;
+      } else {
+        max = +max || 0;
+      }
+      var rand = nativeRandom();
+      return (min % 1 || max % 1)
+        ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max)
+        : min + floor(rand * (max - min + 1));
+    }
+ 
+    /**
+     * Resolves the value of `property` on `object`. If `property` is a function,
+     * it will be invoked with the `this` binding of `object` and its result returned,
+     * else the property value is returned. If `object` is falsey, then `undefined`
+     * is returned.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Object} object The object to inspect.
+     * @param {String} property The property to get the value of.
+     * @returns {Mixed} Returns the resolved value.
+     * @example
+     *
+     * var object = {
+     *   'cheese': 'crumpets',
+     *   'stuff': function() {
+     *     return 'nonsense';
+     *   }
+     * };
+     *
+     * _.result(object, 'cheese');
+     * // => 'crumpets'
+     *
+     * _.result(object, 'stuff');
+     * // => 'nonsense'
+     */
+    function result(object, property) {
+      var value = object ? object[property] : undefined;
+      return isFunction(value) ? object[property]() : value;
+    }
+ 
+    /**
+     * A micro-templating method that handles arbitrary delimiters, preserves
+     * whitespace, and correctly escapes quotes within interpolated code.
+     *
+     * Note: In the development build, `_.template` utilizes sourceURLs for easier
+     * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+     *
+     * For more information on precompiling templates see:
+     * http://lodash.com/#custom-builds
+     *
+     * For more information on Chrome extension sandboxes see:
+     * http://developer.chrome.com/stable/extensions/sandboxingEval.html
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {String} text The template text.
+     * @param {Object} data The data object used to populate the text.
+     * @param {Object} options The options object.
+     *  escape - The "escape" delimiter regexp.
+     *  evaluate - The "evaluate" delimiter regexp.
+     *  interpolate - The "interpolate" delimiter regexp.
+     *  sourceURL - The sourceURL of the template's compiled source.
+     *  variable - The data object variable name.
+     * @returns {Function|String} Returns a compiled function when no `data` object
+     *  is given, else it returns the interpolated text.
+     * @example
+     *
+     * // using a compiled template
+     * var compiled = _.template('hello <%= name %>');
+     * compiled({ 'name': 'moe' });
+     * // => 'hello moe'
+     *
+     * var list = '<% _.forEach(people, function(name) { %><li><%= name %></li><% }); %>';
+     * _.template(list, { 'people': ['moe', 'larry'] });
+     * // => '<li>moe</li><li>larry</li>'
+     *
+     * // using the "escape" delimiter to escape HTML in data property values
+     * _.template('<b><%- value %></b>', { 'value': '<script>' });
+     * // => '<b>&lt;script&gt;</b>'
+     *
+     * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
+     * _.template('hello ${ name }', { 'name': 'curly' });
+     * // => 'hello curly'
+     *
+     * // using the internal `print` function in "evaluate" delimiters
+     * _.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
+     * // => 'hello stooge!'
+     *
+     * // using custom template delimiters
+     * _.templateSettings = {
+     *   'interpolate': /{{([\s\S]+?)}}/g
+     * };
+     *
+     * _.template('hello {{ name }}!', { 'name': 'mustache' });
+     * // => 'hello mustache!'
+     *
+     * // using the `sourceURL` option to specify a custom sourceURL for the template
+     * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
+     * compiled(data);
+     * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
+     *
+     * // using the `variable` option to ensure a with-statement isn't used in the compiled template
+     * var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' });
+     * compiled.source;
+     * // => function(data) {
+     *   var __t, __p = '', __e = _.escape;
+     *   __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!';
+     *   return __p;
+     * }
+     *
+     * // using the `source` property to inline compiled templates for meaningful
+     * // line numbers in error messages and a stack trace
+     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
+     *   var JST = {\
+     *     "main": ' + _.template(mainText).source + '\
+     *   };\
+     * ');
+     */
+    function template(text, data, options) {
+      // based on John Resig's `tmpl` implementation
+      // http://ejohn.org/blog/javascript-micro-templating/
+      // and Laura Doktorova's doT.js
+      // https://github.com/olado/doT
+      var settings = lodash.templateSettings;
+      text || (text = '');
+ 
+      // avoid missing dependencies when `iteratorTemplate` is not defined
+      options = iteratorTemplate ? defaults({}, options, settings) : settings;
+ 
+      var imports = iteratorTemplate && defaults({}, options.imports, settings.imports),
+          importsKeys = iteratorTemplate ? keys(imports) : ['_'],
+          importsValues = iteratorTemplate ? values(imports) : [lodash];
+ 
+      var isEvaluating,
+          index = 0,
+          interpolate = options.interpolate || reNoMatch,
+          source = "__p += '";
+ 
+      // compile the regexp to match each delimiter
+      var reDelimiters = RegExp(
+        (options.escape || reNoMatch).source + '|' +
+        interpolate.source + '|' +
+        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
+        (options.evaluate || reNoMatch).source + '|$'
+      , 'g');
+ 
+      text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
+        interpolateValue || (interpolateValue = esTemplateValue);
+ 
+        // escape characters that cannot be included in string literals
+        source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
+ 
+        // replace delimiters with snippets
+        Iif (escapeValue) {
+          source += "' +\n__e(" + escapeValue + ") +\n'";
+        }
+        if (evaluateValue) {
+          isEvaluating = true;
+          source += "';\n" + evaluateValue + ";\n__p += '";
+        }
+        if (interpolateValue) {
+          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
+        }
+        index = offset + match.length;
+ 
+        // the JS engine embedded in Adobe products requires returning the `match`
+        // string in order to produce the correct `offset` value
+        return match;
+      });
+ 
+      source += "';\n";
+ 
+      // if `variable` is not specified, wrap a with-statement around the generated
+      // code to add the data object to the top of the scope chain
+      var variable = options.variable,
+          hasVariable = variable;
+ 
+      if (!hasVariable) {
+        variable = 'obj';
+        source = 'with (' + variable + ') {\n' + source + '\n}\n';
+      }
+      // cleanup code by stripping empty strings
+      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
+        .replace(reEmptyStringMiddle, '$1')
+        .replace(reEmptyStringTrailing, '$1;');
+ 
+      // frame code as the function body
+      source = 'function(' + variable + ') {\n' +
+        (hasVariable ? '' : variable + ' || (' + variable + ' = {});\n') +
+        "var __t, __p = '', __e = _.escape" +
+        (isEvaluating
+          ? ', __j = Array.prototype.join;\n' +
+            "function print() { __p += __j.call(arguments, '') }\n"
+          : ';\n'
+        ) +
+        source +
+        'return __p\n}';
+ 
+      // Use a sourceURL for easier debugging and wrap in a multi-line comment to
+      // avoid issues with Narwhal, IE conditional compilation, and the JS engine
+      // embedded in Adobe products.
+      // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
+      var sourceURL = '\n/*\n//@ sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/';
+ 
+      try {
+        var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues);
+      } catch(e) {
+        e.source = source;
+        throw e;
+      }
+      if (data) {
+        return result(data);
+      }
+      // provide the compiled function's source via its `toString` method, in
+      // supported environments, or the `source` property as a convenience for
+      // inlining compiled templates during the build process
+      result.source = source;
+      return result;
+    }
+ 
+    /**
+     * Executes the `callback` function `n` times, returning an array of the results
+     * of each `callback` execution. The `callback` is bound to `thisArg` and invoked
+     * with one argument; (index).
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {Number} n The number of times to execute the callback.
+     * @param {Function} callback The function called per iteration.
+     * @param {Mixed} [thisArg] The `this` binding of `callback`.
+     * @returns {Array} Returns a new array of the results of each `callback` execution.
+     * @example
+     *
+     * var diceRolls = _.times(3, _.partial(_.random, 1, 6));
+     * // => [3, 6, 4]
+     *
+     * _.times(3, function(n) { mage.castSpell(n); });
+     * // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively
+     *
+     * _.times(3, function(n) { this.cast(n); }, mage);
+     * // => also calls `mage.castSpell(n)` three times
+     */
+    function times(n, callback, thisArg) {
+      n = (n = +n) > -1 ? n : 0;
+      var index = -1,
+          result = Array(n);
+ 
+      callback = lodash.createCallback(callback, thisArg, 1);
+      while (++index < n) {
+        result[index] = callback(index);
+      }
+      return result;
+    }
+ 
+    /**
+     * The inverse of `_.escape`, this method converts the HTML entities
+     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
+     * corresponding characters.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {String} string The string to unescape.
+     * @returns {String} Returns the unescaped string.
+     * @example
+     *
+     * _.unescape('Moe, Larry &amp; Curly');
+     * // => 'Moe, Larry & Curly'
+     */
+    function unescape(string) {
+      return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar);
+    }
+ 
+    /**
+     * Generates a unique ID. If `prefix` is passed, the ID will be appended to it.
+     *
+     * @static
+     * @memberOf _
+     * @category Utilities
+     * @param {String} [prefix] The value to prefix the ID with.
+     * @returns {String} Returns the unique ID.
+     * @example
+     *
+     * _.uniqueId('contact_');
+     * // => 'contact_104'
+     *
+     * _.uniqueId();
+     * // => '105'
+     */
+    function uniqueId(prefix) {
+      var id = ++idCounter;
+      return String(prefix == null ? '' : prefix) + id;
+    }
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * Invokes `interceptor` with the `value` as the first argument, and then
+     * returns `value`. The purpose of this method is to "tap into" a method chain,
+     * in order to perform operations on intermediate results within the chain.
+     *
+     * @static
+     * @memberOf _
+     * @category Chaining
+     * @param {Mixed} value The value to pass to `interceptor`.
+     * @param {Function} interceptor The function to invoke.
+     * @returns {Mixed} Returns `value`.
+     * @example
+     *
+     * _([1, 2, 3, 4])
+     *  .filter(function(num) { return num % 2 == 0; })
+     *  .tap(alert)
+     *  .map(function(num) { return num * num; })
+     *  .value();
+     * // => // [2, 4] (alerted)
+     * // => [4, 16]
+     */
+    function tap(value, interceptor) {
+      interceptor(value);
+      return value;
+    }
+ 
+    /**
+     * Produces the `toString` result of the wrapped value.
+     *
+     * @name toString
+     * @memberOf _
+     * @category Chaining
+     * @returns {String} Returns the string result.
+     * @example
+     *
+     * _([1, 2, 3]).toString();
+     * // => '1,2,3'
+     */
+    function wrapperToString() {
+      return String(this.__wrapped__);
+    }
+ 
+    /**
+     * Extracts the wrapped value.
+     *
+     * @name valueOf
+     * @memberOf _
+     * @alias value
+     * @category Chaining
+     * @returns {Mixed} Returns the wrapped value.
+     * @example
+     *
+     * _([1, 2, 3]).valueOf();
+     * // => [1, 2, 3]
+     */
+    function wrapperValueOf() {
+      return this.__wrapped__;
+    }
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    // add functions that return wrapped values when chaining
+    lodash.after = after;
+    lodash.assign = assign;
+    lodash.at = at;
+    lodash.bind = bind;
+    lodash.bindAll = bindAll;
+    lodash.bindKey = bindKey;
+    lodash.compact = compact;
+    lodash.compose = compose;
+    lodash.countBy = countBy;
+    lodash.createCallback = createCallback;
+    lodash.debounce = debounce;
+    lodash.defaults = defaults;
+    lodash.defer = defer;
+    lodash.delay = delay;
+    lodash.difference = difference;
+    lodash.filter = filter;
+    lodash.flatten = flatten;
+    lodash.forEach = forEach;
+    lodash.forIn = forIn;
+    lodash.forOwn = forOwn;
+    lodash.functions = functions;
+    lodash.groupBy = groupBy;
+    lodash.initial = initial;
+    lodash.intersection = intersection;
+    lodash.invert = invert;
+    lodash.invoke = invoke;
+    lodash.keys = keys;
+    lodash.map = map;
+    lodash.max = max;
+    lodash.memoize = memoize;
+    lodash.merge = merge;
+    lodash.min = min;
+    lodash.omit = omit;
+    lodash.once = once;
+    lodash.pairs = pairs;
+    lodash.partial = partial;
+    lodash.partialRight = partialRight;
+    lodash.pick = pick;
+    lodash.pluck = pluck;
+    lodash.range = range;
+    lodash.reject = reject;
+    lodash.rest = rest;
+    lodash.shuffle = shuffle;
+    lodash.sortBy = sortBy;
+    lodash.tap = tap;
+    lodash.throttle = throttle;
+    lodash.times = times;
+    lodash.toArray = toArray;
+    lodash.transform = transform;
+    lodash.union = union;
+    lodash.uniq = uniq;
+    lodash.unzip = unzip;
+    lodash.values = values;
+    lodash.where = where;
+    lodash.without = without;
+    lodash.wrap = wrap;
+    lodash.zip = zip;
+    lodash.zipObject = zipObject;
+ 
+    // add aliases
+    lodash.collect = map;
+    lodash.drop = rest;
+    lodash.each = forEach;
+    lodash.extend = assign;
+    lodash.methods = functions;
+    lodash.object = zipObject;
+    lodash.select = filter;
+    lodash.tail = rest;
+    lodash.unique = uniq;
+ 
+    // add functions to `lodash.prototype`
+    mixin(lodash);
+ 
+    // add Underscore compat
+    lodash.chain = lodash;
+    lodash.prototype.chain = function() { return this; };
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    // add functions that return unwrapped values when chaining
+    lodash.clone = clone;
+    lodash.cloneDeep = cloneDeep;
+    lodash.contains = contains;
+    lodash.escape = escape;
+    lodash.every = every;
+    lodash.find = find;
+    lodash.findIndex = findIndex;
+    lodash.findKey = findKey;
+    lodash.has = has;
+    lodash.identity = identity;
+    lodash.indexOf = indexOf;
+    lodash.isArguments = isArguments;
+    lodash.isArray = isArray;
+    lodash.isBoolean = isBoolean;
+    lodash.isDate = isDate;
+    lodash.isElement = isElement;
+    lodash.isEmpty = isEmpty;
+    lodash.isEqual = isEqual;
+    lodash.isFinite = isFinite;
+    lodash.isFunction = isFunction;
+    lodash.isNaN = isNaN;
+    lodash.isNull = isNull;
+    lodash.isNumber = isNumber;
+    lodash.isObject = isObject;
+    lodash.isPlainObject = isPlainObject;
+    lodash.isRegExp = isRegExp;
+    lodash.isString = isString;
+    lodash.isUndefined = isUndefined;
+    lodash.lastIndexOf = lastIndexOf;
+    lodash.mixin = mixin;
+    lodash.noConflict = noConflict;
+    lodash.parseInt = parseInt;
+    lodash.random = random;
+    lodash.reduce = reduce;
+    lodash.reduceRight = reduceRight;
+    lodash.result = result;
+    lodash.runInContext = runInContext;
+    lodash.size = size;
+    lodash.some = some;
+    lodash.sortedIndex = sortedIndex;
+    lodash.template = template;
+    lodash.unescape = unescape;
+    lodash.uniqueId = uniqueId;
+ 
+    // add aliases
+    lodash.all = every;
+    lodash.any = some;
+    lodash.detect = find;
+    lodash.findWhere = find;
+    lodash.foldl = reduce;
+    lodash.foldr = reduceRight;
+    lodash.include = contains;
+    lodash.inject = reduce;
+ 
+    forOwn(lodash, function(func, methodName) {
+      if (!lodash.prototype[methodName]) {
+        lodash.prototype[methodName] = function() {
+          var args = [this.__wrapped__];
+          push.apply(args, arguments);
+          return func.apply(lodash, args);
+        };
+      }
+    });
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    // add functions capable of returning wrapped and unwrapped values when chaining
+    lodash.first = first;
+    lodash.last = last;
+ 
+    // add aliases
+    lodash.take = first;
+    lodash.head = first;
+ 
+    forOwn(lodash, function(func, methodName) {
+      if (!lodash.prototype[methodName]) {
+        lodash.prototype[methodName]= function(callback, thisArg) {
+          var result = func(this.__wrapped__, callback, thisArg);
+          return callback == null || (thisArg && typeof callback != 'function')
+            ? result
+            : new lodashWrapper(result);
+        };
+      }
+    });
+ 
+    /*--------------------------------------------------------------------------*/
+ 
+    /**
+     * The semantic version number.
+     *
+     * @static
+     * @memberOf _
+     * @type String
+     */
+    lodash.VERSION = '1.2.1';
+ 
+    // add "Chaining" functions to the wrapper
+    lodash.prototype.toString = wrapperToString;
+    lodash.prototype.value = wrapperValueOf;
+    lodash.prototype.valueOf = wrapperValueOf;
+ 
+    // add `Array` functions that return unwrapped values
+    basicEach(['join', 'pop', 'shift'], function(methodName) {
+      var func = arrayProto[methodName];
+      lodash.prototype[methodName] = function() {
+        return func.apply(this.__wrapped__, arguments);
+      };
+    });
+ 
+    // add `Array` functions that return the wrapped value
+    basicEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) {
+      var func = arrayProto[methodName];
+      lodash.prototype[methodName] = function() {
+        func.apply(this.__wrapped__, arguments);
+        return this;
+      };
+    });
+ 
+    // add `Array` functions that return new wrapped values
+    basicEach(['concat', 'slice', 'splice'], function(methodName) {
+      var func = arrayProto[methodName];
+      lodash.prototype[methodName] = function() {
+        return new lodashWrapper(func.apply(this.__wrapped__, arguments));
+      };
+    });
+ 
+    // avoid array-like object bugs with `Array#shift` and `Array#splice`
+    // in Firefox < 10 and IE < 9
+    Iif (!support.spliceObjects) {
+      basicEach(['pop', 'shift', 'splice'], function(methodName) {
+        var func = arrayProto[methodName],
+            isSplice = methodName == 'splice';
+ 
+        lodash.prototype[methodName] = function() {
+          var value = this.__wrapped__,
+              result = func.apply(value, arguments);
+ 
+          if (value.length === 0) {
+            delete value[0];
+          }
+          return isSplice ? new lodashWrapper(result) : result;
+        };
+      });
+    }
+ 
+    // add pseudo private property to be used and removed during the build process
+    lodash._basicEach = basicEach;
+    lodash._iteratorTemplate = iteratorTemplate;
+    lodash._shimKeys = shimKeys;
+ 
+    return lodash;
+  }
+ 
+  /*--------------------------------------------------------------------------*/
+ 
+  // expose Lo-Dash
+  var _ = runInContext();
+ 
+  // some AMD build optimizers, like r.js, check for specific condition patterns like the following:
+  Iif (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
+    // Expose Lo-Dash to the global object even when an AMD loader is present in
+    // case Lo-Dash was injected by a third-party script and not intended to be
+    // loaded as a module. The global assignment can be reverted in the Lo-Dash
+    // module via its `noConflict()` method.
+    window._ = _;
+ 
+    // define as an anonymous module so, through path mapping, it can be
+    // referenced as the "underscore" module
+    define(function() {
+      return _;
+    });
+  }
+  // check for `exports` after `define` in case a build optimizer adds an `exports` object
+  else Eif (freeExports && !freeExports.nodeType) {
+    // in Node.js or RingoJS v0.8.0+
+    Eif (freeModule) {
+      (freeModule.exports = _)._ = _;
+    }
+    // in Narwhal or RingoJS v0.7.0-
+    else {
+      freeExports._ = _;
+    }
+  }
+  else {
+    // in a browser or Rhino
+    window._ = _;
+  }
+}(this));
+ 
+ +
+ + + + + + + + diff --git a/coverage/prettify.css b/coverage/prettify.css new file mode 100644 index 0000000000..b317a7cda3 --- /dev/null +++ b/coverage/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/coverage/prettify.js b/coverage/prettify.js new file mode 100644 index 0000000000..ef51e03866 --- /dev/null +++ b/coverage/prettify.js @@ -0,0 +1 @@ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/package.json b/package.json index 28941b07ef..09b09f3697 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "lodash", "version": "1.2.1", "description": "A low-level utility library delivering consistency, customization, performance, and extra features.", - "homepage": "http://lodash.com", + "homepage": "http://lodash.com/", "license": "MIT", "main": "./dist/lodash.js", "keywords": [ @@ -29,6 +29,11 @@ "bin": { "lodash": "./build.js" }, + "devDependencies": { + "istanbul": "~0.1.35", + "grunt": "~0.4.1", + "grunt-shell": "~0.2.2" + }, "engines": [ "node", "rhino" diff --git a/test/run-test.sh b/test/run-test.sh deleted file mode 100755 index 4f81a65146..0000000000 --- a/test/run-test.sh +++ /dev/null @@ -1,18 +0,0 @@ -cd "$(dirname "$0")" - -for cmd in rhino "rhino -require" narwhal ringo phantomjs; do - echo "Testing in $cmd..." - $cmd test.js ../dist/lodash.compat.js && $cmd test.js ../dist/lodash.compat.min.js - echo "" -done - -echo "Testing in node..." -node test.js ../dist/lodash.js && node test.js ../dist/lodash.min.js - -echo "" -echo "Testing build..." -node test-build.js - -echo "" -echo "Testing in a browser..." -open index.html From 42f45317207abcb131e5343b6a3fb75d59740298 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 29 May 2013 17:06:01 -0400 Subject: [PATCH 085/117] Remove unneeded method from the `backbone` build and fix build tests. Former-commit-id: ee463a4af4d458a556f5be666b71b464bae32e6b --- build.js | 39 +++++++++++++++++++++++---------------- test/test-build.js | 18 +++++++++--------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/build.js b/build.js index 9a48bb1666..8bb481c111 100755 --- a/build.js +++ b/build.js @@ -208,7 +208,7 @@ // method used by the `backbone` and `underscore` builds 'chain': ['value'], - 'findWhere': ['find'] + 'findWhere': ['where'] }; /** Used to inline `iteratorTemplate` */ @@ -231,7 +231,7 @@ var allMethods = _.keys(dependencyMap); /** List of Lo-Dash methods */ - var lodashMethods = allMethods.slice(); + var lodashMethods = _.without(allMethods, 'findWhere'); /** List of Backbone's Lo-Dash dependencies */ var backboneDependencies = [ @@ -729,7 +729,9 @@ * @returns {Array} Returns an array of aliases. */ function getAliases(methodName) { - return realToAliasMap[methodName] || []; + return (realToAliasMap[methodName] || []).filter(function(methodName) { + return !dependencyMap[methodName]; + }); } /** @@ -945,7 +947,7 @@ * @returns {String} Returns the real method name. */ function getRealName(methodName) { - return aliasToRealMap[methodName] || methodName; + return (!dependencyMap[methodName] && aliasToRealMap[methodName]) || methodName; } /** @@ -1860,6 +1862,11 @@ return _.contains(methods, methodName); }; + // delete the `_.findWhere` dependency map to enable its alias mapping + if (!isUnderscore || useLodashMethod('findWhere')) { + delete dependencyMap.findWhere; + } + // methods to include in the build var includeMethods = options.reduce(function(accumulator, value) { return /^include=.*$/.test(value) @@ -1934,16 +1941,16 @@ if (!useLodashMethod('pick')){ dependencyMap.pick = _.without(dependencyMap.pick, 'forIn', 'isObject'); } - if (!useLodashMethod('where')) { - dependencyMap.createCallback = _.without(dependencyMap.createCallback, 'isEqual'); - dependencyMap.where.push('find', 'isEmpty'); - } if (!useLodashMethod('template')) { dependencyMap.template = _.without(dependencyMap.template, 'keys', 'values'); } if (!useLodashMethod('toArray')) { dependencyMap.toArray.push('isArray', 'map'); } + if (!useLodashMethod('where')) { + dependencyMap.createCallback = _.without(dependencyMap.createCallback, 'isEqual'); + dependencyMap.where.push('find', 'isEmpty'); + } _.each(['debounce', 'throttle'], function(methodName) { if (!useLodashMethod(methodName)) { @@ -1962,11 +1969,10 @@ dependencyMap[methodName] = _.without(dependencyMap[methodName], 'charAtCallback', 'isArray', 'isString'); } }); - - dependencyMap.findWhere = ['where']; - dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); } if (isModern || isUnderscore) { + dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); + _.each(['at', 'forEach', 'toArray'], function(methodName) { if (!(isUnderscore && useLodashMethod(methodName))) { dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isString'); @@ -2006,10 +2012,10 @@ // add `chain` and `findWhere` if (isUnderscore) { - if (_.contains(categories, 'Chaining')) { + if (_.contains(categories, 'Chaining') && !_.contains(methodNames, 'chain')) { methodNames.push('chain'); } - if (_.contains(categories, 'Collections')) { + if (_.contains(categories, 'Collections') && !_.contains(methodNames, 'findWhere')) { methodNames.push('findWhere'); } } @@ -2125,7 +2131,7 @@ source = removeBindingOptimization(source); } if (isLegacy || isMobile || isUnderscore) { - if (!useLodashMethod('assign') && !useLodashMethod('defaults') && !useLodashMethod('forIn') && !useLodashMethod('forOwn')) { + if (isMobile || (!useLodashMethod('assign') && !useLodashMethod('defaults') && !useLodashMethod('forIn') && !useLodashMethod('forOwn'))) { source = removeKeysOptimization(source); } if (!useLodashMethod('defer')) { @@ -2928,7 +2934,8 @@ else { // remove methods from the build allMethods.forEach(function(otherName) { - if (!_.contains(buildMethods, otherName)) { + if (!_.contains(buildMethods, otherName) && + !(otherName == 'findWhere' && !isUnderscore)) { source = removeFunction(source, otherName); } }); @@ -3300,7 +3307,7 @@ } debugSource = cleanupSource(source); - source = cleanupSource(source); + source = debugSource; /*------------------------------------------------------------------------*/ diff --git a/test/test-build.js b/test/test-build.js index aa296ad841..a9d766bdbe 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -57,7 +57,6 @@ 'drop': 'rest', 'each': 'forEach', 'extend': 'assign', - 'findWhere': 'find', 'foldl': 'reduce', 'foldr': 'reduceRight', 'head': 'first', @@ -77,7 +76,7 @@ 'contains': ['include'], 'every': ['all'], 'filter': ['select'], - 'find': ['detect', 'findWhere'], + 'find': ['detect'], 'first': ['head', 'take'], 'forEach': ['each'], 'functions': ['methods'], @@ -90,13 +89,13 @@ 'zipObject': ['object'] }; - /** List of all Lo-Dash methods */ - var lodashMethods = _.functions(_).filter(function(methodName) { + /** List of all methods */ + var allMethods = _.functions(_).filter(function(methodName) { return !/^_/.test(methodName); }); - /** List of all methods */ - var allMethods = lodashMethods.slice(); + /** List of all Lo-Dash methods */ + var lodashMethods = _.without(allMethods, 'findWhere'); /** List of "Arrays" category methods */ var arraysMethods = [ @@ -464,7 +463,7 @@ func(array, 'slice'); func(object, 'toFixed'); } - else if (methodName == 'where') { + else if (methodName == 'findWhere' || methodName == 'where') { func(array, object); func(object, object); } @@ -1445,7 +1444,7 @@ /*--------------------------------------------------------------------------*/ - QUnit.module('mixed underscore and lodash methods'); + QUnit.module('underscore builds with lodash methods'); (function() { var methodNames = [ @@ -1482,6 +1481,7 @@ 'pick', 'pluck', 'reduce', + 'reduceRight', 'result', 'rest', 'some', @@ -1535,7 +1535,7 @@ vm.runInContext(data.source, context, true); var lodash = context._; - if (methodName == 'chain' || methodName == 'defer') { + if (methodName == 'chain' || methodName == 'defer' || methodName == 'findWhere') { notEqual(strip(lodash[methodName]), strip(_[methodName]), basename); } else if (!/\.min$/.test(basename)) { equal(strip(lodash[methodName]), strip(_[methodName]), basename); From dc3512de9f5b7b7a03b7b77cd091dcc80c2fdaf8 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 30 May 2013 03:38:55 -0400 Subject: [PATCH 086/117] Move istanbul to travis.yml. Former-commit-id: 6d38406eafbfc880c0b5aabf853c987c65f03482 --- .travis.yml | 2 + Gruntfile.js | 63 - coverage/lodash/index.html | 333 - coverage/lodash/lodash.js.html | 17552 ------------------------------- coverage/prettify.css | 1 - coverage/prettify.js | 1 - test/run-rest.sh | 18 + 7 files changed, 20 insertions(+), 17950 deletions(-) delete mode 100644 Gruntfile.js delete mode 100644 coverage/lodash/index.html delete mode 100644 coverage/lodash/lodash.js.html delete mode 100644 coverage/prettify.css delete mode 100644 coverage/prettify.js create mode 100644 test/run-rest.sh diff --git a/.travis.yml b/.travis.yml index 01fe2ef456..270983e87b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,7 @@ node_js: - 0.6 - 0.9 env: + - TEST_COMMAND="istanbul cover ./test/test.js" - TEST_COMMAND="phantomjs ./test/test.js ../dist/lodash.compat.js" - TEST_COMMAND="phantomjs ./test/test.js ../dist/lodash.compat.min.js" - TEST_COMMAND="node ./test/test.js ../dist/lodash.js" @@ -16,5 +17,6 @@ branches: before_script: - "tar -xzvf vendor/closure-compiler.tar.gz -C vendor" - "tar -xzvf vendor/uglifyjs.tar.gz -C vendor" + - "npm install -g istanbul" script: $TEST_COMMAND diff --git a/Gruntfile.js b/Gruntfile.js deleted file mode 100644 index a32cc536f4..0000000000 --- a/Gruntfile.js +++ /dev/null @@ -1,63 +0,0 @@ -module.exports = function(grunt) { - - grunt.initConfig({ - 'shell': { - 'options': { - 'stdout': true, - 'stderr': true, - 'failOnError': true, - 'execOptions': { - 'cwd': 'test' - } - }, - 'cover': { - 'command': 'istanbul cover --report "html" --verbose --dir "coverage" "test.js"' - }, - 'test-rhino': { - 'command': 'echo "Testing in Rhino..."; rhino -opt -1 "test.js" "../dist/lodash.compat.js"; rhino -opt -1 "test.js" "../dist/lodash.compat.min.js"' - }, - 'test-rhino-require': { - 'command': 'echo "Testing in Rhino with -require..."; rhino -opt -1 -require "test.js" "../dist/lodash.compat.js"; rhino -opt -1 -require "test.js" "../dist/lodash.compat.min.js";' - }, - 'test-ringo': { - 'command': 'echo "Testing in Ringo..."; ringo -o -1 "test.js" "../dist/lodash.compat.js"; ringo -o -1 "test.js" "../dist/lodash.compat.min.js"' - }, - 'test-phantomjs': { - 'command': 'echo "Testing in PhantomJS..."; phantomjs "test.js" "../dist/lodash.compat.js"; phantomjs "test.js" "../dist/lodash.compat.min.js"' - }, - 'test-narwhal': { - 'command': 'echo "Testing in Narwhal..."; export NARWHAL_OPTIMIZATION=-1; narwhal "test.js" "../dist/lodash.compat.js"; narwhal "test.js" "../dist/lodash.compat.min.js"' - }, - 'test-node': { - 'command': 'echo "Testing in Node..."; node "test.js" "../dist/lodash.compat.js"; node "test.js" "../dist/lodash.compat.min.js"' - }, - 'test-node-build': { - 'command': 'echo "Testing build..."; node "test-build.js"' - }, - 'test-browser': { - 'command': 'echo "Testing in a browser..."; open "index.html"' - } - } - }); - - grunt.loadNpmTasks('grunt-shell'); - - grunt.registerTask('cover', 'shell:cover'); - grunt.registerTask('test', [ - 'shell:test-rhino', - //'shell:test-rhino-require', - 'shell:test-ringo', - 'shell:test-phantomjs', - 'shell:test-narwhal', - 'shell:test-node', - 'shell:test-node-build', - 'shell:test-browser' - ]); - - grunt.registerTask('default', [ - 'shell:test-node', - 'shell:test-node-build', - 'cover' - ]); - -}; diff --git a/coverage/lodash/index.html b/coverage/lodash/index.html deleted file mode 100644 index 8eb3e78f28..0000000000 --- a/coverage/lodash/index.html +++ /dev/null @@ -1,333 +0,0 @@ - - - - Code coverage report for lodash/ - - - - - - - -
-

Code coverage report for lodash/

-

- - Statements: 93.59% (1153 / 1232)      - - - Branches: 87.09% (789 / 906)      - - - Functions: 87.5% (168 / 192)      - - - Lines: 93.64% (1149 / 1227)      - -

-
All files » lodash/
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FileStatementsBranchesFunctionsLines
lodash.js93.59%(1153 / 1232)87.09%(789 / 906)87.5%(168 / 192)93.64%(1149 / 1227)
-
-
- - - - - - - - diff --git a/coverage/lodash/lodash.js.html b/coverage/lodash/lodash.js.html deleted file mode 100644 index dc94972bc5..0000000000 --- a/coverage/lodash/lodash.js.html +++ /dev/null @@ -1,17552 +0,0 @@ - - - - Code coverage report for lodash/lodash.js - - - - - - - -
-

Code coverage report for lodash/lodash.js

-

- - Statements: 93.59% (1153 / 1232)      - - - Branches: 87.09% (789 / 906)      - - - Functions: 87.5% (168 / 192)      - - - Lines: 93.64% (1149 / 1227)      - -

-
All files » lodash/ » lodash.js
-
-
-

-
-
1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -25 -26 -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -42 -43 -44 -45 -46 -47 -48 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -176 -177 -178 -179 -180 -181 -182 -183 -184 -185 -186 -187 -188 -189 -190 -191 -192 -193 -194 -195 -196 -197 -198 -199 -200 -201 -202 -203 -204 -205 -206 -207 -208 -209 -210 -211 -212 -213 -214 -215 -216 -217 -218 -219 -220 -221 -222 -223 -224 -225 -226 -227 -228 -229 -230 -231 -232 -233 -234 -235 -236 -237 -238 -239 -240 -241 -242 -243 -244 -245 -246 -247 -248 -249 -250 -251 -252 -253 -254 -255 -256 -257 -258 -259 -260 -261 -262 -263 -264 -265 -266 -267 -268 -269 -270 -271 -272 -273 -274 -275 -276 -277 -278 -279 -280 -281 -282 -283 -284 -285 -286 -287 -288 -289 -290 -291 -292 -293 -294 -295 -296 -297 -298 -299 -300 -301 -302 -303 -304 -305 -306 -307 -308 -309 -310 -311 -312 -313 -314 -315 -316 -317 -318 -319 -320 -321 -322 -323 -324 -325 -326 -327 -328 -329 -330 -331 -332 -333 -334 -335 -336 -337 -338 -339 -340 -341 -342 -343 -344 -345 -346 -347 -348 -349 -350 -351 -352 -353 -354 -355 -356 -357 -358 -359 -360 -361 -362 -363 -364 -365 -366 -367 -368 -369 -370 -371 -372 -373 -374 -375 -376 -377 -378 -379 -380 -381 -382 -383 -384 -385 -386 -387 -388 -389 -390 -391 -392 -393 -394 -395 -396 -397 -398 -399 -400 -401 -402 -403 -404 -405 -406 -407 -408 -409 -410 -411 -412 -413 -414 -415 -416 -417 -418 -419 -420 -421 -422 -423 -424 -425 -426 -427 -428 -429 -430 -431 -432 -433 -434 -435 -436 -437 -438 -439 -440 -441 -442 -443 -444 -445 -446 -447 -448 -449 -450 -451 -452 -453 -454 -455 -456 -457 -458 -459 -460 -461 -462 -463 -464 -465 -466 -467 -468 -469 -470 -471 -472 -473 -474 -475 -476 -477 -478 -479 -480 -481 -482 -483 -484 -485 -486 -487 -488 -489 -490 -491 -492 -493 -494 -495 -496 -497 -498 -499 -500 -501 -502 -503 -504 -505 -506 -507 -508 -509 -510 -511 -512 -513 -514 -515 -516 -517 -518 -519 -520 -521 -522 -523 -524 -525 -526 -527 -528 -529 -530 -531 -532 -533 -534 -535 -536 -537 -538 -539 -540 -541 -542 -543 -544 -545 -546 -547 -548 -549 -550 -551 -552 -553 -554 -555 -556 -557 -558 -559 -560 -561 -562 -563 -564 -565 -566 -567 -568 -569 -570 -571 -572 -573 -574 -575 -576 -577 -578 -579 -580 -581 -582 -583 -584 -585 -586 -587 -588 -589 -590 -591 -592 -593 -594 -595 -596 -597 -598 -599 -600 -601 -602 -603 -604 -605 -606 -607 -608 -609 -610 -611 -612 -613 -614 -615 -616 -617 -618 -619 -620 -621 -622 -623 -624 -625 -626 -627 -628 -629 -630 -631 -632 -633 -634 -635 -636 -637 -638 -639 -640 -641 -642 -643 -644 -645 -646 -647 -648 -649 -650 -651 -652 -653 -654 -655 -656 -657 -658 -659 -660 -661 -662 -663 -664 -665 -666 -667 -668 -669 -670 -671 -672 -673 -674 -675 -676 -677 -678 -679 -680 -681 -682 -683 -684 -685 -686 -687 -688 -689 -690 -691 -692 -693 -694 -695 -696 -697 -698 -699 -700 -701 -702 -703 -704 -705 -706 -707 -708 -709 -710 -711 -712 -713 -714 -715 -716 -717 -718 -719 -720 -721 -722 -723 -724 -725 -726 -727 -728 -729 -730 -731 -732 -733 -734 -735 -736 -737 -738 -739 -740 -741 -742 -743 -744 -745 -746 -747 -748 -749 -750 -751 -752 -753 -754 -755 -756 -757 -758 -759 -760 -761 -762 -763 -764 -765 -766 -767 -768 -769 -770 -771 -772 -773 -774 -775 -776 -777 -778 -779 -780 -781 -782 -783 -784 -785 -786 -787 -788 -789 -790 -791 -792 -793 -794 -795 -796 -797 -798 -799 -800 -801 -802 -803 -804 -805 -806 -807 -808 -809 -810 -811 -812 -813 -814 -815 -816 -817 -818 -819 -820 -821 -822 -823 -824 -825 -826 -827 -828 -829 -830 -831 -832 -833 -834 -835 -836 -837 -838 -839 -840 -841 -842 -843 -844 -845 -846 -847 -848 -849 -850 -851 -852 -853 -854 -855 -856 -857 -858 -859 -860 -861 -862 -863 -864 -865 -866 -867 -868 -869 -870 -871 -872 -873 -874 -875 -876 -877 -878 -879 -880 -881 -882 -883 -884 -885 -886 -887 -888 -889 -890 -891 -892 -893 -894 -895 -896 -897 -898 -899 -900 -901 -902 -903 -904 -905 -906 -907 -908 -909 -910 -911 -912 -913 -914 -915 -916 -917 -918 -919 -920 -921 -922 -923 -924 -925 -926 -927 -928 -929 -930 -931 -932 -933 -934 -935 -936 -937 -938 -939 -940 -941 -942 -943 -944 -945 -946 -947 -948 -949 -950 -951 -952 -953 -954 -955 -956 -957 -958 -959 -960 -961 -962 -963 -964 -965 -966 -967 -968 -969 -970 -971 -972 -973 -974 -975 -976 -977 -978 -979 -980 -981 -982 -983 -984 -985 -986 -987 -988 -989 -990 -991 -992 -993 -994 -995 -996 -997 -998 -999 -1000 -1001 -1002 -1003 -1004 -1005 -1006 -1007 -1008 -1009 -1010 -1011 -1012 -1013 -1014 -1015 -1016 -1017 -1018 -1019 -1020 -1021 -1022 -1023 -1024 -1025 -1026 -1027 -1028 -1029 -1030 -1031 -1032 -1033 -1034 -1035 -1036 -1037 -1038 -1039 -1040 -1041 -1042 -1043 -1044 -1045 -1046 -1047 -1048 -1049 -1050 -1051 -1052 -1053 -1054 -1055 -1056 -1057 -1058 -1059 -1060 -1061 -1062 -1063 -1064 -1065 -1066 -1067 -1068 -1069 -1070 -1071 -1072 -1073 -1074 -1075 -1076 -1077 -1078 -1079 -1080 -1081 -1082 -1083 -1084 -1085 -1086 -1087 -1088 -1089 -1090 -1091 -1092 -1093 -1094 -1095 -1096 -1097 -1098 -1099 -1100 -1101 -1102 -1103 -1104 -1105 -1106 -1107 -1108 -1109 -1110 -1111 -1112 -1113 -1114 -1115 -1116 -1117 -1118 -1119 -1120 -1121 -1122 -1123 -1124 -1125 -1126 -1127 -1128 -1129 -1130 -1131 -1132 -1133 -1134 -1135 -1136 -1137 -1138 -1139 -1140 -1141 -1142 -1143 -1144 -1145 -1146 -1147 -1148 -1149 -1150 -1151 -1152 -1153 -1154 -1155 -1156 -1157 -1158 -1159 -1160 -1161 -1162 -1163 -1164 -1165 -1166 -1167 -1168 -1169 -1170 -1171 -1172 -1173 -1174 -1175 -1176 -1177 -1178 -1179 -1180 -1181 -1182 -1183 -1184 -1185 -1186 -1187 -1188 -1189 -1190 -1191 -1192 -1193 -1194 -1195 -1196 -1197 -1198 -1199 -1200 -1201 -1202 -1203 -1204 -1205 -1206 -1207 -1208 -1209 -1210 -1211 -1212 -1213 -1214 -1215 -1216 -1217 -1218 -1219 -1220 -1221 -1222 -1223 -1224 -1225 -1226 -1227 -1228 -1229 -1230 -1231 -1232 -1233 -1234 -1235 -1236 -1237 -1238 -1239 -1240 -1241 -1242 -1243 -1244 -1245 -1246 -1247 -1248 -1249 -1250 -1251 -1252 -1253 -1254 -1255 -1256 -1257 -1258 -1259 -1260 -1261 -1262 -1263 -1264 -1265 -1266 -1267 -1268 -1269 -1270 -1271 -1272 -1273 -1274 -1275 -1276 -1277 -1278 -1279 -1280 -1281 -1282 -1283 -1284 -1285 -1286 -1287 -1288 -1289 -1290 -1291 -1292 -1293 -1294 -1295 -1296 -1297 -1298 -1299 -1300 -1301 -1302 -1303 -1304 -1305 -1306 -1307 -1308 -1309 -1310 -1311 -1312 -1313 -1314 -1315 -1316 -1317 -1318 -1319 -1320 -1321 -1322 -1323 -1324 -1325 -1326 -1327 -1328 -1329 -1330 -1331 -1332 -1333 -1334 -1335 -1336 -1337 -1338 -1339 -1340 -1341 -1342 -1343 -1344 -1345 -1346 -1347 -1348 -1349 -1350 -1351 -1352 -1353 -1354 -1355 -1356 -1357 -1358 -1359 -1360 -1361 -1362 -1363 -1364 -1365 -1366 -1367 -1368 -1369 -1370 -1371 -1372 -1373 -1374 -1375 -1376 -1377 -1378 -1379 -1380 -1381 -1382 -1383 -1384 -1385 -1386 -1387 -1388 -1389 -1390 -1391 -1392 -1393 -1394 -1395 -1396 -1397 -1398 -1399 -1400 -1401 -1402 -1403 -1404 -1405 -1406 -1407 -1408 -1409 -1410 -1411 -1412 -1413 -1414 -1415 -1416 -1417 -1418 -1419 -1420 -1421 -1422 -1423 -1424 -1425 -1426 -1427 -1428 -1429 -1430 -1431 -1432 -1433 -1434 -1435 -1436 -1437 -1438 -1439 -1440 -1441 -1442 -1443 -1444 -1445 -1446 -1447 -1448 -1449 -1450 -1451 -1452 -1453 -1454 -1455 -1456 -1457 -1458 -1459 -1460 -1461 -1462 -1463 -1464 -1465 -1466 -1467 -1468 -1469 -1470 -1471 -1472 -1473 -1474 -1475 -1476 -1477 -1478 -1479 -1480 -1481 -1482 -1483 -1484 -1485 -1486 -1487 -1488 -1489 -1490 -1491 -1492 -1493 -1494 -1495 -1496 -1497 -1498 -1499 -1500 -1501 -1502 -1503 -1504 -1505 -1506 -1507 -1508 -1509 -1510 -1511 -1512 -1513 -1514 -1515 -1516 -1517 -1518 -1519 -1520 -1521 -1522 -1523 -1524 -1525 -1526 -1527 -1528 -1529 -1530 -1531 -1532 -1533 -1534 -1535 -1536 -1537 -1538 -1539 -1540 -1541 -1542 -1543 -1544 -1545 -1546 -1547 -1548 -1549 -1550 -1551 -1552 -1553 -1554 -1555 -1556 -1557 -1558 -1559 -1560 -1561 -1562 -1563 -1564 -1565 -1566 -1567 -1568 -1569 -1570 -1571 -1572 -1573 -1574 -1575 -1576 -1577 -1578 -1579 -1580 -1581 -1582 -1583 -1584 -1585 -1586 -1587 -1588 -1589 -1590 -1591 -1592 -1593 -1594 -1595 -1596 -1597 -1598 -1599 -1600 -1601 -1602 -1603 -1604 -1605 -1606 -1607 -1608 -1609 -1610 -1611 -1612 -1613 -1614 -1615 -1616 -1617 -1618 -1619 -1620 -1621 -1622 -1623 -1624 -1625 -1626 -1627 -1628 -1629 -1630 -1631 -1632 -1633 -1634 -1635 -1636 -1637 -1638 -1639 -1640 -1641 -1642 -1643 -1644 -1645 -1646 -1647 -1648 -1649 -1650 -1651 -1652 -1653 -1654 -1655 -1656 -1657 -1658 -1659 -1660 -1661 -1662 -1663 -1664 -1665 -1666 -1667 -1668 -1669 -1670 -1671 -1672 -1673 -1674 -1675 -1676 -1677 -1678 -1679 -1680 -1681 -1682 -1683 -1684 -1685 -1686 -1687 -1688 -1689 -1690 -1691 -1692 -1693 -1694 -1695 -1696 -1697 -1698 -1699 -1700 -1701 -1702 -1703 -1704 -1705 -1706 -1707 -1708 -1709 -1710 -1711 -1712 -1713 -1714 -1715 -1716 -1717 -1718 -1719 -1720 -1721 -1722 -1723 -1724 -1725 -1726 -1727 -1728 -1729 -1730 -1731 -1732 -1733 -1734 -1735 -1736 -1737 -1738 -1739 -1740 -1741 -1742 -1743 -1744 -1745 -1746 -1747 -1748 -1749 -1750 -1751 -1752 -1753 -1754 -1755 -1756 -1757 -1758 -1759 -1760 -1761 -1762 -1763 -1764 -1765 -1766 -1767 -1768 -1769 -1770 -1771 -1772 -1773 -1774 -1775 -1776 -1777 -1778 -1779 -1780 -1781 -1782 -1783 -1784 -1785 -1786 -1787 -1788 -1789 -1790 -1791 -1792 -1793 -1794 -1795 -1796 -1797 -1798 -1799 -1800 -1801 -1802 -1803 -1804 -1805 -1806 -1807 -1808 -1809 -1810 -1811 -1812 -1813 -1814 -1815 -1816 -1817 -1818 -1819 -1820 -1821 -1822 -1823 -1824 -1825 -1826 -1827 -1828 -1829 -1830 -1831 -1832 -1833 -1834 -1835 -1836 -1837 -1838 -1839 -1840 -1841 -1842 -1843 -1844 -1845 -1846 -1847 -1848 -1849 -1850 -1851 -1852 -1853 -1854 -1855 -1856 -1857 -1858 -1859 -1860 -1861 -1862 -1863 -1864 -1865 -1866 -1867 -1868 -1869 -1870 -1871 -1872 -1873 -1874 -1875 -1876 -1877 -1878 -1879 -1880 -1881 -1882 -1883 -1884 -1885 -1886 -1887 -1888 -1889 -1890 -1891 -1892 -1893 -1894 -1895 -1896 -1897 -1898 -1899 -1900 -1901 -1902 -1903 -1904 -1905 -1906 -1907 -1908 -1909 -1910 -1911 -1912 -1913 -1914 -1915 -1916 -1917 -1918 -1919 -1920 -1921 -1922 -1923 -1924 -1925 -1926 -1927 -1928 -1929 -1930 -1931 -1932 -1933 -1934 -1935 -1936 -1937 -1938 -1939 -1940 -1941 -1942 -1943 -1944 -1945 -1946 -1947 -1948 -1949 -1950 -1951 -1952 -1953 -1954 -1955 -1956 -1957 -1958 -1959 -1960 -1961 -1962 -1963 -1964 -1965 -1966 -1967 -1968 -1969 -1970 -1971 -1972 -1973 -1974 -1975 -1976 -1977 -1978 -1979 -1980 -1981 -1982 -1983 -1984 -1985 -1986 -1987 -1988 -1989 -1990 -1991 -1992 -1993 -1994 -1995 -1996 -1997 -1998 -1999 -2000 -2001 -2002 -2003 -2004 -2005 -2006 -2007 -2008 -2009 -2010 -2011 -2012 -2013 -2014 -2015 -2016 -2017 -2018 -2019 -2020 -2021 -2022 -2023 -2024 -2025 -2026 -2027 -2028 -2029 -2030 -2031 -2032 -2033 -2034 -2035 -2036 -2037 -2038 -2039 -2040 -2041 -2042 -2043 -2044 -2045 -2046 -2047 -2048 -2049 -2050 -2051 -2052 -2053 -2054 -2055 -2056 -2057 -2058 -2059 -2060 -2061 -2062 -2063 -2064 -2065 -2066 -2067 -2068 -2069 -2070 -2071 -2072 -2073 -2074 -2075 -2076 -2077 -2078 -2079 -2080 -2081 -2082 -2083 -2084 -2085 -2086 -2087 -2088 -2089 -2090 -2091 -2092 -2093 -2094 -2095 -2096 -2097 -2098 -2099 -2100 -2101 -2102 -2103 -2104 -2105 -2106 -2107 -2108 -2109 -2110 -2111 -2112 -2113 -2114 -2115 -2116 -2117 -2118 -2119 -2120 -2121 -2122 -2123 -2124 -2125 -2126 -2127 -2128 -2129 -2130 -2131 -2132 -2133 -2134 -2135 -2136 -2137 -2138 -2139 -2140 -2141 -2142 -2143 -2144 -2145 -2146 -2147 -2148 -2149 -2150 -2151 -2152 -2153 -2154 -2155 -2156 -2157 -2158 -2159 -2160 -2161 -2162 -2163 -2164 -2165 -2166 -2167 -2168 -2169 -2170 -2171 -2172 -2173 -2174 -2175 -2176 -2177 -2178 -2179 -2180 -2181 -2182 -2183 -2184 -2185 -2186 -2187 -2188 -2189 -2190 -2191 -2192 -2193 -2194 -2195 -2196 -2197 -2198 -2199 -2200 -2201 -2202 -2203 -2204 -2205 -2206 -2207 -2208 -2209 -2210 -2211 -2212 -2213 -2214 -2215 -2216 -2217 -2218 -2219 -2220 -2221 -2222 -2223 -2224 -2225 -2226 -2227 -2228 -2229 -2230 -2231 -2232 -2233 -2234 -2235 -2236 -2237 -2238 -2239 -2240 -2241 -2242 -2243 -2244 -2245 -2246 -2247 -2248 -2249 -2250 -2251 -2252 -2253 -2254 -2255 -2256 -2257 -2258 -2259 -2260 -2261 -2262 -2263 -2264 -2265 -2266 -2267 -2268 -2269 -2270 -2271 -2272 -2273 -2274 -2275 -2276 -2277 -2278 -2279 -2280 -2281 -2282 -2283 -2284 -2285 -2286 -2287 -2288 -2289 -2290 -2291 -2292 -2293 -2294 -2295 -2296 -2297 -2298 -2299 -2300 -2301 -2302 -2303 -2304 -2305 -2306 -2307 -2308 -2309 -2310 -2311 -2312 -2313 -2314 -2315 -2316 -2317 -2318 -2319 -2320 -2321 -2322 -2323 -2324 -2325 -2326 -2327 -2328 -2329 -2330 -2331 -2332 -2333 -2334 -2335 -2336 -2337 -2338 -2339 -2340 -2341 -2342 -2343 -2344 -2345 -2346 -2347 -2348 -2349 -2350 -2351 -2352 -2353 -2354 -2355 -2356 -2357 -2358 -2359 -2360 -2361 -2362 -2363 -2364 -2365 -2366 -2367 -2368 -2369 -2370 -2371 -2372 -2373 -2374 -2375 -2376 -2377 -2378 -2379 -2380 -2381 -2382 -2383 -2384 -2385 -2386 -2387 -2388 -2389 -2390 -2391 -2392 -2393 -2394 -2395 -2396 -2397 -2398 -2399 -2400 -2401 -2402 -2403 -2404 -2405 -2406 -2407 -2408 -2409 -2410 -2411 -2412 -2413 -2414 -2415 -2416 -2417 -2418 -2419 -2420 -2421 -2422 -2423 -2424 -2425 -2426 -2427 -2428 -2429 -2430 -2431 -2432 -2433 -2434 -2435 -2436 -2437 -2438 -2439 -2440 -2441 -2442 -2443 -2444 -2445 -2446 -2447 -2448 -2449 -2450 -2451 -2452 -2453 -2454 -2455 -2456 -2457 -2458 -2459 -2460 -2461 -2462 -2463 -2464 -2465 -2466 -2467 -2468 -2469 -2470 -2471 -2472 -2473 -2474 -2475 -2476 -2477 -2478 -2479 -2480 -2481 -2482 -2483 -2484 -2485 -2486 -2487 -2488 -2489 -2490 -2491 -2492 -2493 -2494 -2495 -2496 -2497 -2498 -2499 -2500 -2501 -2502 -2503 -2504 -2505 -2506 -2507 -2508 -2509 -2510 -2511 -2512 -2513 -2514 -2515 -2516 -2517 -2518 -2519 -2520 -2521 -2522 -2523 -2524 -2525 -2526 -2527 -2528 -2529 -2530 -2531 -2532 -2533 -2534 -2535 -2536 -2537 -2538 -2539 -2540 -2541 -2542 -2543 -2544 -2545 -2546 -2547 -2548 -2549 -2550 -2551 -2552 -2553 -2554 -2555 -2556 -2557 -2558 -2559 -2560 -2561 -2562 -2563 -2564 -2565 -2566 -2567 -2568 -2569 -2570 -2571 -2572 -2573 -2574 -2575 -2576 -2577 -2578 -2579 -2580 -2581 -2582 -2583 -2584 -2585 -2586 -2587 -2588 -2589 -2590 -2591 -2592 -2593 -2594 -2595 -2596 -2597 -2598 -2599 -2600 -2601 -2602 -2603 -2604 -2605 -2606 -2607 -2608 -2609 -2610 -2611 -2612 -2613 -2614 -2615 -2616 -2617 -2618 -2619 -2620 -2621 -2622 -2623 -2624 -2625 -2626 -2627 -2628 -2629 -2630 -2631 -2632 -2633 -2634 -2635 -2636 -2637 -2638 -2639 -2640 -2641 -2642 -2643 -2644 -2645 -2646 -2647 -2648 -2649 -2650 -2651 -2652 -2653 -2654 -2655 -2656 -2657 -2658 -2659 -2660 -2661 -2662 -2663 -2664 -2665 -2666 -2667 -2668 -2669 -2670 -2671 -2672 -2673 -2674 -2675 -2676 -2677 -2678 -2679 -2680 -2681 -2682 -2683 -2684 -2685 -2686 -2687 -2688 -2689 -2690 -2691 -2692 -2693 -2694 -2695 -2696 -2697 -2698 -2699 -2700 -2701 -2702 -2703 -2704 -2705 -2706 -2707 -2708 -2709 -2710 -2711 -2712 -2713 -2714 -2715 -2716 -2717 -2718 -2719 -2720 -2721 -2722 -2723 -2724 -2725 -2726 -2727 -2728 -2729 -2730 -2731 -2732 -2733 -2734 -2735 -2736 -2737 -2738 -2739 -2740 -2741 -2742 -2743 -2744 -2745 -2746 -2747 -2748 -2749 -2750 -2751 -2752 -2753 -2754 -2755 -2756 -2757 -2758 -2759 -2760 -2761 -2762 -2763 -2764 -2765 -2766 -2767 -2768 -2769 -2770 -2771 -2772 -2773 -2774 -2775 -2776 -2777 -2778 -2779 -2780 -2781 -2782 -2783 -2784 -2785 -2786 -2787 -2788 -2789 -2790 -2791 -2792 -2793 -2794 -2795 -2796 -2797 -2798 -2799 -2800 -2801 -2802 -2803 -2804 -2805 -2806 -2807 -2808 -2809 -2810 -2811 -2812 -2813 -2814 -2815 -2816 -2817 -2818 -2819 -2820 -2821 -2822 -2823 -2824 -2825 -2826 -2827 -2828 -2829 -2830 -2831 -2832 -2833 -2834 -2835 -2836 -2837 -2838 -2839 -2840 -2841 -2842 -2843 -2844 -2845 -2846 -2847 -2848 -2849 -2850 -2851 -2852 -2853 -2854 -2855 -2856 -2857 -2858 -2859 -2860 -2861 -2862 -2863 -2864 -2865 -2866 -2867 -2868 -2869 -2870 -2871 -2872 -2873 -2874 -2875 -2876 -2877 -2878 -2879 -2880 -2881 -2882 -2883 -2884 -2885 -2886 -2887 -2888 -2889 -2890 -2891 -2892 -2893 -2894 -2895 -2896 -2897 -2898 -2899 -2900 -2901 -2902 -2903 -2904 -2905 -2906 -2907 -2908 -2909 -2910 -2911 -2912 -2913 -2914 -2915 -2916 -2917 -2918 -2919 -2920 -2921 -2922 -2923 -2924 -2925 -2926 -2927 -2928 -2929 -2930 -2931 -2932 -2933 -2934 -2935 -2936 -2937 -2938 -2939 -2940 -2941 -2942 -2943 -2944 -2945 -2946 -2947 -2948 -2949 -2950 -2951 -2952 -2953 -2954 -2955 -2956 -2957 -2958 -2959 -2960 -2961 -2962 -2963 -2964 -2965 -2966 -2967 -2968 -2969 -2970 -2971 -2972 -2973 -2974 -2975 -2976 -2977 -2978 -2979 -2980 -2981 -2982 -2983 -2984 -2985 -2986 -2987 -2988 -2989 -2990 -2991 -2992 -2993 -2994 -2995 -2996 -2997 -2998 -2999 -3000 -3001 -3002 -3003 -3004 -3005 -3006 -3007 -3008 -3009 -3010 -3011 -3012 -3013 -3014 -3015 -3016 -3017 -3018 -3019 -3020 -3021 -3022 -3023 -3024 -3025 -3026 -3027 -3028 -3029 -3030 -3031 -3032 -3033 -3034 -3035 -3036 -3037 -3038 -3039 -3040 -3041 -3042 -3043 -3044 -3045 -3046 -3047 -3048 -3049 -3050 -3051 -3052 -3053 -3054 -3055 -3056 -3057 -3058 -3059 -3060 -3061 -3062 -3063 -3064 -3065 -3066 -3067 -3068 -3069 -3070 -3071 -3072 -3073 -3074 -3075 -3076 -3077 -3078 -3079 -3080 -3081 -3082 -3083 -3084 -3085 -3086 -3087 -3088 -3089 -3090 -3091 -3092 -3093 -3094 -3095 -3096 -3097 -3098 -3099 -3100 -3101 -3102 -3103 -3104 -3105 -3106 -3107 -3108 -3109 -3110 -3111 -3112 -3113 -3114 -3115 -3116 -3117 -3118 -3119 -3120 -3121 -3122 -3123 -3124 -3125 -3126 -3127 -3128 -3129 -3130 -3131 -3132 -3133 -3134 -3135 -3136 -3137 -3138 -3139 -3140 -3141 -3142 -3143 -3144 -3145 -3146 -3147 -3148 -3149 -3150 -3151 -3152 -3153 -3154 -3155 -3156 -3157 -3158 -3159 -3160 -3161 -3162 -3163 -3164 -3165 -3166 -3167 -3168 -3169 -3170 -3171 -3172 -3173 -3174 -3175 -3176 -3177 -3178 -3179 -3180 -3181 -3182 -3183 -3184 -3185 -3186 -3187 -3188 -3189 -3190 -3191 -3192 -3193 -3194 -3195 -3196 -3197 -3198 -3199 -3200 -3201 -3202 -3203 -3204 -3205 -3206 -3207 -3208 -3209 -3210 -3211 -3212 -3213 -3214 -3215 -3216 -3217 -3218 -3219 -3220 -3221 -3222 -3223 -3224 -3225 -3226 -3227 -3228 -3229 -3230 -3231 -3232 -3233 -3234 -3235 -3236 -3237 -3238 -3239 -3240 -3241 -3242 -3243 -3244 -3245 -3246 -3247 -3248 -3249 -3250 -3251 -3252 -3253 -3254 -3255 -3256 -3257 -3258 -3259 -3260 -3261 -3262 -3263 -3264 -3265 -3266 -3267 -3268 -3269 -3270 -3271 -3272 -3273 -3274 -3275 -3276 -3277 -3278 -3279 -3280 -3281 -3282 -3283 -3284 -3285 -3286 -3287 -3288 -3289 -3290 -3291 -3292 -3293 -3294 -3295 -3296 -3297 -3298 -3299 -3300 -3301 -3302 -3303 -3304 -3305 -3306 -3307 -3308 -3309 -3310 -3311 -3312 -3313 -3314 -3315 -3316 -3317 -3318 -3319 -3320 -3321 -3322 -3323 -3324 -3325 -3326 -3327 -3328 -3329 -3330 -3331 -3332 -3333 -3334 -3335 -3336 -3337 -3338 -3339 -3340 -3341 -3342 -3343 -3344 -3345 -3346 -3347 -3348 -3349 -3350 -3351 -3352 -3353 -3354 -3355 -3356 -3357 -3358 -3359 -3360 -3361 -3362 -3363 -3364 -3365 -3366 -3367 -3368 -3369 -3370 -3371 -3372 -3373 -3374 -3375 -3376 -3377 -3378 -3379 -3380 -3381 -3382 -3383 -3384 -3385 -3386 -3387 -3388 -3389 -3390 -3391 -3392 -3393 -3394 -3395 -3396 -3397 -3398 -3399 -3400 -3401 -3402 -3403 -3404 -3405 -3406 -3407 -3408 -3409 -3410 -3411 -3412 -3413 -3414 -3415 -3416 -3417 -3418 -3419 -3420 -3421 -3422 -3423 -3424 -3425 -3426 -3427 -3428 -3429 -3430 -3431 -3432 -3433 -3434 -3435 -3436 -3437 -3438 -3439 -3440 -3441 -3442 -3443 -3444 -3445 -3446 -3447 -3448 -3449 -3450 -3451 -3452 -3453 -3454 -3455 -3456 -3457 -3458 -3459 -3460 -3461 -3462 -3463 -3464 -3465 -3466 -3467 -3468 -3469 -3470 -3471 -3472 -3473 -3474 -3475 -3476 -3477 -3478 -3479 -3480 -3481 -3482 -3483 -3484 -3485 -3486 -3487 -3488 -3489 -3490 -3491 -3492 -3493 -3494 -3495 -3496 -3497 -3498 -3499 -3500 -3501 -3502 -3503 -3504 -3505 -3506 -3507 -3508 -3509 -3510 -3511 -3512 -3513 -3514 -3515 -3516 -3517 -3518 -3519 -3520 -3521 -3522 -3523 -3524 -3525 -3526 -3527 -3528 -3529 -3530 -3531 -3532 -3533 -3534 -3535 -3536 -3537 -3538 -3539 -3540 -3541 -3542 -3543 -3544 -3545 -3546 -3547 -3548 -3549 -3550 -3551 -3552 -3553 -3554 -3555 -3556 -3557 -3558 -3559 -3560 -3561 -3562 -3563 -3564 -3565 -3566 -3567 -3568 -3569 -3570 -3571 -3572 -3573 -3574 -3575 -3576 -3577 -3578 -3579 -3580 -3581 -3582 -3583 -3584 -3585 -3586 -3587 -3588 -3589 -3590 -3591 -3592 -3593 -3594 -3595 -3596 -3597 -3598 -3599 -3600 -3601 -3602 -3603 -3604 -3605 -3606 -3607 -3608 -3609 -3610 -3611 -3612 -3613 -3614 -3615 -3616 -3617 -3618 -3619 -3620 -3621 -3622 -3623 -3624 -3625 -3626 -3627 -3628 -3629 -3630 -3631 -3632 -3633 -3634 -3635 -3636 -3637 -3638 -3639 -3640 -3641 -3642 -3643 -3644 -3645 -3646 -3647 -3648 -3649 -3650 -3651 -3652 -3653 -3654 -3655 -3656 -3657 -3658 -3659 -3660 -3661 -3662 -3663 -3664 -3665 -3666 -3667 -3668 -3669 -3670 -3671 -3672 -3673 -3674 -3675 -3676 -3677 -3678 -3679 -3680 -3681 -3682 -3683 -3684 -3685 -3686 -3687 -3688 -3689 -3690 -3691 -3692 -3693 -3694 -3695 -3696 -3697 -3698 -3699 -3700 -3701 -3702 -3703 -3704 -3705 -3706 -3707 -3708 -3709 -3710 -3711 -3712 -3713 -3714 -3715 -3716 -3717 -3718 -3719 -3720 -3721 -3722 -3723 -3724 -3725 -3726 -3727 -3728 -3729 -3730 -3731 -3732 -3733 -3734 -3735 -3736 -3737 -3738 -3739 -3740 -3741 -3742 -3743 -3744 -3745 -3746 -3747 -3748 -3749 -3750 -3751 -3752 -3753 -3754 -3755 -3756 -3757 -3758 -3759 -3760 -3761 -3762 -3763 -3764 -3765 -3766 -3767 -3768 -3769 -3770 -3771 -3772 -3773 -3774 -3775 -3776 -3777 -3778 -3779 -3780 -3781 -3782 -3783 -3784 -3785 -3786 -3787 -3788 -3789 -3790 -3791 -3792 -3793 -3794 -3795 -3796 -3797 -3798 -3799 -3800 -3801 -3802 -3803 -3804 -3805 -3806 -3807 -3808 -3809 -3810 -3811 -3812 -3813 -3814 -3815 -3816 -3817 -3818 -3819 -3820 -3821 -3822 -3823 -3824 -3825 -3826 -3827 -3828 -3829 -3830 -3831 -3832 -3833 -3834 -3835 -3836 -3837 -3838 -3839 -3840 -3841 -3842 -3843 -3844 -3845 -3846 -3847 -3848 -3849 -3850 -3851 -3852 -3853 -3854 -3855 -3856 -3857 -3858 -3859 -3860 -3861 -3862 -3863 -3864 -3865 -3866 -3867 -3868 -3869 -3870 -3871 -3872 -3873 -3874 -3875 -3876 -3877 -3878 -3879 -3880 -3881 -3882 -3883 -3884 -3885 -3886 -3887 -3888 -3889 -3890 -3891 -3892 -3893 -3894 -3895 -3896 -3897 -3898 -3899 -3900 -3901 -3902 -3903 -3904 -3905 -3906 -3907 -3908 -3909 -3910 -3911 -3912 -3913 -3914 -3915 -3916 -3917 -3918 -3919 -3920 -3921 -3922 -3923 -3924 -3925 -3926 -3927 -3928 -3929 -3930 -3931 -3932 -3933 -3934 -3935 -3936 -3937 -3938 -3939 -3940 -3941 -3942 -3943 -3944 -3945 -3946 -3947 -3948 -3949 -3950 -3951 -3952 -3953 -3954 -3955 -3956 -3957 -3958 -3959 -3960 -3961 -3962 -3963 -3964 -3965 -3966 -3967 -3968 -3969 -3970 -3971 -3972 -3973 -3974 -3975 -3976 -3977 -3978 -3979 -3980 -3981 -3982 -3983 -3984 -3985 -3986 -3987 -3988 -3989 -3990 -3991 -3992 -3993 -3994 -3995 -3996 -3997 -3998 -3999 -4000 -4001 -4002 -4003 -4004 -4005 -4006 -4007 -4008 -4009 -4010 -4011 -4012 -4013 -4014 -4015 -4016 -4017 -4018 -4019 -4020 -4021 -4022 -4023 -4024 -4025 -4026 -4027 -4028 -4029 -4030 -4031 -4032 -4033 -4034 -4035 -4036 -4037 -4038 -4039 -4040 -4041 -4042 -4043 -4044 -4045 -4046 -4047 -4048 -4049 -4050 -4051 -4052 -4053 -4054 -4055 -4056 -4057 -4058 -4059 -4060 -4061 -4062 -4063 -4064 -4065 -4066 -4067 -4068 -4069 -4070 -4071 -4072 -4073 -4074 -4075 -4076 -4077 -4078 -4079 -4080 -4081 -4082 -4083 -4084 -4085 -4086 -4087 -4088 -4089 -4090 -4091 -4092 -4093 -4094 -4095 -4096 -4097 -4098 -4099 -4100 -4101 -4102 -4103 -4104 -4105 -4106 -4107 -4108 -4109 -4110 -4111 -4112 -4113 -4114 -4115 -4116 -4117 -4118 -4119 -4120 -4121 -4122 -4123 -4124 -4125 -4126 -4127 -4128 -4129 -4130 -4131 -4132 -4133 -4134 -4135 -4136 -4137 -4138 -4139 -4140 -4141 -4142 -4143 -4144 -4145 -4146 -4147 -4148 -4149 -4150 -4151 -4152 -4153 -4154 -4155 -4156 -4157 -4158 -4159 -4160 -4161 -4162 -4163 -4164 -4165 -4166 -4167 -4168 -4169 -4170 -4171 -4172 -4173 -4174 -4175 -4176 -4177 -4178 -4179 -4180 -4181 -4182 -4183 -4184 -4185 -4186 -4187 -4188 -4189 -4190 -4191 -4192 -4193 -4194 -4195 -4196 -4197 -4198 -4199 -4200 -4201 -4202 -4203 -4204 -4205 -4206 -4207 -4208 -4209 -4210 -4211 -4212 -4213 -4214 -4215 -4216 -4217 -4218 -4219 -4220 -4221 -4222 -4223 -4224 -4225 -4226 -4227 -4228 -4229 -4230 -4231 -4232 -4233 -4234 -4235 -4236 -4237 -4238 -4239 -4240 -4241 -4242 -4243 -4244 -4245 -4246 -4247 -4248 -4249 -4250 -4251 -4252 -4253 -4254 -4255 -4256 -4257 -4258 -4259 -4260 -4261 -4262 -4263 -4264 -4265 -4266 -4267 -4268 -4269 -4270 -4271 -4272 -4273 -4274 -4275 -4276 -4277 -4278 -4279 -4280 -4281 -4282 -4283 -4284 -4285 -4286 -4287 -4288 -4289 -4290 -4291 -4292 -4293 -4294 -4295 -4296 -4297 -4298 -4299 -4300 -4301 -4302 -4303 -4304 -4305 -4306 -4307 -4308 -4309 -4310 -4311 -4312 -4313 -4314 -4315 -4316 -4317 -4318 -4319 -4320 -4321 -4322 -4323 -4324 -4325 -4326 -4327 -4328 -4329 -4330 -4331 -4332 -4333 -4334 -4335 -4336 -4337 -4338 -4339 -4340 -4341 -4342 -4343 -4344 -4345 -4346 -4347 -4348 -4349 -4350 -4351 -4352 -4353 -4354 -4355 -4356 -4357 -4358 -4359 -4360 -4361 -4362 -4363 -4364 -4365 -4366 -4367 -4368 -4369 -4370 -4371 -4372 -4373 -4374 -4375 -4376 -4377 -4378 -4379 -4380 -4381 -4382 -4383 -4384 -4385 -4386 -4387 -4388 -4389 -4390 -4391 -4392 -4393 -4394 -4395 -4396 -4397 -4398 -4399 -4400 -4401 -4402 -4403 -4404 -4405 -4406 -4407 -4408 -4409 -4410 -4411 -4412 -4413 -4414 -4415 -4416 -4417 -4418 -4419 -4420 -4421 -4422 -4423 -4424 -4425 -4426 -4427 -4428 -4429 -4430 -4431 -4432 -4433 -4434 -4435 -4436 -4437 -4438 -4439 -4440 -4441 -4442 -4443 -4444 -4445 -4446 -4447 -4448 -4449 -4450 -4451 -4452 -4453 -4454 -4455 -4456 -4457 -4458 -4459 -4460 -4461 -4462 -4463 -4464 -4465 -4466 -4467 -4468 -4469 -4470 -4471 -4472 -4473 -4474 -4475 -4476 -4477 -4478 -4479 -4480 -4481 -4482 -4483 -4484 -4485 -4486 -4487 -4488 -4489 -4490 -4491 -4492 -4493 -4494 -4495 -4496 -4497 -4498 -4499 -4500 -4501 -4502 -4503 -4504 -4505 -4506 -4507 -4508 -4509 -4510 -4511 -4512 -4513 -4514 -4515 -4516 -4517 -4518 -4519 -4520 -4521 -4522 -4523 -4524 -4525 -4526 -4527 -4528 -4529 -4530 -4531 -4532 -4533 -4534 -4535 -4536 -4537 -4538 -4539 -4540 -4541 -4542 -4543 -4544 -4545 -4546 -4547 -4548 -4549 -4550 -4551 -4552 -4553 -4554 -4555 -4556 -4557 -4558 -4559 -4560 -4561 -4562 -4563 -4564 -4565 -4566 -4567 -4568 -4569 -4570 -4571 -4572 -4573 -4574 -4575 -4576 -4577 -4578 -4579 -4580 -4581 -4582 -4583 -4584 -4585 -4586 -4587 -4588 -4589 -4590 -4591 -4592 -4593 -4594 -4595 -4596 -4597 -4598 -4599 -4600 -4601 -4602 -4603 -4604 -4605 -4606 -4607 -4608 -4609 -4610 -4611 -4612 -4613 -4614 -4615 -4616 -4617 -4618 -4619 -4620 -4621 -4622 -4623 -4624 -4625 -4626 -4627 -4628 -4629 -4630 -4631 -4632 -4633 -4634 -4635 -4636 -4637 -4638 -4639 -4640 -4641 -4642 -4643 -4644 -4645 -4646 -4647 -4648 -4649 -4650 -4651 -4652 -4653 -4654 -4655 -4656 -4657 -4658 -4659 -4660 -4661 -4662 -4663 -4664 -4665 -4666 -4667 -4668 -4669 -4670 -4671 -4672 -4673 -4674 -4675 -4676 -4677 -4678 -4679 -4680 -4681 -4682 -4683 -4684 -4685 -4686 -4687 -4688 -4689 -4690 -4691 -4692 -4693 -4694 -4695 -4696 -4697 -4698 -4699 -4700 -4701 -4702 -4703 -4704 -4705 -4706 -4707 -4708 -4709 -4710 -4711 -4712 -4713 -4714 -4715 -4716 -4717 -4718 -4719 -4720 -4721 -4722 -4723 -4724 -4725 -4726 -4727 -4728 -4729 -4730 -4731 -4732 -4733 -4734 -4735 -4736 -4737 -4738 -4739 -4740 -4741 -4742 -4743 -4744 -4745 -4746 -4747 -4748 -4749 -4750 -4751 -4752 -4753 -4754 -4755 -4756 -4757 -4758 -4759 -4760 -4761 -4762 -4763 -4764 -4765 -4766 -4767 -4768 -4769 -4770 -4771 -4772 -4773 -4774 -4775 -4776 -4777 -4778 -4779 -4780 -4781 -4782 -4783 -4784 -4785 -4786 -4787 -4788 -4789 -4790 -4791 -4792 -4793 -4794 -4795 -4796 -4797 -4798 -4799 -4800 -4801 -4802 -4803 -4804 -4805 -4806 -4807 -4808 -4809 -4810 -4811 -4812 -4813 -4814 -4815 -4816 -4817 -4818 -4819 -4820 -4821 -4822 -4823 -4824 -4825 -4826 -4827 -4828 -4829 -4830 -4831 -4832 -4833 -4834 -4835 -4836 -4837 -4838 -4839 -4840 -4841 -4842 -4843 -4844 -4845 -4846 -4847 -4848 -4849 -4850 -4851 -4852 -4853 -4854 -4855 -4856 -4857 -4858 -4859 -4860 -4861 -4862 -4863 -4864 -4865 -4866 -4867 -4868 -4869 -4870 -4871 -4872 -4873 -4874 -4875 -4876 -4877 -4878 -4879 -4880 -4881 -4882 -4883 -4884 -4885 -4886 -4887 -4888 -4889 -4890 -4891 -4892 -4893 -4894 -4895 -4896 -4897 -4898 -4899 -4900 -4901 -4902 -4903 -4904 -4905 -4906 -4907 -4908 -4909 -4910 -4911 -4912 -4913 -4914 -4915 -4916 -4917 -4918 -4919 -4920 -4921 -4922 -4923 -4924 -4925 -4926 -4927 -4928 -4929 -4930 -4931 -4932 -4933 -4934 -4935 -4936 -4937 -4938 -4939 -4940 -4941 -4942 -4943 -4944 -4945 -4946 -4947 -4948 -4949 -4950 -4951 -4952 -4953 -4954 -4955 -4956 -4957 -4958 -4959 -4960 -4961 -4962 -4963 -4964 -4965 -4966 -4967 -4968 -4969 -4970 -4971 -4972 -4973 -4974 -4975 -4976 -4977 -4978 -4979 -4980 -4981 -4982 -4983 -4984 -4985 -4986 -4987 -4988 -4989 -4990 -4991 -4992 -4993 -4994 -4995 -4996 -4997 -4998 -4999 -5000 -5001 -5002 -5003 -5004 -5005 -5006 -5007 -5008 -5009 -5010 -5011 -5012 -5013 -5014 -5015 -5016 -5017 -5018 -5019 -5020 -5021 -5022 -5023 -5024 -5025 -5026 -5027 -5028 -5029 -5030 -5031 -5032 -5033 -5034 -5035 -5036 -5037 -5038 -5039 -5040 -5041 -5042 -5043 -5044 -5045 -5046 -5047 -5048 -5049 -5050 -5051 -5052 -5053 -5054 -5055 -5056 -5057 -5058 -5059 -5060 -5061 -5062 -5063 -5064 -5065 -5066 -5067 -5068 -5069 -5070 -5071 -5072 -5073 -5074 -5075 -5076 -5077 -5078 -5079 -5080 -5081 -5082 -5083 -5084 -5085 -5086 -5087 -5088 -5089 -5090 -5091 -5092 -5093 -5094 -5095 -5096 -5097 -5098 -5099 -5100 -5101 -5102 -5103 -5104 -5105 -5106 -5107 -5108 -5109 -5110 -5111 -5112 -5113 -5114 -5115 -5116 -5117 -5118 -5119 -5120 -5121 -5122 -5123 -5124 -5125 -5126 -5127 -5128 -5129 -5130 -5131 -5132 -5133 -5134 -5135 -5136 -5137 -5138 -5139 -5140 -5141 -5142 -5143 -5144 -5145 -5146 -5147 -5148 -5149 -5150 -5151 -5152 -5153 -5154 -5155 -5156 -5157 -5158 -5159 -5160 -5161 -5162 -5163 -5164 -5165 -5166 -5167 -5168 -5169 -5170 -5171 -5172 -5173 -5174 -5175 -5176 -5177 -5178 -5179 -5180 -5181 -5182 -5183 -5184 -5185 -5186 -5187 -5188 -5189 -5190 -5191 -5192 -5193 -5194 -5195 -5196 -5197 -5198 -5199 -5200 -5201 -5202 -5203 -5204 -5205 -5206 -5207 -5208 -5209 -5210 -5211 -5212 -5213 -5214 -5215 -5216 -5217 -5218 -5219 -5220 -5221 -5222 -5223 -5224 -5225 -5226 -5227 -5228 -5229 -5230 -5231 -5232 -5233 -5234 -5235 -5236 -5237 -5238 -5239 -5240 -5241 -5242 -5243 -5244 -5245 -5246 -5247 -5248 -5249 -5250 -5251 -5252 -5253 -5254 -5255 -5256 -5257 -5258 -5259 -5260 -5261 -5262 -5263 -5264 -5265 -5266 -5267 -5268 -5269 -5270 -5271 -5272 -5273 -5274 -5275 -5276 -5277 -5278 -5279 -5280 -5281 -5282 -5283 -5284 -5285 -5286 -5287 -5288 -5289 -5290 -5291 -5292 -5293 -5294 -5295 -5296 -5297 -5298 -5299 -5300 -5301 -5302 -5303 -5304 -5305 -5306 -5307 -5308 -5309 -5310 -5311 -5312 -5313 -5314 -5315 -5316 -5317 -5318 -5319 -5320 -5321 -5322 -5323 -5324 -5325 -5326 -5327 -5328 -5329 -5330 -5331 -5332 -5333 -5334 -5335 -5336 -5337 -5338 -5339 -5340 -5341 -5342 -5343 -5344 -5345 -5346 -5347 -5348 -5349 -5350 -5351 -5352 -5353 -5354 -5355 -5356 -5357 -5358 -5359 -5360 -5361 -5362 -5363 -5364 -5365 -5366 -5367 -5368 -5369 -5370 -5371 -5372 -5373 -5374 -5375 -5376 -5377 -5378 -5379 -5380 -5381 -5382 -5383 -5384 -5385 -5386 -5387 -5388 -5389 -5390 -5391 -5392 -5393 -5394 -5395 -5396 -5397 -5398 -5399 -5400 -5401 -5402 -5403 -5404 -5405 -5406 -5407 -5408 -5409 -5410 -5411 -5412 -5413 -5414 -5415 -5416 -5417 -5418 -5419 -5420 -5421 -5422 -5423 -5424 -5425 -5426 -5427 -5428 -5429 -5430 -5431 -5432 -5433 -5434 -5435 -5436 -5437 -5438 -5439 -5440 -5441 -5442 -5443 -5444 -5445 -5446 -5447 -5448 -5449 -5450 -5451 -5452 -5453 -5454 -5455 -5456 -5457 -5458 -5459 -5460 -5461 -5462 -5463 -5464 -5465 -5466 -5467 -5468 -5469 -5470 -5471 -5472 -5473 -5474 -5475 -5476 -5477 -5478 -5479 -5480 -5481 -5482 -5483 -5484 -5485 -5486 -5487 -5488 -5489 -5490 -5491 -5492 -5493 -5494 -5495 -5496 -5497 -5498 -5499 -5500 -5501 -5502 -5503 -5504 -5505 -5506 -5507 -5508 -5509 -5510 -5511 -5512 -5513 -5514 -5515 -5516 -5517 -5518 -5519 -5520 -5521 -5522 -5523 -5524 -5525 -5526 -5527 -5528 -5529 -5530 -5531 -5532 -5533 -5534 -5535 -5536 -5537 -5538 -5539 -5540 -5541 -5542 -5543 -5544 -5545 -5546 -5547 -5548 -5549 -5550 -5551 -5552 -5553 -5554 -5555 -5556 -5557 -5558 -5559 -5560 -5561 -5562 -5563 -5564 -5565 -5566 -5567 -5568 -5569 -5570 -5571 -5572 -5573 -5574 -5575 -5576 -5577 -5578 -5579 -5580 -5581 -5582 -5583 -5584 -5585 -5586 -5587 -5588 -5589 -5590 -5591 -5592 -5593 -5594 -5595 -5596 -5597 -5598 -5599 -5600 -5601 -5602 -5603 -5604 -5605 -5606 -5607 -5608 -5609 -5610 -5611 -5612 -5613 -5614 -5615 -5616 -5617 -5618 -5619 -5620 -5621 -5622 -5623 -5624 -5625 -5626 -5627 -5628 -5629 -5630 -5631 -5632 -5633 -5634 -5635 -5636 -5637 -5638 -5639 -5640 -5641 -5642 -5643 -5644 -5645 -5646 -5647 -5648 -5649 -5650 -5651 -5652 -5653 -5654 -5655 -5656 -5657 -5658 -5659 -5660 -5661 -5662 -5663 -5664 -5665 -5666 -5667 -5668 -5669 -5670 -5671 -5672 -5673 -5674 -5675 -5676 -5677 -5678 -5679 -5680 -5681 -5682 -5683 -5684 -5685 -5686 -5687 -5688 -5689 -5690 -5691 -5692 -5693 -5694 -5695 -5696 -5697 -5698 -5699 -5700 -5701 -5702 -5703 -5704 -5705 -5706 -5707 -5708 -5709 -5710 -5711 -5712 -5713 -5714 -5715 -5716 -5717 -5718 -5719 -5720 -5721 -5722 -5723 -5724 -5725 -5726 -5727 -5728 -5729 -5730 -5731 -5732 -5733 -5734 -5735 -5736 -5737 -5738 -5739 -5740 -5741 -5742 -5743 -5744 -5745 -5746 -5747 -5748 -5749 -5750  -  -  -  -  -  -  -  -1 -  -  -1 -  -  -1 -  -  -1 -  -  -1 -1 -1 -  -  -  -1 -  -  -1 -  -  -1 -  -  -1 -  -  -1 -  -  -  -  -1 -  -  -  -  -  -1 -  -  -1 -  -  -1 -  -  -1 -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -1 -  -  -1 -  -  -1 -  -  -1 -  -  -  -  -  -  -1 -  -  -  -  -  -1 -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -1 -1 -1 -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -  -  -  -11 -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -11 -  -  -11 -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -11 -11 -11 -11 -11 -11 -11 -11 -11 -  -  -11 -11 -11 -11 -11 -  -11 -11 -11 -77 -77 -693 -198 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -31 -  -  -  -  -  -  -  -  -  -  -  -11 -  -11 -11 -  -  -  -11 -33 -11 -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -11 -11 -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -646 -  -  -646 -5289 -394 -  -  -252 -  -  -  -  -  -  -  -  -  -  -11 -12 -  -  -  -  -  -  -  -  -  -  -  -11 -46 -  -  -46 -46 -  -  -  -46 -24 -13 -  -11 -11 -  -  -22 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -45 -  -  -  -  -45 -14 -14 -  -31 -9 -1 -  -8 -  -  -44 -  -  -28 -  -  -28 -2 -  -28 -9 -  -  -  -28 -  -1 -  -  -  -1 -1 -  -27 -  -44 -  -  -  -  -  -  -  -  -  -  -  -  -11 -37 -  -37 -  -  -  -  -  -  -37 -  -  -  -  -  -  -  -  -  -  -37 -484 -  -  -37 -16 -  -  -37 -152 -152 -  -  -152 -  -  -152 -  -  -  -  -37 -225 -225 -  -  -225 -  -  -225 -111 -  -114 -  -  -  -  -37 -3 -225 -  -3 -  -  -  -37 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -66 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -66 -110 -341 -  -  -66 -66 -  -  -66 -  -  -  -  -  -  -66 -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -11 -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -6 -  -  -  -  -  -  -  -  -  -  -11 -673 -  -  -  -  -  -  -  -  -  -  -11 -145 -145 -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -11 -43 -  -  -11 -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -11 -22 -  -52 -13 -13 -13 -  -52 -10 -  -52 -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -1 -  -  -  -1 -  -  -  -  -  -  -  -  -1 -  -  -  -  -  -  -  -  -  -1 -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -72 -72 -53 -  -72 -  -  -  -72 -80 -  -72 -  -  -  -  -  -  -  -  -  -11 -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -35 -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -501 -35 -  -466 -  -  -  -466 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -107 -  -  -  -107 -6 -6 -6 -  -107 -7 -  -  -  -7 -7 -2 -  -5 -  -  -105 -105 -43 -43 -2 -  -41 -  -  -103 -71 -  -  -  -32 -32 -  -  -1 -  -  -  -2 -  -  -2 -  -  -27 -27 -  -27 -27 -29 -2 -  -  -  -25 -  -  -25 -6 -1 -  -6 -1 -  -  -  -  -25 -25 -  -  -25 -55 -  -  -25 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -33 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -11 -11 -11 -10 -3 -3 -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -31 -31 -908 -872 -  -  -31 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -28 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -19 -  -  -  -  -19 -62 -62 -  -19 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -24 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -24 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -29 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -29 -29 -13 -  -16 -  -  -16 -  -  -6 -  -10 -4 -  -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -163 -163 -11 -11 -11 -7 -  -  -  -156 -  -70 -  -86 -  -  -  -86 -  -  -51 -  -  -  -35 -9 -  -  -26 -  -  -26 -3 -  -26 -2 -  -26 -  -  -26 -  -  -  -  -1 -  -  -  -1 -  -  -  -  -  -  -  -  -3 -  -21 -21 -  -14 -  -  -  -14 -  -  -  -14 -  -  -  -14 -  -  -  -1 -  -  -  -  -  -20 -20 -  -20 -20 -6 -2 -  -  -18 -18 -  -  -18 -18 -  -  -18 -6 -6 -  -  -6 -6 -  -  -  -6 -11 -  -  -11 -1 -1 -1 -  -  -10 -2 -  -  -6 -  -  -  -12 -25 -  -25 -  -25 -  -  -  -12 -  -9 -23 -  -22 -  -  -  -12 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -32 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -1000 -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -835 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -24 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -23 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -49 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -77 -47 -  -30 -  -  -30 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -24 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -81 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -23 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -47 -  -  -  -47 -7 -  -40 -17 -  -  -  -23 -23 -  -  -  -23 -21 -  -23 -1 -22 -6 -  -  -40 -44 -54 -  -  -  -  -54 -  -22 -22 -36 -3 -3 -  -  -22 -19 -19 -7 -7 -2 -  -  -19 -17 -  -  -  -  -19 -19 -  -  -19 -17 -  -  -  -  -32 -5 -5 -4 -  -  -32 -30 -  -  -54 -  -  -40 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -17 -  -  -  -17 -4 -  -13 -  -17 -22 -  -  -  -12 -  -  -17 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -7 -  -  -  -  -7 -  -  -  -7 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -16 -16 -12 -  -  -  -12 -56 -56 -52 -  -  -  -4 -4 -7 -2 -  -  -  -16 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -13 -13 -  -13 -13 -3 -  -10 -  -  -10 -  -  -13 -16 -  -13 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -57 -  -  -  -  -57 -44 -  -57 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -14 -  -  -  -  -14 -  -  -14 -14 -  -14 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -56 -  -  -  -  -56 -56 -22 -  -  -  -  -34 -33 -7 -  -  -  -56 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -9 -9 -  -9 -4 -4 -  -9 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -25 -25 -  -25 -11 -  -  -11 -1020 -3 -  -  -  -14 -  -  -  -25 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -45 -45 -  -45 -16 -  -  -16 -173 -173 -138 -  -  -  -29 -3 -2 -  -  -  -45 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -27 -  -27 -6 -  -  -6 -12 -12 -4 -  -  -  -21 -21 -  -  -  -  -  -21 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -277 -178 -  -  -178 -1833 -1 -  -  -  -99 -  -277 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -13 -13 -  -13 -16 -16 -  -13 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -8 -  -  -  -  -  -8 -3 -  -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -171 -  -  -  -171 -171 -129 -797 -  -  -42 -45 -  -  -171 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -22 -  -  -22 -11 -  -  -11 -21 -21 -11 -  -  -  -11 -  -  -  -11 -10 -10 -9 -9 -  -  -  -22 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -11 -  -  -11 -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -11 -10 -10 -3 -3 -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -29 -29 -  -29 -6 -  -  -6 -2 -  -6 -9 -  -  -23 -6 -  -  -  -  -29 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -20 -  -  -  -20 -1 -1 -19 -  -  -20 -20 -13 -13 -  -  -  -20 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -9 -9 -127 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -8 -  -  -  -8 -3 -3 -3 -  -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -19 -19 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -18 -18 -  -18 -4 -  -  -4 -5 -3 -  -  -  -14 -  -  -  -18 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -11 -  -  -  -11 -11 -25 -  -  -  -  -  -  -11 -11 -11 -25 -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -12 -5 -  -  -  -7 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -8 -  -  -  -8 -5 -5 -3 -  -  -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -21 -  -  -  -  -  -21 -317 -317 -116 -  -  -21 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -12 -  -  -12 -12 -11 -4 -  -  -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -38 -17 -  -  -17 -7 -7 -7 -11 -  -  -10 -10 -7 -  -  -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -33 -  -  -  -33 -44 -44 -10 -  -  -44 -20 -  -24 -  -  -33 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -126 -8 -8 -118 -2 -2 -  -124 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -23 -14 -  -9 -  -  -9 -5 -5 -5 -7 -  -  -4 -  -9 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -10 -  -  -  -  -  -  -  -  -10 -10 -84 -84 -9 -9 -9 -9 -5 -  -  -4 -  -  -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -22 -15 -  -  -15 -7 -7 -7 -11 -  -  -8 -8 -5 -  -  -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -18 -18 -8 -  -18 -33 -8 -  -  -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -24 -24 -  -24 -16 -16 -  -  -  -24 -  -  -  -24 -36 -36 -  -24 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -37 -5 -  -  -  -5 -5 -7 -  -  -32 -  -37 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -13 -  -  -  -13 -13 -  -13 -41 -41 -  -  -  -13 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -9 -9 -  -9 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -35 -  -  -  -  -  -  -35 -266 -  -  -266 -  -  -  -36 -17 -  -36 -  -  -35 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -18 -  -  -  -18 -22 -  -18 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -10 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -14 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -14 -  -  -  -14 -  -  -  -  -  -  -  -14 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -24 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -4 -  -  -  -4 -6 -6 -  -4 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -520 -205 -  -315 -315 -71 -50 -102 -  -  -21 -21 -67 -  -67 -70 -38 -  -  -67 -  -  -244 -201 -  -43 -5 -8 -  -  -38 -3 -3 -  -  -35 -4 -8 -  -  -31 -54 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -10 -  -  -  -  -  -  -10 -12 -12 -12 -7 -  -  -10 -2 -2 -8 -6 -6 -  -10 -14 -14 -  -  -  -14 -  -14 -5 -  -14 -14 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -11 -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -1 -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -2 -3 -  -  -3 -  -  -  -2 -2 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -2 -  -  -2 -4 -2 -  -2 -2 -  -  -1 -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -7 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -7 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -13 -  -  -  -  -  -  -  -13 -17 -17 -15 -15 -  -  -13 -1 -12 -6 -6 -  -13 -16403 -16403 -2 -  -16403 -16403 -16403 -  -16403 -14 -14 -14 -14 -  -16389 -20 -  -16403 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -12 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -49 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -18 -737 -  -737 -6 -  -  -6 -6 -6 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -7 -7 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -15 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -1012 -4 -  -1012 -1012 -6 -6 -  -1006 -  -1012 -1012 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -8 -8 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -54 -54 -  -  -54 -  -54 -  -  -  -54 -  -  -  -  -  -54 -  -  -  -  -  -  -54 -554 -  -  -554 -  -  -554 -  -  -554 -324 -324 -  -554 -176 -  -554 -  -  -  -554 -  -  -54 -  -  -  -54 -  -  -54 -53 -53 -  -  -54 -  -  -  -  -54 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -54 -  -54 -54 -  -1 -1 -  -53 -3 -  -  -  -  -50 -50 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -19 -19 -  -  -19 -19 -183 -  -19 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -12 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -11 -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -3 -  -  -  -  -  -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -  -  -11 -11 -11 -11 -11 -11 -11 -11 -11 -  -  -11 -  -  -11 -11 -  -  -  -  -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -11 -  -  -11 -11 -11 -11 -11 -11 -11 -11 -  -11 -1331 -583 -25 -25 -25 -  -  -  -  -  -  -  -11 -11 -  -  -11 -11 -  -11 -1375 -44 -16 -16 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -  -  -11 -11 -11 -  -  -11 -33 -33 -4 -  -  -  -  -11 -44 -44 -  -  -  -  -  -  -11 -33 -33 -3 -  -  -  -  -  -11 -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -  -11 -11 -11 -  -11 -  -  -  -  -  -1 -  -  -1 -  -  -  -  -  -  -  -  -  -  -  -  -  -1 -  -1 -1 -  -  -  -  -  -  -  -  -  -  -  - 
/**
- * @license
- * Lo-Dash 1.2.1 <http://lodash.com/>
- * Copyright 2012-2013 The Dojo Foundation <http://dojofoundation.org/>
- * Based on Underscore.js 1.4.4 <http://underscorejs.org/>
- * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
- * Available under MIT license <http://lodash.com/license>
- */
-;(function(window) {
- 
-  /** Used as a safe reference for `undefined` in pre ES5 environments */
-  var undefined;
- 
-  /** Detect free variable `exports` */
-  var freeExports = typeof exports == 'object' && exports;
- 
-  /** Detect free variable `module` */
-  var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;
- 
-  /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */
-  var freeGlobal = typeof global == 'object' && global;
-  Eif (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {
-    window = freeGlobal;
-  }
- 
-  /** Used to generate unique IDs */
-  var idCounter = 0;
- 
-  /** Used internally to indicate various things */
-  var indicatorObject = {};
- 
-  /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */
-  var keyPrefix = +new Date + '';
- 
-  /** Used as the size when optimizations are enabled for large arrays */
-  var largeArraySize = 75;
- 
-  /** Used to match empty string literals in compiled template source */
-  var reEmptyStringLeading = /\b__p \+= '';/g,
-      reEmptyStringMiddle = /\b(__p \+=) '' \+/g,
-      reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
- 
-  /** Used to match HTML entities */
-  var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
- 
-  /**
-   * Used to match ES6 template delimiters
-   * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6
-   */
-  var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
- 
-  /** Used to match regexp flags from their coerced string values */
-  var reFlags = /\w*$/;
- 
-  /** Used to match "interpolate" template delimiters */
-  var reInterpolate = /<%=([\s\S]+?)%>/g;
- 
-  /** Used to detect functions containing a `this` reference */
-  var reThis = (reThis = /\bthis\b/) && reThis.test(runInContext) && reThis;
- 
-  /** Used to detect and test whitespace */
-  var whitespace = (
-    // whitespace
-    ' \t\x0B\f\xA0\ufeff' +
- 
-    // line terminators
-    '\n\r\u2028\u2029' +
- 
-    // unicode category "Zs" space separators
-    '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000'
-  );
- 
-  /** Used to match leading whitespace and zeros to be removed */
-  var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)');
- 
-  /** Used to ensure capturing order of template delimiters */
-  var reNoMatch = /($^)/;
- 
-  /** Used to match HTML characters */
-  var reUnescapedHtml = /[&<>"']/g;
- 
-  /** Used to match unescaped characters in compiled string literals */
-  var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g;
- 
-  /** Used to assign default `context` object properties */
-  var contextProps = [
-    'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object',
-    'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN',
-    'parseInt', 'setImmediate', 'setTimeout'
-  ];
- 
-  /** Used to fix the JScript [[DontEnum]] bug */
-  var shadowedProps = [
-    'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable',
-    'toLocaleString', 'toString', 'valueOf'
-  ];
- 
-  /** Used to make template sourceURLs easier to identify */
-  var templateCounter = 0;
- 
-  /** `Object#toString` result shortcuts */
-  var argsClass = '[object Arguments]',
-      arrayClass = '[object Array]',
-      boolClass = '[object Boolean]',
-      dateClass = '[object Date]',
-      errorClass = '[object Error]',
-      funcClass = '[object Function]',
-      numberClass = '[object Number]',
-      objectClass = '[object Object]',
-      regexpClass = '[object RegExp]',
-      stringClass = '[object String]';
- 
-  /** Used to identify object classifications that `_.clone` supports */
-  var cloneableClasses = {};
-  cloneableClasses[funcClass] = false;
-  cloneableClasses[argsClass] = cloneableClasses[arrayClass] =
-  cloneableClasses[boolClass] = cloneableClasses[dateClass] =
-  cloneableClasses[numberClass] = cloneableClasses[objectClass] =
-  cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true;
- 
-  /** Used to determine if values are of the language type Object */
-  var objectTypes = {
-    'boolean': false,
-    'function': true,
-    'object': true,
-    'number': false,
-    'string': false,
-    'undefined': false
-  };
- 
-  /** Used to escape characters for inclusion in compiled string literals */
-  var stringEscapes = {
-    '\\': '\\',
-    "'": "'",
-    '\n': 'n',
-    '\r': 'r',
-    '\t': 't',
-    '\u2028': 'u2028',
-    '\u2029': 'u2029'
-  };
- 
-  /*--------------------------------------------------------------------------*/
- 
-  /**
-   * Create a new `lodash` function using the given `context` object.
-   *
-   * @static
-   * @memberOf _
-   * @category Utilities
-   * @param {Object} [context=window] The context object.
-   * @returns {Function} Returns the `lodash` function.
-   */
-  function runInContext(context) {
-    // Avoid issues with some ES3 environments that attempt to use values, named
-    // after built-in constructors like `Object`, for the creation of literals.
-    // ES5 clears this up by stating that literals must use built-in constructors.
-    // See http://es5.github.com/#x11.1.5.
-    context = context ? _.defaults(window.Object(), context, _.pick(window, contextProps)) : window;
- 
-    /** Native constructor references */
-    var Array = context.Array,
-        Boolean = context.Boolean,
-        Date = context.Date,
-        Error = context.Error,
-        Function = context.Function,
-        Math = context.Math,
-        Number = context.Number,
-        Object = context.Object,
-        RegExp = context.RegExp,
-        String = context.String,
-        TypeError = context.TypeError;
- 
-    /** Used for `Array` and `Object` method references */
-    var arrayProto = Array.prototype,
-        errorProto = Error.prototype,
-        objectProto = Object.prototype,
-        stringProto = String.prototype;
- 
-    /** Used to restore the original `_` reference in `noConflict` */
-    var oldDash = context._;
- 
-    /** Used to detect if a method is native */
-    var reNative = RegExp('^' +
-      String(objectProto.valueOf)
-        .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
-        .replace(/valueOf|for [^\]]+/g, '.+?') + '$'
-    );
- 
-    /** Native method shortcuts */
-    var ceil = Math.ceil,
-        clearTimeout = context.clearTimeout,
-        concat = arrayProto.concat,
-        floor = Math.floor,
-        fnToString = Function.prototype.toString,
-        getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf,
-        hasOwnProperty = objectProto.hasOwnProperty,
-        push = arrayProto.push,
-        propertyIsEnumerable = objectProto.propertyIsEnumerable,
-        setImmediate = context.setImmediate,
-        setTimeout = context.setTimeout,
-        toString = objectProto.toString;
- 
-    /* Native method shortcuts for methods with the same name as other `lodash` methods */
-    var nativeBind = reNative.test(nativeBind = toString.bind) && nativeBind,
-        nativeCreate = reNative.test(nativeCreate =  Object.create) && nativeCreate,
-        nativeIsArray = reNative.test(nativeIsArray = Array.isArray) && nativeIsArray,
-        nativeIsFinite = context.isFinite,
-        nativeIsNaN = context.isNaN,
-        nativeKeys = reNative.test(nativeKeys = Object.keys) && nativeKeys,
-        nativeMax = Math.max,
-        nativeMin = Math.min,
-        nativeParseInt = context.parseInt,
-        nativeRandom = Math.random,
-        nativeSlice = arrayProto.slice;
- 
-    /** Detect various environments */
-    var isIeOpera = reNative.test(context.attachEvent),
-        isV8 = nativeBind && !/\n|true/.test(nativeBind + isIeOpera);
- 
-    /** Used to lookup a built-in constructor by [[Class]] */
-    var ctorByClass = {};
-    ctorByClass[arrayClass] = Array;
-    ctorByClass[boolClass] = Boolean;
-    ctorByClass[dateClass] = Date;
-    ctorByClass[funcClass] = Function;
-    ctorByClass[objectClass] = Object;
-    ctorByClass[numberClass] = Number;
-    ctorByClass[regexpClass] = RegExp;
-    ctorByClass[stringClass] = String;
- 
-    /** Used to avoid iterating non-enumerable properties in IE < 9 */
-    var nonEnumProps = {};
-    nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
-    nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
-    nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
-    nonEnumProps[objectClass] = { 'constructor': true };
- 
-    (function() {
-      var length = shadowedProps.length;
-      while (length--) {
-        var prop = shadowedProps[length];
-        for (var className in nonEnumProps) {
-          if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], prop)) {
-            nonEnumProps[className][prop] = false;
-          }
-        }
-      }
-    }());
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * Creates a `lodash` object, which wraps the given `value`, to enable method
-     * chaining.
-     *
-     * In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
-     * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`,
-     * and `unshift`
-     *
-     * Chaining is supported in custom builds as long as the `value` method is
-     * implicitly or explicitly included in the build.
-     *
-     * The chainable wrapper functions are:
-     * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`,
-     * `compose`, `concat`, `countBy`, `createCallback`, `debounce`, `defaults`,
-     * `defer`, `delay`, `difference`, `filter`, `flatten`, `forEach`, `forIn`,
-     * `forOwn`, `functions`, `groupBy`, `initial`, `intersection`, `invert`,
-     * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`,
-     * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `push`, `range`,
-     * `reject`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, `sortBy`, `splice`,
-     * `tap`, `throttle`, `times`, `toArray`, `transform`, `union`, `uniq`, `unshift`,
-     * `unzip`, `values`, `where`, `without`, `wrap`, and `zip`
-     *
-     * The non-chainable wrapper functions are:
-     * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `has`,
-     * `identity`, `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`,
-     * `isElement`, `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`,
-     * `isNull`, `isNumber`, `isObject`, `isPlainObject`, `isRegExp`, `isString`,
-     * `isUndefined`, `join`, `lastIndexOf`, `mixin`, `noConflict`, `parseInt`,
-     * `pop`, `random`, `reduce`, `reduceRight`, `result`, `shift`, `size`, `some`,
-     * `sortedIndex`, `runInContext`, `template`, `unescape`, `uniqueId`, and `value`
-     *
-     * The wrapper functions `first` and `last` return wrapped values when `n` is
-     * passed, otherwise they return unwrapped values.
-     *
-     * @name _
-     * @constructor
-     * @alias chain
-     * @category Chaining
-     * @param {Mixed} value The value to wrap in a `lodash` instance.
-     * @returns {Object} Returns a `lodash` instance.
-     * @example
-     *
-     * var wrapped = _([1, 2, 3]);
-     *
-     * // returns an unwrapped value
-     * wrapped.reduce(function(sum, num) {
-     *   return sum + num;
-     * });
-     * // => 6
-     *
-     * // returns a wrapped value
-     * var squares = wrapped.map(function(num) {
-     *   return num * num;
-     * });
-     *
-     * _.isArray(squares);
-     * // => false
-     *
-     * _.isArray(squares.value());
-     * // => true
-     */
-    function lodash(value) {
-      // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor
-      return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__'))
-       ? value
-       : new lodashWrapper(value);
-    }
- 
-    /**
-     * An object used to flag environments features.
-     *
-     * @static
-     * @memberOf _
-     * @type Object
-     */
-    var support = lodash.support = {};
- 
-    (function() {
-      var ctor = function() { this.x = 1; },
-          object = { '0': 1, 'length': 1 },
-          props = [];
- 
-      ctor.prototype = { 'valueOf': 1, 'y': 1 };
-      for (var prop in new ctor) { props.push(prop); }
-      for (prop in arguments) { }
- 
-      /**
-       * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5).
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.argsObject = arguments.constructor == Object && !(arguments instanceof Array);
- 
-      /**
-       * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9).
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.argsClass = isArguments(arguments);
- 
-      /**
-       * Detect if `name` or `message` properties of `Error.prototype` are
-       * enumerable by default. (IE < 9, Safari < 5.1)
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
- 
-      /**
-       * Detect if `prototype` properties are enumerable by default.
-       *
-       * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1
-       * (if the prototype or a property on the prototype has been set)
-       * incorrectly sets a function's `prototype` property [[Enumerable]]
-       * value to `true`.
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
- 
-      /**
-       * Detect if `Function#bind` exists and is inferred to be fast (all but V8).
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.fastBind = nativeBind && !isV8;
- 
-      /**
-       * Detect if own properties are iterated after inherited properties (all but IE < 9).
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.ownLast = props[0] != 'x';
- 
-      /**
-       * Detect if `arguments` object indexes are non-enumerable
-       * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1).
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.nonEnumArgs = prop != 0;
- 
-      /**
-       * Detect if properties shadowing those on `Object.prototype` are non-enumerable.
-       *
-       * In IE < 9 an objects own properties, shadowing non-enumerable ones, are
-       * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug).
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.nonEnumShadows = !/valueOf/.test(props);
- 
-      /**
-       * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly.
-       *
-       * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()`
-       * and `splice()` functions that fail to remove the last element, `value[0]`,
-       * of array-like objects even though the `length` property is set to `0`.
-       * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()`
-       * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9.
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]);
- 
-      /**
-       * Detect lack of support for accessing string characters by index.
-       *
-       * IE < 8 can't access characters by index and IE 8 can only access
-       * characters by index on string literals.
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx';
- 
-      /**
-       * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9)
-       * and that the JS engine errors when attempting to coerce an object to
-       * a string without a `toString` function.
-       *
-       * @memberOf _.support
-       * @type Boolean
-       */
-      try {
-        support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
-      } catch(e) {
-        support.nodeClass = true;
-      }
-    }(1));
- 
-    /**
-     * By default, the template delimiters used by Lo-Dash are similar to those in
-     * embedded Ruby (ERB). Change the following template settings to use alternative
-     * delimiters.
-     *
-     * @static
-     * @memberOf _
-     * @type Object
-     */
-    lodash.templateSettings = {
- 
-      /**
-       * Used to detect `data` property values to be HTML-escaped.
-       *
-       * @memberOf _.templateSettings
-       * @type RegExp
-       */
-      'escape': /<%-([\s\S]+?)%>/g,
- 
-      /**
-       * Used to detect code to be evaluated.
-       *
-       * @memberOf _.templateSettings
-       * @type RegExp
-       */
-      'evaluate': /<%([\s\S]+?)%>/g,
- 
-      /**
-       * Used to detect `data` property values to inject.
-       *
-       * @memberOf _.templateSettings
-       * @type RegExp
-       */
-      'interpolate': reInterpolate,
- 
-      /**
-       * Used to reference the data object in the template text.
-       *
-       * @memberOf _.templateSettings
-       * @type String
-       */
-      'variable': '',
- 
-      /**
-       * Used to import variables into the compiled template.
-       *
-       * @memberOf _.templateSettings
-       * @type Object
-       */
-      'imports': {
- 
-        /**
-         * A reference to the `lodash` function.
-         *
-         * @memberOf _.templateSettings.imports
-         * @type Function
-         */
-        '_': lodash
-      }
-    };
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * The template used to create iterator functions.
-     *
-     * @private
-     * @param {Object} data The data object used to populate the text.
-     * @returns {String} Returns the interpolated text.
-     */
-    var iteratorTemplate = template(
-      // the `iterable` may be reassigned by the `top` snippet
-      'var index, iterable = <%= firstArg %>, ' +
-      // assign the `result` variable an initial value
-      'result = <%= init %>;\n' +
-      // exit early if the first argument is falsey
-      'if (!iterable) return result;\n' +
-      // add code before the iteration branches
-      '<%= top %>;' +
- 
-      // array-like iteration:
-      '<% if (arrays) { %>\n' +
-      'var length = iterable.length; index = -1;\n' +
-      'if (<%= arrays %>) {' +
- 
-      // add support for accessing string characters by index if needed
-      '  <% if (support.unindexedChars) { %>\n' +
-      '  if (isString(iterable)) {\n' +
-      "    iterable = iterable.split('')\n" +
-      '  }' +
-      '  <% } %>\n' +
- 
-      // iterate over the array-like value
-      '  while (++index < length) {\n' +
-      '    <%= loop %>;\n' +
-      '  }\n' +
-      '}\n' +
-      'else {' +
- 
-      // object iteration:
-      // add support for iterating over `arguments` objects if needed
-      '  <% } else if (support.nonEnumArgs) { %>\n' +
-      '  var length = iterable.length; index = -1;\n' +
-      '  if (length && isArguments(iterable)) {\n' +
-      '    while (++index < length) {\n' +
-      "      index += '';\n" +
-      '      <%= loop %>;\n' +
-      '    }\n' +
-      '  } else {' +
-      '  <% } %>' +
- 
-      // avoid iterating over `prototype` properties in older Firefox, Opera, and Safari
-      '  <% if (support.enumPrototypes) { %>\n' +
-      "  var skipProto = typeof iterable == 'function';\n" +
-      '  <% } %>' +
- 
-      // avoid iterating over `Error.prototype` properties in older IE and Safari
-      '  <% if (support.enumErrorProps) { %>\n' +
-      '  var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n' +
-      '  <% } %>' +
- 
-      // define conditions used in the loop
-      '  <%' +
-      '    var conditions = [];' +
-      '    if (support.enumPrototypes) { conditions.push(\'!(skipProto && index == "prototype")\'); }' +
-      '    if (support.enumErrorProps)  { conditions.push(\'!(skipErrorProps && (index == "message" || index == "name"))\'); }' +
-      '  %>' +
- 
-      // iterate own properties using `Object.keys`
-      '  <% if (useHas && useKeys) { %>\n' +
-      '  var ownIndex = -1,\n' +
-      '      ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n' +
-      '      length = ownProps.length;\n\n' +
-      '  while (++ownIndex < length) {\n' +
-      '    index = ownProps[ownIndex];\n<%' +
-      "    if (conditions.length) { %>    if (<%= conditions.join(' && ') %>) {\n  <% } %>" +
-      '    <%= loop %>;' +
-      '    <% if (conditions.length) { %>\n    }<% } %>\n' +
-      '  }' +
- 
-      // else using a for-in loop
-      '  <% } else { %>\n' +
-      '  for (index in iterable) {\n<%' +
-      '    if (useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); }' +
-      "    if (conditions.length) { %>    if (<%= conditions.join(' && ') %>) {\n  <% } %>" +
-      '    <%= loop %>;' +
-      '    <% if (conditions.length) { %>\n    }<% } %>\n' +
-      '  }' +
- 
-      // Because IE < 9 can't set the `[[Enumerable]]` attribute of an
-      // existing property and the `constructor` property of a prototype
-      // defaults to non-enumerable, Lo-Dash skips the `constructor`
-      // property when it infers it's iterating over a `prototype` object.
-      '    <% if (support.nonEnumShadows) { %>\n\n' +
-      '  if (iterable !== objectProto) {\n' +
-      "    var ctor = iterable.constructor,\n" +
-      '        isProto = iterable === (ctor && ctor.prototype),\n' +
-      '        className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n' +
-      '        nonEnum = nonEnumProps[className];\n' +
-      '      <% for (k = 0; k < 7; k++) { %>\n' +
-      "    index = '<%= shadowedProps[k] %>';\n" +
-      '    if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))<%' +
-      '        if (!useHas) { %> || (!nonEnum[index] && iterable[index] !== objectProto[index])<% }' +
-      '      %>) {\n' +
-      '      <%= loop %>;\n' +
-      '    }' +
-      '      <% } %>\n' +
-      '  }' +
-      '    <% } %>' +
-      '  <% } %>' +
-      '  <% if (arrays || support.nonEnumArgs) { %>\n}<% } %>\n' +
- 
-      // add code to the bottom of the iteration function
-      '<%= bottom %>;\n' +
-      // finally, return the `result`
-      'return result'
-    );
- 
-    /** Reusable iterator options for `assign` and `defaults` */
-    var defaultsIteratorOptions = {
-      'args': 'object, source, guard',
-      'top':
-        'var args = arguments,\n' +
-        '    argsIndex = 0,\n' +
-        "    argsLength = typeof guard == 'number' ? 2 : args.length;\n" +
-        'while (++argsIndex < argsLength) {\n' +
-        '  iterable = args[argsIndex];\n' +
-        '  if (iterable && objectTypes[typeof iterable]) {',
-      'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]",
-      'bottom': '  }\n}'
-    };
- 
-    /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */
-    var eachIteratorOptions = {
-      'args': 'collection, callback, thisArg',
-      'top': "callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg)",
-      'arrays': "typeof length == 'number'",
-      'loop': 'if (callback(iterable[index], index, collection) === false) return result'
-    };
- 
-    /** Reusable iterator options for `forIn` and `forOwn` */
-    var forOwnIteratorOptions = {
-      'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top,
-      'arrays': false
-    };
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * A basic version of `_.indexOf` without support for binary searches
-     * or `fromIndex` constraints.
-     *
-     * @private
-     * @param {Array} array The array to search.
-     * @param {Mixed} value The value to search for.
-     * @param {Number} [fromIndex=0] The index to search from.
-     * @returns {Number} Returns the index of the matched value or `-1`.
-     */
-    function basicIndexOf(array, value, fromIndex) {
-      var index = (fromIndex || 0) - 1,
-          length = array.length;
- 
-      while (++index < length) {
-        if (array[index] === value) {
-          return index;
-        }
-      }
-      return -1;
-    }
- 
-    /**
-     * Used by `_.max` and `_.min` as the default `callback` when a given
-     * `collection` is a string value.
-     *
-     * @private
-     * @param {String} value The character to inspect.
-     * @returns {Number} Returns the code unit of given character.
-     */
-    function charAtCallback(value) {
-      return value.charCodeAt(0);
-    }
- 
-    /**
-     * Used by `sortBy` to compare transformed `collection` values, stable sorting
-     * them in ascending order.
-     *
-     * @private
-     * @param {Object} a The object to compare to `b`.
-     * @param {Object} b The object to compare to `a`.
-     * @returns {Number} Returns the sort order indicator of `1` or `-1`.
-     */
-    function compareAscending(a, b) {
-      var ai = a.index,
-          bi = b.index;
- 
-      a = a.criteria;
-      b = b.criteria;
- 
-      // ensure a stable sort in V8 and other engines
-      // http://code.google.com/p/v8/issues/detail?id=90
-      if (a !== b) {
-        if (a > b || typeof a == 'undefined') {
-          return 1;
-        }
-        Eif (a < b || typeof b == 'undefined') {
-          return -1;
-        }
-      }
-      return ai < bi ? -1 : 1;
-    }
- 
-    /**
-     * Creates a function that, when called, invokes `func` with the `this` binding
-     * of `thisArg` and prepends any `partialArgs` to the arguments passed to the
-     * bound function.
-     *
-     * @private
-     * @param {Function|String} func The function to bind or the method name.
-     * @param {Mixed} [thisArg] The `this` binding of `func`.
-     * @param {Array} partialArgs An array of arguments to be partially applied.
-     * @param {Object} [idicator] Used to indicate binding by key or partially
-     *  applying arguments from the right.
-     * @returns {Function} Returns the new bound function.
-     */
-    function createBound(func, thisArg, partialArgs, indicator) {
-      var isFunc = isFunction(func),
-          isPartial = !partialArgs,
-          key = thisArg;
- 
-      // juggle arguments
-      if (isPartial) {
-        var rightIndicator = indicator;
-        partialArgs = thisArg;
-      }
-      else if (!isFunc) {
-        if (!indicator) {
-          throw new TypeError;
-        }
-        thisArg = func;
-      }
- 
-      function bound() {
-        // `Function#bind` spec
-        // http://es5.github.com/#x15.3.4.5
-        var args = arguments,
-            thisBinding = isPartial ? this : thisArg;
- 
-        if (!isFunc) {
-          func = thisArg[key];
-        }
-        if (partialArgs.length) {
-          args = args.length
-            ? (args = nativeSlice.call(args), rightIndicator ? args.concat(partialArgs) : partialArgs.concat(args))
-            : partialArgs;
-        }
-        if (this instanceof bound) {
-          // ensure `new bound` is an instance of `func`
-          thisBinding = createObject(func.prototype);
- 
-          // mimic the constructor's `return` behavior
-          // http://es5.github.com/#x13.2.2
-          var result = func.apply(thisBinding, args);
-          return isObject(result) ? result : thisBinding;
-        }
-        return func.apply(thisBinding, args);
-      }
-      return bound;
-    }
- 
- 
-    /**
-     * Creates a function optimized to search large arrays for a given `value`,
-     * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`.
-     *
-     * @private
-     * @param {Array} [array=[]] The array to search.
-     * @param {Mixed} value The value to search for.
-     * @returns {Boolean} Returns `true`, if `value` is found, else `false`.
-     */
-    function createCache(array) {
-      array || (array = []);
- 
-      var bailout,
-          index = -1,
-          indexOf = getIndexOf(),
-          length = array.length,
-          isLarge = length >= largeArraySize && lodash.indexOf != indexOf,
-          objCache = {};
- 
-      var caches = {
-        'false': false,
-        'function': false,
-        'null': false,
-        'number': {},
-        'object': objCache,
-        'string': {},
-        'true': false,
-        'undefined': false
-      };
- 
-      function basicContains(value) {
-        return indexOf(array, value) > -1;
-      }
- 
-      function basicPush(value) {
-        array.push(value);
-      }
- 
-      function cacheContains(value) {
-        var type = typeof value;
-        Iif (type == 'boolean' || value == null) {
-          return caches[value];
-        }
-        var cache = caches[type] || (type = 'object', objCache),
-            key = type == 'number' ? value : keyPrefix + value;
- 
-        return type == 'object'
-          ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false)
-          : !!cache[key];
-      }
- 
-      function cachePush(value) {
-        var type = typeof value;
-        Iif (type == 'boolean' || value == null) {
-          caches[value] = true;
-        } else {
-          var cache = caches[type] || (type = 'object', objCache),
-              key = type == 'number' ? value : keyPrefix + value;
- 
-          if (type == 'object') {
-            bailout = (cache[key] || (cache[key] = [])).push(value) == length;
-          } else {
-            cache[key] = true;
-          }
-        }
-      }
- 
-      if (isLarge) {
-        while (++index < length) {
-          cachePush(array[index]);
-        }
-        Iif (bailout) {
-          isLarge = caches = objCache = null;
-        }
-      }
-      return isLarge
-        ? { 'contains': cacheContains, 'push': cachePush }
-        : { 'contains': basicContains, 'push': basicPush };
-    }
- 
-    /**
-     * Creates compiled iteration functions.
-     *
-     * @private
-     * @param {Object} [options1, options2, ...] The compile options object(s).
-     *  arrays - A string of code to determine if the iterable is an array or array-like.
-     *  useHas - A boolean to specify using `hasOwnProperty` checks in the object loop.
-     *  useKeys - A boolean to specify using `_.keys` for own property iteration.
-     *  args - A string of comma separated arguments the iteration function will accept.
-     *  top - A string of code to execute before the iteration branches.
-     *  loop - A string of code to execute in the object loop.
-     *  bottom - A string of code to execute after the iteration branches.
-     * @returns {Function} Returns the compiled function.
-     */
-    function createIterator() {
-      var data = {
-        // data properties
-        'shadowedProps': shadowedProps,
-        'support': support,
- 
-        // iterator options
-        'arrays': '',
-        'bottom': '',
-        'init': 'iterable',
-        'loop': '',
-        'top': '',
-        'useHas': true,
-        'useKeys': !!keys
-      };
- 
-      // merge options into a template data object
-      for (var object, index = 0; object = arguments[index]; index++) {
-        for (var key in object) {
-          data[key] = object[key];
-        }
-      }
-      var args = data.args;
-      data.firstArg = /^[^,]+/.exec(args)[0];
- 
-      // create the function factory
-      var factory = Function(
-          'errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, ' +
-          'keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, ' +
-          'stringProto, toString',
-        'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}'
-      );
-      // return the compiled function
-      return factory(
-        errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString,
-        keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass,
-        stringProto, toString
-      );
-    }
- 
-    /**
-     * Creates a new object with the specified `prototype`.
-     *
-     * @private
-     * @param {Object} prototype The prototype object.
-     * @returns {Object} Returns the new object.
-     */
-    function createObject(prototype) {
-      return isObject(prototype) ? nativeCreate(prototype) : {};
-    }
-    // fallback for browsers without `Object.create`
-    Iif  (!nativeCreate) {
-      var createObject = function(prototype) {
-        if (isObject(prototype)) {
-          noop.prototype = prototype;
-          var result = new noop;
-          noop.prototype = null;
-        }
-        return result || {};
-      };
-    }
- 
-    /**
-     * Used by `escape` to convert characters to HTML entities.
-     *
-     * @private
-     * @param {String} match The matched character to escape.
-     * @returns {String} Returns the escaped character.
-     */
-    function escapeHtmlChar(match) {
-      return htmlEscapes[match];
-    }
- 
-    /**
-     * Used by `template` to escape characters for inclusion in compiled
-     * string literals.
-     *
-     * @private
-     * @param {String} match The matched character to escape.
-     * @returns {String} Returns the escaped character.
-     */
-    function escapeStringChar(match) {
-      return '\\' + stringEscapes[match];
-    }
- 
-    /**
-     * Gets the appropriate "indexOf" function. If the `_.indexOf` method is
-     * customized, this method returns the custom method, otherwise it returns
-     * the `basicIndexOf` function.
-     *
-     * @private
-     * @returns {Function} Returns the "indexOf" function.
-     */
-    function getIndexOf(array, value, fromIndex) {
-      var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result;
-      return result;
-    }
- 
-    /**
-     * Checks if `value` is a DOM node in IE < 9.
-     *
-     * @private
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true` if the `value` is a DOM node, else `false`.
-     */
-    function isNode(value) {
-      // IE < 9 presents DOM nodes as `Object` objects except they have `toString`
-      // methods that are `typeof` "string" and still can coerce nodes to strings
-      return typeof value.toString != 'function' && typeof (value + '') == 'string';
-    }
- 
-    /**
-     * A fast path for creating `lodash` wrapper objects.
-     *
-     * @private
-     * @param {Mixed} value The value to wrap in a `lodash` instance.
-     * @returns {Object} Returns a `lodash` instance.
-     */
-    function lodashWrapper(value) {
-      this.__wrapped__ = value;
-    }
-    // ensure `new lodashWrapper` is an instance of `lodash`
-    lodashWrapper.prototype = lodash.prototype;
- 
-    /**
-     * A no-operation function.
-     *
-     * @private
-     */
-    function noop() {
-      // no operation performed
-    }
- 
-    /**
-     * Creates a function that juggles arguments, allowing argument overloading
-     * for `_.flatten` and `_.uniq`, before passing them to the given `func`.
-     *
-     * @private
-     * @param {Function} func The function to wrap.
-     * @returns {Function} Returns the new function.
-     */
-    function overloadWrapper(func) {
-      return function(array, flag, callback, thisArg) {
-        // juggle arguments
-        if (typeof flag != 'boolean' && flag != null) {
-          thisArg = callback;
-          callback = !(thisArg && thisArg[flag] === array) ? flag : undefined;
-          flag = false;
-        }
-        if (callback != null) {
-          callback = lodash.createCallback(callback, thisArg);
-        }
-        return func(array, flag, callback, thisArg);
-      };
-    }
- 
-    /**
-     * A fallback implementation of `isPlainObject` which checks if a given `value`
-     * is an object created by the `Object` constructor, assuming objects created
-     * by the `Object` constructor have no inherited enumerable properties and that
-     * there are no `Object.prototype` extensions.
-     *
-     * @private
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`.
-     */
-    function shimIsPlainObject(value) {
-      var ctor,
-          result;
- 
-      // avoid non Object objects, `arguments` objects, and DOM elements
-      Iif (!(value && toString.call(value) == objectClass) ||
-          (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) ||
-          (!support.argsClass && isArguments(value)) ||
-          (!support.nodeClass && isNode(value))) {
-        return false;
-      }
-      // IE < 9 iterates inherited properties before own properties. If the first
-      // iterated property is an object's own property then there are no inherited
-      // enumerable properties.
-      Iif (support.ownLast) {
-        forIn(value, function(value, key, object) {
-          result = hasOwnProperty.call(object, key);
-          return false;
-        });
-        return result !== false;
-      }
-      // In most environments an object's own properties are iterated before
-      // its inherited properties. If the last iterated property is an object's
-      // own property then there are no inherited enumerable properties.
-      forIn(value, function(value, key) {
-        result = key;
-      });
-      return result === undefined || hasOwnProperty.call(value, result);
-    }
- 
-    /**
-     * Slices the `collection` from the `start` index up to, but not including,
-     * the `end` index.
-     *
-     * Note: This function is used, instead of `Array#slice`, to support node lists
-     * in IE < 9 and to ensure dense arrays are returned.
-     *
-     * @private
-     * @param {Array|Object|String} collection The collection to slice.
-     * @param {Number} start The start index.
-     * @param {Number} end The end index.
-     * @returns {Array} Returns the new array.
-     */
-    function slice(array, start, end) {
-      start || (start = 0);
-      if (typeof end == 'undefined') {
-        end = array ? array.length : 0;
-      }
-      var index = -1,
-          length = end - start || 0,
-          result = Array(length < 0 ? 0 : length);
- 
-      while (++index < length) {
-        result[index] = array[start + index];
-      }
-      return result;
-    }
- 
-    /**
-     * Used by `unescape` to convert HTML entities to characters.
-     *
-     * @private
-     * @param {String} match The matched character to unescape.
-     * @returns {String} Returns the unescaped character.
-     */
-    function unescapeHtmlChar(match) {
-      return htmlUnescapes[match];
-    }
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * Checks if `value` is an `arguments` object.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`.
-     * @example
-     *
-     * (function() { return _.isArguments(arguments); })(1, 2, 3);
-     * // => true
-     *
-     * _.isArguments([1, 2, 3]);
-     * // => false
-     */
-    function isArguments(value) {
-      return toString.call(value) == argsClass;
-    }
-    // fallback for browsers that can't detect `arguments` objects by [[Class]]
-    Iif (!support.argsClass) {
-      isArguments = function(value) {
-        return value ? hasOwnProperty.call(value, 'callee') : false;
-      };
-    }
- 
-    /**
-     * Checks if `value` is an array.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is an array, else `false`.
-     * @example
-     *
-     * (function() { return _.isArray(arguments); })();
-     * // => false
-     *
-     * _.isArray([1, 2, 3]);
-     * // => true
-     */
-    var isArray = nativeIsArray || function(value) {
-      return value ? (typeof value == 'object' && toString.call(value) == arrayClass) : false;
-    };
- 
-    /**
-     * A fallback implementation of `Object.keys` which produces an array of the
-     * given object's own enumerable property names.
-     *
-     * @private
-     * @type Function
-     * @param {Object} object The object to inspect.
-     * @returns {Array} Returns a new array of property names.
-     */
-    var shimKeys = createIterator({
-      'args': 'object',
-      'init': '[]',
-      'top': 'if (!(objectTypes[typeof object])) return result',
-      'loop': 'result.push(index)'
-    });
- 
-    /**
-     * Creates an array composed of the own enumerable property names of `object`.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The object to inspect.
-     * @returns {Array} Returns a new array of property names.
-     * @example
-     *
-     * _.keys({ 'one': 1, 'two': 2, 'three': 3 });
-     * // => ['one', 'two', 'three'] (order is not guaranteed)
-     */
-    var keys = !nativeKeys ? shimKeys : function(object) {
-      if (!isObject(object)) {
-        return [];
-      }
-      Iif ((support.enumPrototypes && typeof object == 'function') ||
-          (support.nonEnumArgs && object.length && isArguments(object))) {
-        return shimKeys(object);
-      }
-      return nativeKeys(object);
-    };
- 
-    /**
-     * A function compiled to iterate `arguments` objects, arrays, objects, and
-     * strings consistenly across environments, executing the `callback` for each
-     * element in the `collection`. The `callback` is bound to `thisArg` and invoked
-     * with three arguments; (value, index|key, collection). Callbacks may exit
-     * iteration early by explicitly returning `false`.
-     *
-     * @private
-     * @type Function
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function} [callback=identity] The function called per iteration.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array|Object|String} Returns `collection`.
-     */
-    var basicEach = createIterator(eachIteratorOptions);
- 
-    /**
-     * Used to convert characters to HTML entities:
-     *
-     * Though the `>` character is escaped for symmetry, characters like `>` and `/`
-     * don't require escaping in HTML and have no special meaning unless they're part
-     * of a tag or an unquoted attribute value.
-     * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact")
-     */
-    var htmlEscapes = {
-      '&': '&amp;',
-      '<': '&lt;',
-      '>': '&gt;',
-      '"': '&quot;',
-      "'": '&#39;'
-    };
- 
-    /** Used to convert HTML entities to characters */
-    var htmlUnescapes = invert(htmlEscapes);
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * Assigns own enumerable properties of source object(s) to the destination
-     * object. Subsequent sources will overwrite property assignments of previous
-     * sources. If a `callback` function is passed, it will be executed to produce
-     * the assigned values. The `callback` is bound to `thisArg` and invoked with
-     * two arguments; (objectValue, sourceValue).
-     *
-     * @static
-     * @memberOf _
-     * @type Function
-     * @alias extend
-     * @category Objects
-     * @param {Object} object The destination object.
-     * @param {Object} [source1, source2, ...] The source objects.
-     * @param {Function} [callback] The function to customize assigning values.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Object} Returns the destination object.
-     * @example
-     *
-     * _.assign({ 'name': 'moe' }, { 'age': 40 });
-     * // => { 'name': 'moe', 'age': 40 }
-     *
-     * var defaults = _.partialRight(_.assign, function(a, b) {
-     *   return typeof a == 'undefined' ? b : a;
-     * });
-     *
-     * var food = { 'name': 'apple' };
-     * defaults(food, { 'name': 'banana', 'type': 'fruit' });
-     * // => { 'name': 'apple', 'type': 'fruit' }
-     */
-    var assign = createIterator(defaultsIteratorOptions, {
-      'top':
-        defaultsIteratorOptions.top.replace(';',
-          ';\n' +
-          "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" +
-          '  var callback = lodash.createCallback(args[--argsLength - 1], args[argsLength--], 2);\n' +
-          "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" +
-          '  callback = args[--argsLength];\n' +
-          '}'
-        ),
-      'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]'
-    });
- 
-    /**
-     * Creates a clone of `value`. If `deep` is `true`, nested objects will also
-     * be cloned, otherwise they will be assigned by reference. If a `callback`
-     * function is passed, it will be executed to produce the cloned values. If
-     * `callback` returns `undefined`, cloning will be handled by the method instead.
-     * The `callback` is bound to `thisArg` and invoked with one argument; (value).
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to clone.
-     * @param {Boolean} [deep=false] A flag to indicate a deep clone.
-     * @param {Function} [callback] The function to customize cloning values.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @param- {Array} [stackA=[]] Tracks traversed source objects.
-     * @param- {Array} [stackB=[]] Associates clones with source counterparts.
-     * @returns {Mixed} Returns the cloned `value`.
-     * @example
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * var shallow = _.clone(stooges);
-     * shallow[0] === stooges[0];
-     * // => true
-     *
-     * var deep = _.clone(stooges, true);
-     * deep[0] === stooges[0];
-     * // => false
-     *
-     * _.mixin({
-     *   'clone': _.partialRight(_.clone, function(value) {
-     *     return _.isElement(value) ? value.cloneNode(false) : undefined;
-     *   })
-     * });
-     *
-     * var clone = _.clone(document.body);
-     * clone.childNodes.length;
-     * // => 0
-     */
-    function clone(value, deep, callback, thisArg, stackA, stackB) {
-      var result = value;
- 
-      // allows working with "Collections" methods without using their `callback`
-      // argument, `index|key`, for this method's `callback`
-      if (typeof deep != 'boolean' && deep != null) {
-        thisArg = callback;
-        callback = deep;
-        deep = false;
-      }
-      if (typeof callback == 'function') {
-        callback = (typeof thisArg == 'undefined')
-          ? callback
-          : lodash.createCallback(callback, thisArg, 1);
- 
-        result = callback(result);
-        if (typeof result != 'undefined') {
-          return result;
-        }
-        result = value;
-      }
-      // inspect [[Class]]
-      var isObj = isObject(result);
-      if (isObj) {
-        var className = toString.call(result);
-        if (!cloneableClasses[className] || (!support.nodeClass && isNode(result))) {
-          return result;
-        }
-        var isArr = isArray(result);
-      }
-      // shallow clone
-      if (!isObj || !deep) {
-        return isObj
-          ? (isArr ? slice(result) : assign({}, result))
-          : result;
-      }
-      var ctor = ctorByClass[className];
-      switch (className) {
-        case boolClass:
-        case dateClass:
-          return new ctor(+result);
- 
-        case numberClass:
-        case stringClass:
-          return new ctor(result);
- 
-        case regexpClass:
-          return ctor(result.source, reFlags.exec(result));
-      }
-      // check for circular references and return corresponding clone
-      stackA || (stackA = []);
-      stackB || (stackB = []);
- 
-      var length = stackA.length;
-      while (length--) {
-        if (stackA[length] == value) {
-          return stackB[length];
-        }
-      }
-      // init cloned object
-      result = isArr ? ctor(result.length) : {};
- 
-      // add array properties assigned by `RegExp#exec`
-      if (isArr) {
-        if (hasOwnProperty.call(value, 'index')) {
-          result.index = value.index;
-        }
-        if (hasOwnProperty.call(value, 'input')) {
-          result.input = value.input;
-        }
-      }
-      // add the source value to the stack of traversed objects
-      // and associate it with its clone
-      stackA.push(value);
-      stackB.push(result);
- 
-      // recursively populate clone (susceptible to call stack limits)
-      (isArr ? basicEach : forOwn)(value, function(objValue, key) {
-        result[key] = clone(objValue, deep, callback, undefined, stackA, stackB);
-      });
- 
-      return result;
-    }
- 
-    /**
-     * Creates a deep clone of `value`. If a `callback` function is passed,
-     * it will be executed to produce the cloned values. If `callback` returns
-     * `undefined`, cloning will be handled by the method instead. The `callback`
-     * is bound to `thisArg` and invoked with one argument; (value).
-     *
-     * Note: This function is loosely based on the structured clone algorithm. Functions
-     * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and
-     * objects created by constructors other than `Object` are cloned to plain `Object` objects.
-     * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to deep clone.
-     * @param {Function} [callback] The function to customize cloning values.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the deep cloned `value`.
-     * @example
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * var deep = _.cloneDeep(stooges);
-     * deep[0] === stooges[0];
-     * // => false
-     *
-     * var view = {
-     *   'label': 'docs',
-     *   'node': element
-     * };
-     *
-     * var clone = _.cloneDeep(view, function(value) {
-     *   return _.isElement(value) ? value.cloneNode(true) : undefined;
-     * });
-     *
-     * clone.node == view.node;
-     * // => false
-     */
-    function cloneDeep(value, callback, thisArg) {
-      return clone(value, true, callback, thisArg);
-    }
- 
-    /**
-     * Assigns own enumerable properties of source object(s) to the destination
-     * object for all destination properties that resolve to `undefined`. Once a
-     * property is set, additional defaults of the same property will be ignored.
-     *
-     * @static
-     * @memberOf _
-     * @type Function
-     * @category Objects
-     * @param {Object} object The destination object.
-     * @param {Object} [source1, source2, ...] The source objects.
-     * @param- {Object} [guard] Allows working with `_.reduce` without using its
-     *  callback's `key` and `object` arguments as sources.
-     * @returns {Object} Returns the destination object.
-     * @example
-     *
-     * var food = { 'name': 'apple' };
-     * _.defaults(food, { 'name': 'banana', 'type': 'fruit' });
-     * // => { 'name': 'apple', 'type': 'fruit' }
-     */
-    var defaults = createIterator(defaultsIteratorOptions);
- 
-    /**
-     * This method is similar to `_.find`, except that it returns the key of the
-     * element that passes the callback check, instead of the element itself.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The object to search.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the key of the found element, else `undefined`.
-     * @example
-     *
-     * _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
-     *   return num % 2 == 0;
-     * });
-     * // => 'b'
-     */
-    function findKey(object, callback, thisArg) {
-      var result;
-      callback = lodash.createCallback(callback, thisArg);
-      forOwn(object, function(value, key, object) {
-        if (callback(value, key, object)) {
-          result = key;
-          return false;
-        }
-      });
-      return result;
-    }
- 
-    /**
-     * Iterates over `object`'s own and inherited enumerable properties, executing
-     * the `callback` for each property. The `callback` is bound to `thisArg` and
-     * invoked with three arguments; (value, key, object). Callbacks may exit iteration
-     * early by explicitly returning `false`.
-     *
-     * @static
-     * @memberOf _
-     * @type Function
-     * @category Objects
-     * @param {Object} object The object to iterate over.
-     * @param {Function} [callback=identity] The function called per iteration.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Object} Returns `object`.
-     * @example
-     *
-     * function Dog(name) {
-     *   this.name = name;
-     * }
-     *
-     * Dog.prototype.bark = function() {
-     *   alert('Woof, woof!');
-     * };
-     *
-     * _.forIn(new Dog('Dagny'), function(value, key) {
-     *   alert(key);
-     * });
-     * // => alerts 'name' and 'bark' (order is not guaranteed)
-     */
-    var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, {
-      'useHas': false
-    });
- 
-    /**
-     * Iterates over an object's own enumerable properties, executing the `callback`
-     * for each property. The `callback` is bound to `thisArg` and invoked with three
-     * arguments; (value, key, object). Callbacks may exit iteration early by explicitly
-     * returning `false`.
-     *
-     * @static
-     * @memberOf _
-     * @type Function
-     * @category Objects
-     * @param {Object} object The object to iterate over.
-     * @param {Function} [callback=identity] The function called per iteration.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Object} Returns `object`.
-     * @example
-     *
-     * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
-     *   alert(key);
-     * });
-     * // => alerts '0', '1', and 'length' (order is not guaranteed)
-     */
-    var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions);
- 
-    /**
-     * Creates a sorted array of all enumerable properties, own and inherited,
-     * of `object` that have function values.
-     *
-     * @static
-     * @memberOf _
-     * @alias methods
-     * @category Objects
-     * @param {Object} object The object to inspect.
-     * @returns {Array} Returns a new array of property names that have function values.
-     * @example
-     *
-     * _.functions(_);
-     * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...]
-     */
-    function functions(object) {
-      var result = [];
-      forIn(object, function(value, key) {
-        if (isFunction(value)) {
-          result.push(key);
-        }
-      });
-      return result.sort();
-    }
- 
-    /**
-     * Checks if the specified object `property` exists and is a direct property,
-     * instead of an inherited property.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The object to check.
-     * @param {String} property The property to check for.
-     * @returns {Boolean} Returns `true` if key is a direct property, else `false`.
-     * @example
-     *
-     * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
-     * // => true
-     */
-    function has(object, property) {
-      return object ? hasOwnProperty.call(object, property) : false;
-    }
- 
-    /**
-     * Creates an object composed of the inverted keys and values of the given `object`.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The object to invert.
-     * @returns {Object} Returns the created inverted object.
-     * @example
-     *
-     *  _.invert({ 'first': 'moe', 'second': 'larry' });
-     * // => { 'moe': 'first', 'larry': 'second' }
-     */
-    function invert(object) {
-      var index = -1,
-          props = keys(object),
-          length = props.length,
-          result = {};
- 
-      while (++index < length) {
-        var key = props[index];
-        result[object[key]] = key;
-      }
-      return result;
-    }
- 
-    /**
-     * Checks if `value` is a boolean value.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`.
-     * @example
-     *
-     * _.isBoolean(null);
-     * // => false
-     */
-    function isBoolean(value) {
-      return value === true || value === false || toString.call(value) == boolClass;
-    }
- 
-    /**
-     * Checks if `value` is a date.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is a date, else `false`.
-     * @example
-     *
-     * _.isDate(new Date);
-     * // => true
-     */
-    function isDate(value) {
-      return value ? (typeof value == 'object' && toString.call(value) == dateClass) : false;
-    }
- 
-    /**
-     * Checks if `value` is a DOM element.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`.
-     * @example
-     *
-     * _.isElement(document.body);
-     * // => true
-     */
-    function isElement(value) {
-      return value ? value.nodeType === 1 : false;
-    }
- 
-    /**
-     * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a
-     * length of `0` and objects with no own enumerable properties are considered
-     * "empty".
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Array|Object|String} value The value to inspect.
-     * @returns {Boolean} Returns `true`, if the `value` is empty, else `false`.
-     * @example
-     *
-     * _.isEmpty([1, 2, 3]);
-     * // => false
-     *
-     * _.isEmpty({});
-     * // => true
-     *
-     * _.isEmpty('');
-     * // => true
-     */
-    function isEmpty(value) {
-      var result = true;
-      if (!value) {
-        return result;
-      }
-      var className = toString.call(value),
-          length = value.length;
- 
-      if ((className == arrayClass || className == stringClass ||
-          (support.argsClass ? className == argsClass : isArguments(value))) ||
-          (className == objectClass && typeof length == 'number' && isFunction(value.splice))) {
-        return !length;
-      }
-      forOwn(value, function() {
-        return (result = false);
-      });
-      return result;
-    }
- 
-    /**
-     * Performs a deep comparison between two values to determine if they are
-     * equivalent to each other. If `callback` is passed, it will be executed to
-     * compare values. If `callback` returns `undefined`, comparisons will be handled
-     * by the method instead. The `callback` is bound to `thisArg` and invoked with
-     * two arguments; (a, b).
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} a The value to compare.
-     * @param {Mixed} b The other value to compare.
-     * @param {Function} [callback] The function to customize comparing values.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @param- {Array} [stackA=[]] Tracks traversed `a` objects.
-     * @param- {Array} [stackB=[]] Tracks traversed `b` objects.
-     * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`.
-     * @example
-     *
-     * var moe = { 'name': 'moe', 'age': 40 };
-     * var copy = { 'name': 'moe', 'age': 40 };
-     *
-     * moe == copy;
-     * // => false
-     *
-     * _.isEqual(moe, copy);
-     * // => true
-     *
-     * var words = ['hello', 'goodbye'];
-     * var otherWords = ['hi', 'goodbye'];
-     *
-     * _.isEqual(words, otherWords, function(a, b) {
-     *   var reGreet = /^(?:hello|hi)$/i,
-     *       aGreet = _.isString(a) && reGreet.test(a),
-     *       bGreet = _.isString(b) && reGreet.test(b);
-     *
-     *   return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;
-     * });
-     * // => true
-     */
-    function isEqual(a, b, callback, thisArg, stackA, stackB) {
-      // used to indicate that when comparing objects, `a` has at least the properties of `b`
-      var whereIndicator = callback === indicatorObject;
-      if (typeof callback == 'function' && !whereIndicator) {
-        callback = lodash.createCallback(callback, thisArg, 2);
-        var result = callback(a, b);
-        if (typeof result != 'undefined') {
-          return !!result;
-        }
-      }
-      // exit early for identical values
-      if (a === b) {
-        // treat `+0` vs. `-0` as not equal
-        return a !== 0 || (1 / a == 1 / b);
-      }
-      var type = typeof a,
-          otherType = typeof b;
- 
-      // exit early for unlike primitive values
-      if (a === a &&
-          (!a || (type != 'function' && type != 'object')) &&
-          (!b || (otherType != 'function' && otherType != 'object'))) {
-        return false;
-      }
-      // exit early for `null` and `undefined`, avoiding ES3's Function#call behavior
-      // http://es5.github.com/#x15.3.4.4
-      if (a == null || b == null) {
-        return a === b;
-      }
-      // compare [[Class]] names
-      var className = toString.call(a),
-          otherClass = toString.call(b);
- 
-      if (className == argsClass) {
-        className = objectClass;
-      }
-      if (otherClass == argsClass) {
-        otherClass = objectClass;
-      }
-      Iif (className != otherClass) {
-        return false;
-      }
-      switch (className) {
-        case boolClass:
-        case dateClass:
-          // coerce dates and booleans to numbers, dates to milliseconds and booleans
-          // to `1` or `0`, treating invalid dates coerced to `NaN` as not equal
-          return +a == +b;
- 
-        case numberClass:
-          // treat `NaN` vs. `NaN` as equal
-          return (a != +a)
-            ? b != +b
-            // but treat `+0` vs. `-0` as not equal
-            : (a == 0 ? (1 / a == 1 / b) : a == +b);
- 
-        case regexpClass:
-        case stringClass:
-          // coerce regexes to strings (http://es5.github.com/#x15.10.6.4)
-          // treat string primitives and their corresponding object instances as equal
-          return a == String(b);
-      }
-      var isArr = className == arrayClass;
-      if (!isArr) {
-        // unwrap any `lodash` wrapped values
-        Iif (hasOwnProperty.call(a, '__wrapped__ ') || hasOwnProperty.call(b, '__wrapped__')) {
-          return isEqual(a.__wrapped__ || a, b.__wrapped__ || b, callback, thisArg, stackA, stackB);
-        }
-        // exit for functions and DOM nodes
-        Iif (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
-          return false;
-        }
-        // in older versions of Opera, `arguments` objects have `Array` constructors
-        var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
-            ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
- 
-        // non `Object` object instances with different constructors are not equal
-        if (ctorA != ctorB && !(
-              isFunction(ctorA) && ctorA instanceof ctorA &&
-              isFunction(ctorB) && ctorB instanceof ctorB
-            )) {
-          return false;
-        }
-      }
-      // assume cyclic structures are equal
-      // the algorithm for detecting cyclic structures is adapted from ES 5.1
-      // section 15.12.3, abstract operation `JO` (http://es5.github.com/#x15.12.3)
-      stackA || (stackA = []);
-      stackB || (stackB = []);
- 
-      var length = stackA.length;
-      while (length--) {
-        if (stackA[length] == a) {
-          return stackB[length] == b;
-        }
-      }
-      var size = 0;
-      result = true;
- 
-      // add `a` and `b` to the stack of traversed objects
-      stackA.push(a);
-      stackB.push(b);
- 
-      // recursively compare objects and arrays (susceptible to call stack limits)
-      if (isArr) {
-        length = a.length;
-        size = b.length;
- 
-        // compare lengths to determine if a deep comparison is necessary
-        result = size == a.length;
-        Iif (!result && !whereIndicator) {
-          return result;
-        }
-        // deep compare the contents, ignoring non-numeric properties
-        while (size--) {
-          var index = length,
-              value = b[size];
- 
-          if (whereIndicator) {
-            while (index--) {
-              Eif ((result = isEqual(a[index], value, callback, thisArg, stackA, stackB))) {
-                break;
-              }
-            }
-          } else if (!(result = isEqual(a[size], value, callback, thisArg, stackA, stackB))) {
-            break;
-          }
-        }
-        return result;
-      }
-      // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
-      // which, in this case, is more costly
-      forIn(b, function(value, key, b) {
-        Eif (hasOwnProperty.call(b, key)) {
-          // count the number of properties.
-          size++;
-          // deep compare each property value.
-          return (result = hasOwnProperty.call(a, key) && isEqual(a[key], value, callback, thisArg, stackA, stackB));
-        }
-      });
- 
-      if (result && !whereIndicator) {
-        // ensure both objects have the same number of properties
-        forIn(a, function(value, key, a) {
-          if (hasOwnProperty.call(a, key)) {
-            // `size` will be `-1` if `a` has more properties than `b`
-            return (result = --size > -1);
-          }
-        });
-      }
-      return result;
-    }
- 
-    /**
-     * Checks if `value` is, or can be coerced to, a finite number.
-     *
-     * Note: This is not the same as native `isFinite`, which will return true for
-     * booleans and empty strings. See http://es5.github.com/#x15.1.2.5.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is finite, else `false`.
-     * @example
-     *
-     * _.isFinite(-101);
-     * // => true
-     *
-     * _.isFinite('10');
-     * // => true
-     *
-     * _.isFinite(true);
-     * // => false
-     *
-     * _.isFinite('');
-     * // => false
-     *
-     * _.isFinite(Infinity);
-     * // => false
-     */
-    function isFinite(value) {
-      return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value));
-    }
- 
-    /**
-     * Checks if `value` is a function.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is a function, else `false`.
-     * @example
-     *
-     * _.isFunction(_);
-     * // => true
-     */
-    function isFunction(value) {
-      return typeof value == 'function';
-    }
-    // fallback for older versions of Chrome and Safari
-    Iif (isFunction(/x/)) {
-      isFunction = function(value) {
-        return typeof value == 'function' && toString.call(value) == funcClass;
-      };
-    }
- 
-    /**
-     * Checks if `value` is the language type of Object.
-     * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is an object, else `false`.
-     * @example
-     *
-     * _.isObject({});
-     * // => true
-     *
-     * _.isObject([1, 2, 3]);
-     * // => true
-     *
-     * _.isObject(1);
-     * // => false
-     */
-    function isObject(value) {
-      // check if the value is the ECMAScript language type of Object
-      // http://es5.github.com/#x8
-      // and avoid a V8 bug
-      // http://code.google.com/p/v8/issues/detail?id=2291
-      return !!(value && objectTypes[typeof value]);
-    }
- 
-    /**
-     * Checks if `value` is `NaN`.
-     *
-     * Note: This is not the same as native `isNaN`, which will return `true` for
-     * `undefined` and other values. See http://es5.github.com/#x15.1.2.4.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`.
-     * @example
-     *
-     * _.isNaN(NaN);
-     * // => true
-     *
-     * _.isNaN(new Number(NaN));
-     * // => true
-     *
-     * isNaN(undefined);
-     * // => true
-     *
-     * _.isNaN(undefined);
-     * // => false
-     */
-    function isNaN(value) {
-      // `NaN` as a primitive is the only value that is not equal to itself
-      // (perform the [[Class]] check first to avoid errors with some host objects in IE)
-      return isNumber(value) && value != +value
-    }
- 
-    /**
-     * Checks if `value` is `null`.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`.
-     * @example
-     *
-     * _.isNull(null);
-     * // => true
-     *
-     * _.isNull(undefined);
-     * // => false
-     */
-    function isNull(value) {
-      return value === null;
-    }
- 
-    /**
-     * Checks if `value` is a number.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is a number, else `false`.
-     * @example
-     *
-     * _.isNumber(8.4 * 5);
-     * // => true
-     */
-    function isNumber(value) {
-      return typeof value == 'number' || toString.call(value) == numberClass;
-    }
- 
-    /**
-     * Checks if a given `value` is an object created by the `Object` constructor.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`.
-     * @example
-     *
-     * function Stooge(name, age) {
-     *   this.name = name;
-     *   this.age = age;
-     * }
-     *
-     * _.isPlainObject(new Stooge('moe', 40));
-     * // => false
-     *
-     * _.isPlainObject([1, 2, 3]);
-     * // => false
-     *
-     * _.isPlainObject({ 'name': 'moe', 'age': 40 });
-     * // => true
-     */
-    var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) {
-      if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) {
-        return false;
-      }
-      var valueOf = value.valueOf,
-          objProto = typeof valueOf == 'function' && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto);
- 
-      return objProto
-        ? (value == objProto || getPrototypeOf(value) == objProto)
-        : shimIsPlainObject(value);
-    };
- 
-    /**
-     * Checks if `value` is a regular expression.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`.
-     * @example
-     *
-     * _.isRegExp(/moe/);
-     * // => true
-     */
-    function isRegExp(value) {
-      return !!(value && objectTypes[typeof value]) && toString.call(value) == regexpClass;
-    }
- 
-    /**
-     * Checks if `value` is a string.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is a string, else `false`.
-     * @example
-     *
-     * _.isString('moe');
-     * // => true
-     */
-    function isString(value) {
-      return typeof value == 'string' || toString.call(value) == stringClass;
-    }
- 
-    /**
-     * Checks if `value` is `undefined`.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Mixed} value The value to check.
-     * @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`.
-     * @example
-     *
-     * _.isUndefined(void 0);
-     * // => true
-     */
-    function isUndefined(value) {
-      return typeof value == 'undefined';
-    }
- 
-    /**
-     * Recursively merges own enumerable properties of the source object(s), that
-     * don't resolve to `undefined`, into the destination object. Subsequent sources
-     * will overwrite property assignments of previous sources. If a `callback` function
-     * is passed, it will be executed to produce the merged values of the destination
-     * and source properties. If `callback` returns `undefined`, merging will be
-     * handled by the method instead. The `callback` is bound to `thisArg` and
-     * invoked with two arguments; (objectValue, sourceValue).
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The destination object.
-     * @param {Object} [source1, source2, ...] The source objects.
-     * @param {Function} [callback] The function to customize merging properties.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @param- {Object} [deepIndicator] Indicates that `stackA` and `stackB` are
-     *  arrays of traversed objects, instead of source objects.
-     * @param- {Array} [stackA=[]] Tracks traversed source objects.
-     * @param- {Array} [stackB=[]] Associates values with source counterparts.
-     * @returns {Object} Returns the destination object.
-     * @example
-     *
-     * var names = {
-     *   'stooges': [
-     *     { 'name': 'moe' },
-     *     { 'name': 'larry' }
-     *   ]
-     * };
-     *
-     * var ages = {
-     *   'stooges': [
-     *     { 'age': 40 },
-     *     { 'age': 50 }
-     *   ]
-     * };
-     *
-     * _.merge(names, ages);
-     * // => { 'stooges': [{ 'name': 'moe', 'age': 40 }, { 'name': 'larry', 'age': 50 }] }
-     *
-     * var food = {
-     *   'fruits': ['apple'],
-     *   'vegetables': ['beet']
-     * };
-     *
-     * var otherFood = {
-     *   'fruits': ['banana'],
-     *   'vegetables': ['carrot']
-     * };
-     *
-     * _.merge(food, otherFood, function(a, b) {
-     *   return _.isArray(a) ? a.concat(b) : undefined;
-     * });
-     * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] }
-     */
-    function merge(object, source, deepIndicator) {
-      var args = arguments,
-          index = 0,
-          length = 2;
- 
-      if (!isObject(object)) {
-        return object;
-      }
-      if (deepIndicator === indicatorObject) {
-        var callback = args[3],
-            stackA = args[4],
-            stackB = args[5];
-      } else {
-        stackA = [];
-        stackB = [];
- 
-        // allows working with `_.reduce` and `_.reduceRight` without
-        // using their `callback` arguments, `index|key` and `collection`
-        if (typeof deepIndicator != 'number') {
-          length = args.length;
-        }
-        if (length > 3 && typeof args[length - 2] == 'function') {
-          callback = lodash.createCallback(args[--length - 1], args[length--], 2);
-        } else if (length > 2 && typeof args[length - 1] == 'function') {
-          callback = args[--length];
-        }
-      }
-      while (++index < length) {
-        (isArray(args[index]) ? forEach : forOwn)(args[index], function(source, key) {
-          var found,
-              isArr,
-              result = source,
-              value = object[key];
- 
-          if (source && ((isArr = isArray(source)) || isPlainObject(source))) {
-            // avoid merging previously merged cyclic sources
-            var stackLength = stackA.length;
-            while (stackLength--) {
-              if ((found = stackA[stackLength] == source)) {
-                value = stackB[stackLength];
-                break;
-              }
-            }
-            if (!found) {
-              var isShallow;
-              if (callback) {
-                result = callback(value, source);
-                if ((isShallow = typeof result != 'undefined')) {
-                  value = result;
-                }
-              }
-              if (!isShallow) {
-                value = isArr
-                  ? (isArray(value) ? value : [])
-                  : (isPlainObject(value) ? value : {});
-              }
-              // add `source` and associated `value` to the stack of traversed objects
-              stackA.push(source);
-              stackB.push(value);
- 
-              // recursively merge objects and arrays (susceptible to call stack limits)
-              if (!isShallow) {
-                value = merge(value, source, indicatorObject, callback, stackA, stackB);
-              }
-            }
-          }
-          else {
-            if (callback) {
-              result = callback(value, source);
-              if (typeof result == 'undefined') {
-                result = source;
-              }
-            }
-            if (typeof result != 'undefined') {
-              value = result;
-            }
-          }
-          object[key] = value;
-        });
-      }
-      return object;
-    }
- 
-    /**
-     * Creates a shallow clone of `object` excluding the specified properties.
-     * Property names may be specified as individual arguments or as arrays of
-     * property names. If a `callback` function is passed, it will be executed
-     * for each property in the `object`, omitting the properties `callback`
-     * returns truthy for. The `callback` is bound to `thisArg` and invoked
-     * with three arguments; (value, key, object).
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The source object.
-     * @param {Function|String} callback|[prop1, prop2, ...] The properties to omit
-     *  or the function called per iteration.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Object} Returns an object without the omitted properties.
-     * @example
-     *
-     * _.omit({ 'name': 'moe', 'age': 40 }, 'age');
-     * // => { 'name': 'moe' }
-     *
-     * _.omit({ 'name': 'moe', 'age': 40 }, function(value) {
-     *   return typeof value == 'number';
-     * });
-     * // => { 'name': 'moe' }
-     */
-    function omit(object, callback, thisArg) {
-      var indexOf = getIndexOf(),
-          isFunc = typeof callback == 'function',
-          result = {};
- 
-      if (isFunc) {
-        callback = lodash.createCallback(callback, thisArg);
-      } else {
-        var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1));
-      }
-      forIn(object, function(value, key, object) {
-        if (isFunc
-              ? !callback(value, key, object)
-              : indexOf(props, key) < 0
-            ) {
-          result[key] = value;
-        }
-      });
-      return result;
-    }
- 
-    /**
-     * Creates a two dimensional array of the given object's key-value pairs,
-     * i.e. `[[key1, value1], [key2, value2]]`.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The object to inspect.
-     * @returns {Array} Returns new array of key-value pairs.
-     * @example
-     *
-     * _.pairs({ 'moe': 30, 'larry': 40 });
-     * // => [['moe', 30], ['larry', 40]] (order is not guaranteed)
-     */
-    function pairs(object) {
-      var index = -1,
-          props = keys(object),
-          length = props.length,
-          result = Array(length);
- 
-      while (++index < length) {
-        var key = props[index];
-        result[index] = [key, object[key]];
-      }
-      return result;
-    }
- 
-    /**
-     * Creates a shallow clone of `object` composed of the specified properties.
-     * Property names may be specified as individual arguments or as arrays of property
-     * names. If `callback` is passed, it will be executed for each property in the
-     * `object`, picking the properties `callback` returns truthy for. The `callback`
-     * is bound to `thisArg` and invoked with three arguments; (value, key, object).
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The source object.
-     * @param {Array|Function|String} callback|[prop1, prop2, ...] The function called
-     *  per iteration or properties to pick, either as individual arguments or arrays.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Object} Returns an object composed of the picked properties.
-     * @example
-     *
-     * _.pick({ 'name': 'moe', '_userid': 'moe1' }, 'name');
-     * // => { 'name': 'moe' }
-     *
-     * _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) {
-     *   return key.charAt(0) != '_';
-     * });
-     * // => { 'name': 'moe' }
-     */
-    function pick(object, callback, thisArg) {
-      var result = {};
-      if (typeof callback != 'function') {
-        var index = -1,
-            props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
-            length = isObject(object) ? props.length : 0;
- 
-        while (++index < length) {
-          var key = props[index];
-          if (key in object) {
-            result[key] = object[key];
-          }
-        }
-      } else {
-        callback = lodash.createCallback(callback, thisArg);
-        forIn(object, function(value, key, object) {
-          if (callback(value, key, object)) {
-            result[key] = value;
-          }
-        });
-      }
-      return result;
-    }
- 
-    /**
-     * Transforms an `object` to a new `accumulator` object which is the result
-     * of running each of its elements through the `callback`, with each `callback`
-     * execution potentially mutating the `accumulator` object. The `callback` is
-     * bound to `thisArg` and invoked with four arguments; (accumulator, value, key, object).
-     * Callbacks may exit iteration early by explicitly returning `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Array|Object} collection The collection to iterate over.
-     * @param {Function} [callback=identity] The function called per iteration.
-     * @param {Mixed} [accumulator] The custom accumulator value.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the accumulated value.
-     * @example
-     *
-     * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) {
-     *   num *= num;
-     *   if (num % 2) {
-     *     return result.push(num) < 3;
-     *   }
-     * });
-     * // => [1, 9, 25]
-     *
-     * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
-     *   result[key] = num * 3;
-     * });
-     * // => { 'a': 3, 'b': 6, 'c': 9 }
-     */
-    function transform(object, callback, accumulator, thisArg) {
-      var isArr = isArray(object);
-      callback = lodash.createCallback(callback, thisArg, 4);
- 
-      Eif (accumulator == null) {
-        if (isArr) {
-          accumulator = [];
-        } else {
-          var ctor = object && object.constructor,
-              proto = ctor && ctor.prototype;
- 
-          accumulator = createObject(proto);
-        }
-      }
-      (isArr ? basicEach : forOwn)(object, function(value, index, object) {
-        return callback(accumulator, value, index, object);
-      });
-      return accumulator;
-    }
- 
-    /**
-     * Creates an array composed of the own enumerable property values of `object`.
-     *
-     * @static
-     * @memberOf _
-     * @category Objects
-     * @param {Object} object The object to inspect.
-     * @returns {Array} Returns a new array of property values.
-     * @example
-     *
-     * _.values({ 'one': 1, 'two': 2, 'three': 3 });
-     * // => [1, 2, 3] (order is not guaranteed)
-     */
-    function values(object) {
-      var index = -1,
-          props = keys(object),
-          length = props.length,
-          result = Array(length);
- 
-      while (++index < length) {
-        result[index] = object[props[index]];
-      }
-      return result;
-    }
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * Creates an array of elements from the specified indexes, or keys, of the
-     * `collection`. Indexes may be specified as individual arguments or as arrays
-     * of indexes.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Array|Number|String} [index1, index2, ...] The indexes of
-     *  `collection` to retrieve, either as individual arguments or arrays.
-     * @returns {Array} Returns a new array of elements corresponding to the
-     *  provided indexes.
-     * @example
-     *
-     * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
-     * // => ['a', 'c', 'e']
-     *
-     * _.at(['moe', 'larry', 'curly'], 0, 2);
-     * // => ['moe', 'curly']
-     */
-    function at(collection) {
-      var index = -1,
-          props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
-          length = props.length,
-          result = Array(length);
- 
-      Iif (support.unindexedChars && isString(collection)) {
-        collection = collection.split('');
-      }
-      while(++index < length) {
-        result[index] = collection[props[index]];
-      }
-      return result;
-    }
- 
-    /**
-     * Checks if a given `target` element is present in a `collection` using strict
-     * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
-     * as the offset from the end of the collection.
-     *
-     * @static
-     * @memberOf _
-     * @alias include
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Mixed} target The value to check for.
-     * @param {Number} [fromIndex=0] The index to search from.
-     * @returns {Boolean} Returns `true` if the `target` element is found, else `false`.
-     * @example
-     *
-     * _.contains([1, 2, 3], 1);
-     * // => true
-     *
-     * _.contains([1, 2, 3], 1, 2);
-     * // => false
-     *
-     * _.contains({ 'name': 'moe', 'age': 40 }, 'moe');
-     * // => true
-     *
-     * _.contains('curly', 'ur');
-     * // => true
-     */
-    function contains(collection, target, fromIndex) {
-      var index = -1,
-          indexOf = getIndexOf(),
-          length = collection ? collection.length : 0,
-          result = false;
- 
-      fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0;
-      if (length && typeof length == 'number') {
-        result = (isString(collection)
-          ? collection.indexOf(target, fromIndex)
-          : indexOf(collection, target, fromIndex)
-        ) > -1;
-      } else {
-        basicEach(collection, function(value) {
-          if (++index >= fromIndex) {
-            return !(result = value === target);
-          }
-        });
-      }
-      return result;
-    }
- 
-    /**
-     * Creates an object composed of keys returned from running each element of the
-     * `collection` through the given `callback`. The corresponding value of each key
-     * is the number of times the key was returned by the `callback`. The `callback`
-     * is bound to `thisArg` and invoked with three arguments; (value, index|key, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Object} Returns the composed aggregate object.
-     * @example
-     *
-     * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
-     * // => { '4': 1, '6': 2 }
-     *
-     * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
-     * // => { '4': 1, '6': 2 }
-     *
-     * _.countBy(['one', 'two', 'three'], 'length');
-     * // => { '3': 2, '5': 1 }
-     */
-    function countBy(collection, callback, thisArg) {
-      var result = {};
-      callback = lodash.createCallback(callback, thisArg);
- 
-      forEach(collection, function(value, key, collection) {
-        key = String(callback(value, key, collection));
-        (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1);
-      });
-      return result;
-    }
- 
-    /**
-     * Checks if the `callback` returns a truthy value for **all** elements of a
-     * `collection`. The `callback` is bound to `thisArg` and invoked with three
-     * arguments; (value, index|key, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias all
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Boolean} Returns `true` if all elements pass the callback check,
-     *  else `false`.
-     * @example
-     *
-     * _.every([true, 1, null, 'yes'], Boolean);
-     * // => false
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.every(stooges, 'age');
-     * // => true
-     *
-     * // using "_.where" callback shorthand
-     * _.every(stooges, { 'age': 50 });
-     * // => false
-     */
-    function every(collection, callback, thisArg) {
-      var result = true;
-      callback = lodash.createCallback(callback, thisArg);
- 
-      if (isArray(collection)) {
-        var index = -1,
-            length = collection.length;
- 
-        while (++index < length) {
-          if (!(result = !!callback(collection[index], index, collection))) {
-            break;
-          }
-        }
-      } else {
-        basicEach(collection, function(value, index, collection) {
-          return (result = !!callback(value, index, collection));
-        });
-      }
-      return result;
-    }
- 
-    /**
-     * Examines each element in a `collection`, returning an array of all elements
-     * the `callback` returns truthy for. The `callback` is bound to `thisArg` and
-     * invoked with three arguments; (value, index|key, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias select
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a new array of elements that passed the callback check.
-     * @example
-     *
-     * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
-     * // => [2, 4, 6]
-     *
-     * var food = [
-     *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
-     *   { 'name': 'carrot', 'organic': true,  'type': 'vegetable' }
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.filter(food, 'organic');
-     * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }]
-     *
-     * // using "_.where" callback shorthand
-     * _.filter(food, { 'type': 'fruit' });
-     * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }]
-     */
-    function filter(collection, callback, thisArg) {
-      var result = [];
-      callback = lodash.createCallback(callback, thisArg);
- 
-      if (isArray(collection)) {
-        var index = -1,
-            length = collection.length;
- 
-        while (++index < length) {
-          var value = collection[index];
-          if (callback(value, index, collection)) {
-            result.push(value);
-          }
-        }
-      } else {
-        basicEach(collection, function(value, index, collection) {
-          if (callback(value, index, collection)) {
-            result.push(value);
-          }
-        });
-      }
-      return result;
-    }
- 
-    /**
-     * Examines each element in a `collection`, returning the first that the `callback`
-     * returns truthy for. The `callback` is bound to `thisArg` and invoked with three
-     * arguments; (value, index|key, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias detect, findWhere
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the found element, else `undefined`.
-     * @example
-     *
-     * _.find([1, 2, 3, 4], function(num) {
-     *   return num % 2 == 0;
-     * });
-     * // => 2
-     *
-     * var food = [
-     *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
-     *   { 'name': 'banana', 'organic': true,  'type': 'fruit' },
-     *   { 'name': 'beet',   'organic': false, 'type': 'vegetable' }
-     * ];
-     *
-     * // using "_.where" callback shorthand
-     * _.find(food, { 'type': 'vegetable' });
-     * // => { 'name': 'beet', 'organic': false, 'type': 'vegetable' }
-     *
-     * // using "_.pluck" callback shorthand
-     * _.find(food, 'organic');
-     * // => { 'name': 'banana', 'organic': true, 'type': 'fruit' }
-     */
-    function find(collection, callback, thisArg) {
-      callback = lodash.createCallback(callback, thisArg);
- 
-      if (isArray(collection)) {
-        var index = -1,
-            length = collection.length;
- 
-        while (++index < length) {
-          var value = collection[index];
-          if (callback(value, index, collection)) {
-            return value;
-          }
-        }
-      } else {
-        var result;
-        basicEach(collection, function(value, index, collection) {
-          if (callback(value, index, collection)) {
-            result = value;
-            return false;
-          }
-        });
-        return result;
-      }
-    }
- 
-    /**
-     * Iterates over a `collection`, executing the `callback` for each element in
-     * the `collection`. The `callback` is bound to `thisArg` and invoked with three
-     * arguments; (value, index|key, collection). Callbacks may exit iteration early
-     * by explicitly returning `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias each
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function} [callback=identity] The function called per iteration.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array|Object|String} Returns `collection`.
-     * @example
-     *
-     * _([1, 2, 3]).forEach(alert).join(',');
-     * // => alerts each number and returns '1,2,3'
-     *
-     * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert);
-     * // => alerts each number value (order is not guaranteed)
-     */
-    function forEach(collection, callback, thisArg) {
-      if (callback && typeof thisArg == 'undefined' && isArray(collection)) {
-        var index = -1,
-            length = collection.length;
- 
-        while (++index < length) {
-          if (callback(collection[index], index, collection) === false) {
-            break;
-          }
-        }
-      } else {
-        basicEach(collection, callback, thisArg);
-      }
-      return collection;
-    }
- 
-    /**
-     * Creates an object composed of keys returned from running each element of the
-     * `collection` through the `callback`. The corresponding value of each key is
-     * an array of elements passed to `callback` that returned the key. The `callback`
-     * is bound to `thisArg` and invoked with three arguments; (value, index|key, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Object} Returns the composed aggregate object.
-     * @example
-     *
-     * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
-     * // => { '4': [4.2], '6': [6.1, 6.4] }
-     *
-     * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
-     * // => { '4': [4.2], '6': [6.1, 6.4] }
-     *
-     * // using "_.pluck" callback shorthand
-     * _.groupBy(['one', 'two', 'three'], 'length');
-     * // => { '3': ['one', 'two'], '5': ['three'] }
-     */
-    function groupBy(collection, callback, thisArg) {
-      var result = {};
-      callback = lodash.createCallback(callback, thisArg);
- 
-      forEach(collection, function(value, key, collection) {
-        key = String(callback(value, key, collection));
-        (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value);
-      });
-      return result;
-    }
- 
-    /**
-     * Invokes the method named by `methodName` on each element in the `collection`,
-     * returning an array of the results of each invoked method. Additional arguments
-     * will be passed to each invoked method. If `methodName` is a function, it will
-     * be invoked for, and `this` bound to, each element in the `collection`.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|String} methodName The name of the method to invoke or
-     *  the function invoked per iteration.
-     * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the method with.
-     * @returns {Array} Returns a new array of the results of each invoked method.
-     * @example
-     *
-     * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
-     * // => [[1, 5, 7], [1, 2, 3]]
-     *
-     * _.invoke([123, 456], String.prototype.split, '');
-     * // => [['1', '2', '3'], ['4', '5', '6']]
-     */
-    function invoke(collection, methodName) {
-      var args = nativeSlice.call(arguments, 2),
-          index = -1,
-          isFunc = typeof methodName == 'function',
-          length = collection ? collection.length : 0,
-          result = Array(typeof length == 'number' ? length : 0);
- 
-      forEach(collection, function(value) {
-        result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args);
-      });
-      return result;
-    }
- 
-    /**
-     * Creates an array of values by running each element in the `collection`
-     * through the `callback`. The `callback` is bound to `thisArg` and invoked with
-     * three arguments; (value, index|key, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias collect
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a new array of the results of each `callback` execution.
-     * @example
-     *
-     * _.map([1, 2, 3], function(num) { return num * 3; });
-     * // => [3, 6, 9]
-     *
-     * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
-     * // => [3, 6, 9] (order is not guaranteed)
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.map(stooges, 'name');
-     * // => ['moe', 'larry']
-     */
-    function map(collection, callback, thisArg) {
-      var index = -1,
-          length = collection ? collection.length : 0,
-          result = Array(typeof length == 'number' ? length : 0);
- 
-      callback = lodash.createCallback(callback, thisArg);
-      if (isArray(collection)) {
-        while (++index < length) {
-          result[index] = callback(collection[index], index, collection);
-        }
-      } else {
-        basicEach(collection, function(value, key, collection) {
-          result[++index] = callback(value, key, collection);
-        });
-      }
-      return result;
-    }
- 
-    /**
-     * Retrieves the maximum value of an `array`. If `callback` is passed,
-     * it will be executed for each value in the `array` to generate the
-     * criterion by which the value is ranked. The `callback` is bound to
-     * `thisArg` and invoked with three arguments; (value, index, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the maximum value.
-     * @example
-     *
-     * _.max([4, 2, 8, 6]);
-     * // => 8
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * _.max(stooges, function(stooge) { return stooge.age; });
-     * // => { 'name': 'larry', 'age': 50 };
-     *
-     * // using "_.pluck" callback shorthand
-     * _.max(stooges, 'age');
-     * // => { 'name': 'larry', 'age': 50 };
-     */
-    function max(collection, callback, thisArg) {
-      var computed = -Infinity,
-          result = computed;
- 
-      if (!callback && isArray(collection)) {
-        var index = -1,
-            length = collection.length;
- 
-        while (++index < length) {
-          var value = collection[index];
-          if (value > result) {
-            result = value;
-          }
-        }
-      } else {
-        callback = (!callback && isString(collection))
-          ? charAtCallback
-          : lodash.createCallback(callback, thisArg);
- 
-        basicEach(collection, function(value, index, collection) {
-          var current = callback(value, index, collection);
-          if (current > computed) {
-            computed = current;
-            result = value;
-          }
-        });
-      }
-      return result;
-    }
- 
-    /**
-     * Retrieves the minimum value of an `array`. If `callback` is passed,
-     * it will be executed for each value in the `array` to generate the
-     * criterion by which the value is ranked. The `callback` is bound to `thisArg`
-     * and invoked with three arguments; (value, index, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the minimum value.
-     * @example
-     *
-     * _.min([4, 2, 8, 6]);
-     * // => 2
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * _.min(stooges, function(stooge) { return stooge.age; });
-     * // => { 'name': 'moe', 'age': 40 };
-     *
-     * // using "_.pluck" callback shorthand
-     * _.min(stooges, 'age');
-     * // => { 'name': 'moe', 'age': 40 };
-     */
-    function min(collection, callback, thisArg) {
-      var computed = Infinity,
-          result = computed;
- 
-      Iif (!callback && isArray(collection)) {
-        var index = -1,
-            length = collection.length;
- 
-        while (++index < length) {
-          var value = collection[index];
-          if (value < result) {
-            result = value;
-          }
-        }
-      } else {
-        callback = (!callback && isString(collection))
-          ? charAtCallback
-          : lodash.createCallback(callback, thisArg);
- 
-        basicEach(collection, function(value, index, collection) {
-          var current = callback(value, index, collection);
-          if (current < computed) {
-            computed = current;
-            result = value;
-          }
-        });
-      }
-      return result;
-    }
- 
-    /**
-     * Retrieves the value of a specified property from all elements in the `collection`.
-     *
-     * @static
-     * @memberOf _
-     * @type Function
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {String} property The property to pluck.
-     * @returns {Array} Returns a new array of property values.
-     * @example
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * _.pluck(stooges, 'name');
-     * // => ['moe', 'larry']
-     */
-    var pluck = map;
- 
-    /**
-     * Reduces a `collection` to a value which is the accumulated result of running
-     * each element in the `collection` through the `callback`, where each successive
-     * `callback` execution consumes the return value of the previous execution.
-     * If `accumulator` is not passed, the first element of the `collection` will be
-     * used as the initial `accumulator` value. The `callback` is bound to `thisArg`
-     * and invoked with four arguments; (accumulator, value, index|key, collection).
-     *
-     * @static
-     * @memberOf _
-     * @alias foldl, inject
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function} [callback=identity] The function called per iteration.
-     * @param {Mixed} [accumulator] Initial value of the accumulator.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the accumulated value.
-     * @example
-     *
-     * var sum = _.reduce([1, 2, 3], function(sum, num) {
-     *   return sum + num;
-     * });
-     * // => 6
-     *
-     * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) {
-     *   result[key] = num * 3;
-     *   return result;
-     * }, {});
-     * // => { 'a': 3, 'b': 6, 'c': 9 }
-     */
-    function reduce(collection, callback, accumulator, thisArg) {
-      var noaccum = arguments.length < 3;
-      callback = lodash.createCallback(callback, thisArg, 4);
- 
-      if (isArray(collection)) {
-        var index = -1,
-            length = collection.length;
- 
-        if (noaccum) {
-          accumulator = collection[++index];
-        }
-        while (++index < length) {
-          accumulator = callback(accumulator, collection[index], index, collection);
-        }
-      } else {
-        basicEach(collection, function(value, index, collection) {
-          accumulator = noaccum
-            ? (noaccum = false, value)
-            : callback(accumulator, value, index, collection)
-        });
-      }
-      return accumulator;
-    }
- 
-    /**
-     * This method is similar to `_.reduce`, except that it iterates over a
-     * `collection` from right to left.
-     *
-     * @static
-     * @memberOf _
-     * @alias foldr
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function} [callback=identity] The function called per iteration.
-     * @param {Mixed} [accumulator] Initial value of the accumulator.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the accumulated value.
-     * @example
-     *
-     * var list = [[0, 1], [2, 3], [4, 5]];
-     * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
-     * // => [4, 5, 2, 3, 0, 1]
-     */
-    function reduceRight(collection, callback, accumulator, thisArg) {
-      var iterable = collection,
-          length = collection ? collection.length : 0,
-          noaccum = arguments.length < 3;
- 
-      if (typeof length != 'number') {
-        var props = keys(collection);
-        length = props.length;
-      } else Iif (support.unindexedChars && isString(collection)) {
-        iterable = collection.split('');
-      }
-      callback = lodash.createCallback(callback, thisArg, 4);
-      forEach(collection, function(value, index, collection) {
-        index = props ? props[--length] : --length;
-        accumulator = noaccum
-          ? (noaccum = false, iterable[index])
-          : callback(accumulator, iterable[index], index, collection);
-      });
-      return accumulator;
-    }
- 
-    /**
-     * The opposite of `_.filter`, this method returns the elements of a
-     * `collection` that `callback` does **not** return truthy for.
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a new array of elements that did **not** pass the
-     *  callback check.
-     * @example
-     *
-     * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
-     * // => [1, 3, 5]
-     *
-     * var food = [
-     *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
-     *   { 'name': 'carrot', 'organic': true,  'type': 'vegetable' }
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.reject(food, 'organic');
-     * // => [{ 'name': 'apple', 'organic': false, 'type': 'fruit' }]
-     *
-     * // using "_.where" callback shorthand
-     * _.reject(food, { 'type': 'fruit' });
-     * // => [{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }]
-     */
-    function reject(collection, callback, thisArg) {
-      callback = lodash.createCallback(callback, thisArg);
-      return filter(collection, function(value, index, collection) {
-        return !callback(value, index, collection);
-      });
-    }
- 
-    /**
-     * Creates an array of shuffled `array` values, using a version of the
-     * Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to shuffle.
-     * @returns {Array} Returns a new shuffled collection.
-     * @example
-     *
-     * _.shuffle([1, 2, 3, 4, 5, 6]);
-     * // => [4, 1, 6, 3, 5, 2]
-     */
-    function shuffle(collection) {
-      var index = -1,
-          length = collection ? collection.length : 0,
-          result = Array(typeof length == 'number' ? length : 0);
- 
-      forEach(collection, function(value) {
-        var rand = floor(nativeRandom() * (++index + 1));
-        result[index] = result[rand];
-        result[rand] = value;
-      });
-      return result;
-    }
- 
-    /**
-     * Gets the size of the `collection` by returning `collection.length` for arrays
-     * and array-like objects or the number of own enumerable properties for objects.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to inspect.
-     * @returns {Number} Returns `collection.length` or number of own enumerable properties.
-     * @example
-     *
-     * _.size([1, 2]);
-     * // => 2
-     *
-     * _.size({ 'one': 1, 'two': 2, 'three': 3 });
-     * // => 3
-     *
-     * _.size('curly');
-     * // => 5
-     */
-    function size(collection) {
-      var length = collection ? collection.length : 0;
-      return typeof length == 'number' ? length : keys(collection).length;
-    }
- 
-    /**
-     * Checks if the `callback` returns a truthy value for **any** element of a
-     * `collection`. The function returns as soon as it finds passing value, and
-     * does not iterate over the entire `collection`. The `callback` is bound to
-     * `thisArg` and invoked with three arguments; (value, index|key, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias any
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Boolean} Returns `true` if any element passes the callback check,
-     *  else `false`.
-     * @example
-     *
-     * _.some([null, 0, 'yes', false], Boolean);
-     * // => true
-     *
-     * var food = [
-     *   { 'name': 'apple',  'organic': false, 'type': 'fruit' },
-     *   { 'name': 'carrot', 'organic': true,  'type': 'vegetable' }
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.some(food, 'organic');
-     * // => true
-     *
-     * // using "_.where" callback shorthand
-     * _.some(food, { 'type': 'meat' });
-     * // => false
-     */
-    function some(collection, callback, thisArg) {
-      var result;
-      callback = lodash.createCallback(callback, thisArg);
- 
-      if (isArray(collection)) {
-        var index = -1,
-            length = collection.length;
- 
-        while (++index < length) {
-          if ((result = callback(collection[index], index, collection))) {
-            break;
-          }
-        }
-      } else {
-        basicEach(collection, function(value, index, collection) {
-          return !(result = callback(value, index, collection));
-        });
-      }
-      return !!result;
-    }
- 
-    /**
-     * Creates an array of elements, sorted in ascending order by the results of
-     * running each element in the `collection` through the `callback`. This method
-     * performs a stable sort, that is, it will preserve the original sort order of
-     * equal elements. The `callback` is bound to `thisArg` and invoked with three
-     * arguments; (value, index|key, collection).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a new array of sorted elements.
-     * @example
-     *
-     * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); });
-     * // => [3, 1, 2]
-     *
-     * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);
-     * // => [3, 1, 2]
-     *
-     * // using "_.pluck" callback shorthand
-     * _.sortBy(['banana', 'strawberry', 'apple'], 'length');
-     * // => ['apple', 'banana', 'strawberry']
-     */
-    function sortBy(collection, callback, thisArg) {
-      var index = -1,
-          length = collection ? collection.length : 0,
-          result = Array(typeof length == 'number' ? length : 0);
- 
-      callback = lodash.createCallback(callback, thisArg);
-      forEach(collection, function(value, key, collection) {
-        result[++index] = {
-          'criteria': callback(value, key, collection),
-          'index': index,
-          'value': value
-        };
-      });
- 
-      length = result.length;
-      result.sort(compareAscending);
-      while (length--) {
-        result[length] = result[length].value;
-      }
-      return result;
-    }
- 
-    /**
-     * Converts the `collection` to an array.
-     *
-     * @static
-     * @memberOf _
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to convert.
-     * @returns {Array} Returns the new converted array.
-     * @example
-     *
-     * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
-     * // => [2, 3, 4]
-     */
-    function toArray(collection) {
-      if (collection && typeof collection.length == 'number') {
-        return (support.unindexedChars && isString(collection))
-          ? collection.split('')
-          : slice(collection);
-      }
-      return values(collection);
-    }
- 
-    /**
-     * Examines each element in a `collection`, returning an array of all elements
-     * that have the given `properties`. When checking `properties`, this method
-     * performs a deep comparison between values to determine if they are equivalent
-     * to each other.
-     *
-     * @static
-     * @memberOf _
-     * @type Function
-     * @category Collections
-     * @param {Array|Object|String} collection The collection to iterate over.
-     * @param {Object} properties The object of property values to filter by.
-     * @returns {Array} Returns a new array of elements that have the given `properties`.
-     * @example
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * _.where(stooges, { 'age': 40 });
-     * // => [{ 'name': 'moe', 'age': 40 }]
-     */
-    var where = filter;
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * Creates an array with all falsey values of `array` removed. The values
-     * `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to compact.
-     * @returns {Array} Returns a new filtered array.
-     * @example
-     *
-     * _.compact([0, 1, false, 2, '', 3]);
-     * // => [1, 2, 3]
-     */
-    function compact(array) {
-      var index = -1,
-          length = array ? array.length : 0,
-          result = [];
- 
-      while (++index < length) {
-        var value = array[index];
-        if (value) {
-          result.push(value);
-        }
-      }
-      return result;
-    }
- 
-    /**
-     * Creates an array of `array` elements not present in the other arrays
-     * using strict equality for comparisons, i.e. `===`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to process.
-     * @param {Array} [array1, array2, ...] Arrays to check.
-     * @returns {Array} Returns a new array of `array` elements not present in the
-     *  other arrays.
-     * @example
-     *
-     * _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
-     * // => [1, 3, 4]
-     */
-    function difference(array) {
-      var index = -1,
-          length = array ? array.length : 0,
-          flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),
-          contains = createCache(flattened).contains,
-          result = [];
- 
-      while (++index < length) {
-        var value = array[index];
-        if (!contains(value)) {
-          result.push(value);
-        }
-      }
-      return result;
-    }
- 
-    /**
-     * This method is similar to `_.find`, except that it returns the index of
-     * the element that passes the callback check, instead of the element itself.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to search.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the index of the found element, else `-1`.
-     * @example
-     *
-     * _.findIndex(['apple', 'banana', 'beet'], function(food) {
-     *   return /^b/.test(food);
-     * });
-     * // => 1
-     */
-    function findIndex(array, callback, thisArg) {
-      var index = -1,
-          length = array ? array.length : 0;
- 
-      callback = lodash.createCallback(callback, thisArg);
-      while (++index < length) {
-        if (callback(array[index], index, array)) {
-          return index;
-        }
-      }
-      return -1;
-    }
- 
-    /**
-     * Gets the first element of the `array`. If a number `n` is passed, the first
-     * `n` elements of the `array` are returned. If a `callback` function is passed,
-     * elements at the beginning of the array are returned as long as the `callback`
-     * returns truthy. The `callback` is bound to `thisArg` and invoked with three
-     * arguments; (value, index, array).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias head, take
-     * @category Arrays
-     * @param {Array} array The array to query.
-     * @param {Function|Object|Number|String} [callback|n] The function called
-     *  per element or the number of elements to return. If a property name or
-     *  object is passed, it will be used to create a "_.pluck" or "_.where"
-     *  style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the first element(s) of `array`.
-     * @example
-     *
-     * _.first([1, 2, 3]);
-     * // => 1
-     *
-     * _.first([1, 2, 3], 2);
-     * // => [1, 2]
-     *
-     * _.first([1, 2, 3], function(num) {
-     *   return num < 3;
-     * });
-     * // => [1, 2]
-     *
-     * var food = [
-     *   { 'name': 'banana', 'organic': true },
-     *   { 'name': 'beet',   'organic': false },
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.first(food, 'organic');
-     * // => [{ 'name': 'banana', 'organic': true }]
-     *
-     * var food = [
-     *   { 'name': 'apple',  'type': 'fruit' },
-     *   { 'name': 'banana', 'type': 'fruit' },
-     *   { 'name': 'beet',   'type': 'vegetable' }
-     * ];
-     *
-     * // using "_.where" callback shorthand
-     * _.first(food, { 'type': 'fruit' });
-     * // => [{ 'name': 'apple', 'type': 'fruit' }, { 'name': 'banana', 'type': 'fruit' }]
-     */
-    function first(array, callback, thisArg) {
-      if (array) {
-        var n = 0,
-            length = array.length;
- 
-        if (typeof callback != 'number' && callback != null) {
-          var index = -1;
-          callback = lodash.createCallback(callback, thisArg);
-          while (++index < length && callback(array[index], index, array)) {
-            n++;
-          }
-        } else {
-          n = callback;
-          if (n == null || thisArg) {
-            return array[0];
-          }
-        }
-        return slice(array, 0, nativeMin(nativeMax(0, n), length));
-      }
-    }
- 
-    /**
-     * Flattens a nested array (the nesting can be to any depth). If `isShallow`
-     * is truthy, `array` will only be flattened a single level. If `callback`
-     * is passed, each element of `array` is passed through a `callback` before
-     * flattening. The `callback` is bound to `thisArg` and invoked with three
-     * arguments; (value, index, array).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to flatten.
-     * @param {Boolean} [isShallow=false] A flag to indicate only flattening a single level.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a new flattened array.
-     * @example
-     *
-     * _.flatten([1, [2], [3, [[4]]]]);
-     * // => [1, 2, 3, 4];
-     *
-     * _.flatten([1, [2], [3, [[4]]]], true);
-     * // => [1, 2, 3, [[4]]];
-     *
-     * var stooges = [
-     *   { 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
-     *   { 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] }
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.flatten(stooges, 'quotes');
-     * // => ['Oh, a wise guy, eh?', 'Poifect!', 'Spread out!', 'You knucklehead!']
-     */
-    var flatten = overloadWrapper(function flatten(array, isShallow, callback) {
-      var index = -1,
-          length = array ? array.length : 0,
-          result = [];
- 
-      while (++index < length) {
-        var value = array[index];
-        if (callback) {
-          value = callback(value, index, array);
-        }
-        // recursively flatten arrays (susceptible to call stack limits)
-        if (isArray(value)) {
-          push.apply(result, isShallow ? value : flatten(value));
-        } else {
-          result.push(value);
-        }
-      }
-      return result;
-    });
- 
-    /**
-     * Gets the index at which the first occurrence of `value` is found using
-     * strict equality for comparisons, i.e. `===`. If the `array` is already
-     * sorted, passing `true` for `fromIndex` will run a faster binary search.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to search.
-     * @param {Mixed} value The value to search for.
-     * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` to
-     *  perform a binary search on a sorted `array`.
-     * @returns {Number} Returns the index of the matched value or `-1`.
-     * @example
-     *
-     * _.indexOf([1, 2, 3, 1, 2, 3], 2);
-     * // => 1
-     *
-     * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
-     * // => 4
-     *
-     * _.indexOf([1, 1, 2, 2, 3, 3], 2, true);
-     * // => 2
-     */
-    function indexOf(array, value, fromIndex) {
-      if (typeof fromIndex == 'number') {
-        var length = array ? array.length : 0;
-        fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0);
-      } else if (fromIndex) {
-        var index = sortedIndex(array, value);
-        return array[index] === value ? index : -1;
-      }
-      return array ? basicIndexOf(array, value, fromIndex) : -1;
-    }
- 
-    /**
-     * Gets all but the last element of `array`. If a number `n` is passed, the
-     * last `n` elements are excluded from the result. If a `callback` function
-     * is passed, elements at the end of the array are excluded from the result
-     * as long as the `callback` returns truthy. The `callback` is bound to
-     * `thisArg` and invoked with three arguments; (value, index, array).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to query.
-     * @param {Function|Object|Number|String} [callback|n=1] The function called
-     *  per element or the number of elements to exclude. If a property name or
-     *  object is passed, it will be used to create a "_.pluck" or "_.where"
-     *  style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a slice of `array`.
-     * @example
-     *
-     * _.initial([1, 2, 3]);
-     * // => [1, 2]
-     *
-     * _.initial([1, 2, 3], 2);
-     * // => [1]
-     *
-     * _.initial([1, 2, 3], function(num) {
-     *   return num > 1;
-     * });
-     * // => [1]
-     *
-     * var food = [
-     *   { 'name': 'beet',   'organic': false },
-     *   { 'name': 'carrot', 'organic': true }
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.initial(food, 'organic');
-     * // => [{ 'name': 'beet',   'organic': false }]
-     *
-     * var food = [
-     *   { 'name': 'banana', 'type': 'fruit' },
-     *   { 'name': 'beet',   'type': 'vegetable' },
-     *   { 'name': 'carrot', 'type': 'vegetable' }
-     * ];
-     *
-     * // using "_.where" callback shorthand
-     * _.initial(food, { 'type': 'vegetable' });
-     * // => [{ 'name': 'banana', 'type': 'fruit' }]
-     */
-    function initial(array, callback, thisArg) {
-      if (!array) {
-        return [];
-      }
-      var n = 0,
-          length = array.length;
- 
-      if (typeof callback != 'number' && callback != null) {
-        var index = length;
-        callback = lodash.createCallback(callback, thisArg);
-        while (index-- && callback(array[index], index, array)) {
-          n++;
-        }
-      } else {
-        n = (callback == null || thisArg) ? 1 : callback || n;
-      }
-      return slice(array, 0, nativeMin(nativeMax(0, length - n), length));
-    }
- 
-    /**
-     * Computes the intersection of all the passed-in arrays using strict equality
-     * for comparisons, i.e. `===`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} [array1, array2, ...] Arrays to process.
-     * @returns {Array} Returns a new array of unique elements that are present
-     *  in **all** of the arrays.
-     * @example
-     *
-     * _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
-     * // => [1, 2]
-     */
-    function intersection(array) {
-      var args = arguments,
-          argsLength = args.length,
-          cache = createCache(),
-          caches = {},
-          index = -1,
-          length = array ? array.length : 0,
-          isLarge = length >= largeArraySize,
-          result = [];
- 
-      outer:
-      while (++index < length) {
-        var value = array[index];
-        if (!cache.contains(value)) {
-          var argsIndex = argsLength;
-          cache.push(value);
-          while (--argsIndex) {
-            if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) {
-              continue outer;
-            }
-          }
-          result.push(value);
-        }
-      }
-      return result;
-    }
- 
-    /**
-     * Gets the last element of the `array`. If a number `n` is passed, the
-     * last `n` elements of the `array` are returned. If a `callback` function
-     * is passed, elements at the end of the array are returned as long as the
-     * `callback` returns truthy. The `callback` is bound to `thisArg` and
-     * invoked with three arguments;(value, index, array).
-     *
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to query.
-     * @param {Function|Object|Number|String} [callback|n] The function called
-     *  per element or the number of elements to return. If a property name or
-     *  object is passed, it will be used to create a "_.pluck" or "_.where"
-     *  style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Mixed} Returns the last element(s) of `array`.
-     * @example
-     *
-     * _.last([1, 2, 3]);
-     * // => 3
-     *
-     * _.last([1, 2, 3], 2);
-     * // => [2, 3]
-     *
-     * _.last([1, 2, 3], function(num) {
-     *   return num > 1;
-     * });
-     * // => [2, 3]
-     *
-     * var food = [
-     *   { 'name': 'beet',   'organic': false },
-     *   { 'name': 'carrot', 'organic': true }
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.last(food, 'organic');
-     * // => [{ 'name': 'carrot', 'organic': true }]
-     *
-     * var food = [
-     *   { 'name': 'banana', 'type': 'fruit' },
-     *   { 'name': 'beet',   'type': 'vegetable' },
-     *   { 'name': 'carrot', 'type': 'vegetable' }
-     * ];
-     *
-     * // using "_.where" callback shorthand
-     * _.last(food, { 'type': 'vegetable' });
-     * // => [{ 'name': 'beet', 'type': 'vegetable' }, { 'name': 'carrot', 'type': 'vegetable' }]
-     */
-    function last(array, callback, thisArg) {
-      if (array) {
-        var n = 0,
-            length = array.length;
- 
-        if (typeof callback != 'number' && callback != null) {
-          var index = length;
-          callback = lodash.createCallback(callback, thisArg);
-          while (index-- && callback(array[index], index, array)) {
-            n++;
-          }
-        } else {
-          n = callback;
-          if (n == null || thisArg) {
-            return array[length - 1];
-          }
-        }
-        return slice(array, nativeMax(0, length - n));
-      }
-    }
- 
-    /**
-     * Gets the index at which the last occurrence of `value` is found using strict
-     * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used
-     * as the offset from the end of the collection.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to search.
-     * @param {Mixed} value The value to search for.
-     * @param {Number} [fromIndex=array.length-1] The index to search from.
-     * @returns {Number} Returns the index of the matched value or `-1`.
-     * @example
-     *
-     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
-     * // => 4
-     *
-     * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
-     * // => 1
-     */
-    function lastIndexOf(array, value, fromIndex) {
-      var index = array ? array.length : 0;
-      if (typeof fromIndex == 'number') {
-        index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1;
-      }
-      while (index--) {
-        if (array[index] === value) {
-          return index;
-        }
-      }
-      return -1;
-    }
- 
-    /**
-     * Creates an array of numbers (positive and/or negative) progressing from
-     * `start` up to but not including `end`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Number} [start=0] The start of the range.
-     * @param {Number} end The end of the range.
-     * @param {Number} [step=1] The value to increment or decrement by.
-     * @returns {Array} Returns a new range array.
-     * @example
-     *
-     * _.range(10);
-     * // => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
-     *
-     * _.range(1, 11);
-     * // => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
-     *
-     * _.range(0, 30, 5);
-     * // => [0, 5, 10, 15, 20, 25]
-     *
-     * _.range(0, -10, -1);
-     * // => [0, -1, -2, -3, -4, -5, -6, -7, -8, -9]
-     *
-     * _.range(0);
-     * // => []
-     */
-    function range(start, end, step) {
-      start = +start || 0;
-      step = +step || 1;
- 
-      if (end == null) {
-        end = start;
-        start = 0;
-      }
-      // use `Array(length)` so V8 will avoid the slower "dictionary" mode
-      // http://youtu.be/XAqIpGU8ZZk#t=17m25s
-      var index = -1,
-          length = nativeMax(0, ceil((end - start) / step)),
-          result = Array(length);
- 
-      while (++index < length) {
-        result[index] = start;
-        start += step;
-      }
-      return result;
-    }
- 
-    /**
-     * The opposite of `_.initial`, this method gets all but the first value of
-     * `array`. If a number `n` is passed, the first `n` values are excluded from
-     * the result. If a `callback` function is passed, elements at the beginning
-     * of the array are excluded from the result as long as the `callback` returns
-     * truthy. The `callback` is bound to `thisArg` and invoked with three
-     * arguments; (value, index, array).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias drop, tail
-     * @category Arrays
-     * @param {Array} array The array to query.
-     * @param {Function|Object|Number|String} [callback|n=1] The function called
-     *  per element or the number of elements to exclude. If a property name or
-     *  object is passed, it will be used to create a "_.pluck" or "_.where"
-     *  style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a slice of `array`.
-     * @example
-     *
-     * _.rest([1, 2, 3]);
-     * // => [2, 3]
-     *
-     * _.rest([1, 2, 3], 2);
-     * // => [3]
-     *
-     * _.rest([1, 2, 3], function(num) {
-     *   return num < 3;
-     * });
-     * // => [3]
-     *
-     * var food = [
-     *   { 'name': 'banana', 'organic': true },
-     *   { 'name': 'beet',   'organic': false },
-     * ];
-     *
-     * // using "_.pluck" callback shorthand
-     * _.rest(food, 'organic');
-     * // => [{ 'name': 'beet', 'organic': false }]
-     *
-     * var food = [
-     *   { 'name': 'apple',  'type': 'fruit' },
-     *   { 'name': 'banana', 'type': 'fruit' },
-     *   { 'name': 'beet',   'type': 'vegetable' }
-     * ];
-     *
-     * // using "_.where" callback shorthand
-     * _.rest(food, { 'type': 'fruit' });
-     * // => [{ 'name': 'beet', 'type': 'vegetable' }]
-     */
-    function rest(array, callback, thisArg) {
-      if (typeof callback != 'number' && callback != null) {
-        var n = 0,
-            index = -1,
-            length = array ? array.length : 0;
- 
-        callback = lodash.createCallback(callback, thisArg);
-        while (++index < length && callback(array[index], index, array)) {
-          n++;
-        }
-      } else {
-        n = (callback == null || thisArg) ? 1 : nativeMax(0, callback);
-      }
-      return slice(array, n);
-    }
- 
-    /**
-     * Uses a binary search to determine the smallest index at which the `value`
-     * should be inserted into `array` in order to maintain the sort order of the
-     * sorted `array`. If `callback` is passed, it will be executed for `value` and
-     * each element in `array` to compute their sort ranking. The `callback` is
-     * bound to `thisArg` and invoked with one argument; (value).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to inspect.
-     * @param {Mixed} value The value to evaluate.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Number} Returns the index at which the value should be inserted
-     *  into `array`.
-     * @example
-     *
-     * _.sortedIndex([20, 30, 50], 40);
-     * // => 2
-     *
-     * // using "_.pluck" callback shorthand
-     * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
-     * // => 2
-     *
-     * var dict = {
-     *   'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
-     * };
-     *
-     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
-     *   return dict.wordToNumber[word];
-     * });
-     * // => 2
-     *
-     * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
-     *   return this.wordToNumber[word];
-     * }, dict);
-     * // => 2
-     */
-    function sortedIndex(array, value, callback, thisArg) {
-      var low = 0,
-          high = array ? array.length : low;
- 
-      // explicitly reference `identity` for better inlining in Firefox
-      callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity;
-      value = callback(value);
- 
-      while (low < high) {
-        var mid = (low + high) >>> 1;
-        (callback(array[mid]) < value)
-          ? low = mid + 1
-          : high = mid;
-      }
-      return low;
-    }
- 
-    /**
-     * Computes the union of the passed-in arrays using strict equality for
-     * comparisons, i.e. `===`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} [array1, array2, ...] Arrays to process.
-     * @returns {Array} Returns a new array of unique values, in order, that are
-     *  present in one or more of the arrays.
-     * @example
-     *
-     * _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
-     * // => [1, 2, 3, 101, 10]
-     */
-    function union(array) {
-      Eif (!isArray(array)) {
-        arguments[0] = array ? nativeSlice.call(array) : arrayProto;
-      }
-      return uniq(concat.apply(arrayProto, arguments));
-    }
- 
-    /**
-     * Creates a duplicate-value-free version of the `array` using strict equality
-     * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true`
-     * for `isSorted` will run a faster algorithm. If `callback` is passed, each
-     * element of `array` is passed through the `callback` before uniqueness is computed.
-     * The `callback` is bound to `thisArg` and invoked with three arguments; (value, index, array).
-     *
-     * If a property name is passed for `callback`, the created "_.pluck" style
-     * callback will return the property value of the given element.
-     *
-     * If an object is passed for `callback`, the created "_.where" style callback
-     * will return `true` for elements that have the properties of the given object,
-     * else `false`.
-     *
-     * @static
-     * @memberOf _
-     * @alias unique
-     * @category Arrays
-     * @param {Array} array The array to process.
-     * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted.
-     * @param {Function|Object|String} [callback=identity] The function called per
-     *  iteration. If a property name or object is passed, it will be used to create
-     *  a "_.pluck" or "_.where" style callback, respectively.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a duplicate-value-free array.
-     * @example
-     *
-     * _.uniq([1, 2, 1, 3, 1]);
-     * // => [1, 2, 3]
-     *
-     * _.uniq([1, 1, 2, 2, 3], true);
-     * // => [1, 2, 3]
-     *
-     * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); });
-     * // => ['A', 'b', 'C']
-     *
-     * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
-     * // => [1, 2.5, 3]
-     *
-     * // using "_.pluck" callback shorthand
-     * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
-     * // => [{ 'x': 1 }, { 'x': 2 }]
-     */
-    var uniq = overloadWrapper(function(array, isSorted, callback) {
-      var index = -1,
-          indexOf = getIndexOf(),
-          length = array ? array.length : 0,
-          isLarge = !isSorted && length >= largeArraySize,
-          result = [],
-          seen = isLarge ? createCache() : (callback ? [] : result);
- 
-      while (++index < length) {
-        var value = array[index],
-            computed = callback ? callback(value, index, array) : value;
- 
-        if (isSorted
-              ? !index || seen[seen.length - 1] !== computed
-              : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0)
-            ) {
-          if (callback || isLarge) {
-            seen.push(computed);
-          }
-          result.push(value);
-        }
-      }
-      return result;
-    });
- 
-    /**
-     * The inverse of `_.zip`, this method splits groups of elements into arrays
-     * composed of elements from each group at their corresponding indexes.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to process.
-     * @returns {Array} Returns a new array of the composed arrays.
-     * @example
-     *
-     * _.unzip([['moe', 30, true], ['larry', 40, false]]);
-     * // => [['moe', 'larry'], [30, 40], [true, false]];
-     */
-    function unzip(array) {
-      var index = -1,
-          length = array ? max(pluck(array, 'length')) : 0,
-          result = Array(length < 0 ? 0 : length);
- 
-      while (++index < length) {
-        result[index] = pluck(array, index);
-      }
-      return result;
-    }
- 
-    /**
-     * Creates an array with all occurrences of the passed values removed using
-     * strict equality for comparisons, i.e. `===`.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} array The array to filter.
-     * @param {Mixed} [value1, value2, ...] Values to remove.
-     * @returns {Array} Returns a new filtered array.
-     * @example
-     *
-     * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
-     * // => [2, 3, 4]
-     */
-    function without(array) {
-      return difference(array, nativeSlice.call(arguments, 1));
-    }
- 
-    /**
-     * Groups the elements of each array at their corresponding indexes. Useful for
-     * separate data sources that are coordinated through matching array indexes.
-     * For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix
-     * in a similar fashion.
-     *
-     * @static
-     * @memberOf _
-     * @category Arrays
-     * @param {Array} [array1, array2, ...] Arrays to process.
-     * @returns {Array} Returns a new array of grouped elements.
-     * @example
-     *
-     * _.zip(['moe', 'larry'], [30, 40], [true, false]);
-     * // => [['moe', 30, true], ['larry', 40, false]]
-     */
-    function zip(array) {
-      return array ? unzip(arguments) : [];
-    }
- 
-    /**
-     * Creates an object composed from arrays of `keys` and `values`. Pass either
-     * a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or
-     * two arrays, one of `keys` and one of corresponding `values`.
-     *
-     * @static
-     * @memberOf _
-     * @alias object
-     * @category Arrays
-     * @param {Array} keys The array of keys.
-     * @param {Array} [values=[]] The array of values.
-     * @returns {Object} Returns an object composed of the given keys and
-     *  corresponding values.
-     * @example
-     *
-     * _.zipObject(['moe', 'larry'], [30, 40]);
-     * // => { 'moe': 30, 'larry': 40 }
-     */
-    function zipObject(keys, values) {
-      var index = -1,
-          length = keys ? keys.length : 0,
-          result = {};
- 
-      while (++index < length) {
-        var key = keys[index];
-        if (values) {
-          result[key] = values[index];
-        } else {
-          result[key[0]] = key[1];
-        }
-      }
-      return result;
-    }
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * If `n` is greater than `0`, a function is created that is restricted to
-     * executing `func`, with the `this` binding and arguments of the created
-     * function, only after it is called `n` times. If `n` is less than `1`,
-     * `func` is executed immediately, without a `this` binding or additional
-     * arguments, and its result is returned.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Number} n The number of times the function must be called before
-     * it is executed.
-     * @param {Function} func The function to restrict.
-     * @returns {Function} Returns the new restricted function.
-     * @example
-     *
-     * var renderNotes = _.after(notes.length, render);
-     * _.forEach(notes, function(note) {
-     *   note.asyncSave({ 'success': renderNotes });
-     * });
-     * // `renderNotes` is run once, after all notes have saved
-     */
-    function after(n, func) {
-      if (n < 1) {
-        return func();
-      }
-      return function() {
-        if (--n < 1) {
-          return func.apply(this, arguments);
-        }
-      };
-    }
- 
-    /**
-     * Creates a function that, when called, invokes `func` with the `this`
-     * binding of `thisArg` and prepends any additional `bind` arguments to those
-     * passed to the bound function.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to bind.
-     * @param {Mixed} [thisArg] The `this` binding of `func`.
-     * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
-     * @returns {Function} Returns the new bound function.
-     * @example
-     *
-     * var func = function(greeting) {
-     *   return greeting + ' ' + this.name;
-     * };
-     *
-     * func = _.bind(func, { 'name': 'moe' }, 'hi');
-     * func();
-     * // => 'hi moe'
-     */
-    function bind(func, thisArg) {
-      // use `Function#bind` if it exists and is fast
-      // (in V8 `Function#bind` is slower except when partially applied)
-      return support.fastBind || (nativeBind && arguments.length > 2)
-        ? nativeBind.call.apply(nativeBind, arguments)
-        : createBound(func, thisArg, nativeSlice.call(arguments, 2));
-    }
- 
-    /**
-     * Binds methods on `object` to `object`, overwriting the existing method.
-     * Method names may be specified as individual arguments or as arrays of method
-     * names. If no method names are provided, all the function properties of `object`
-     * will be bound.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Object} object The object to bind and assign the bound methods to.
-     * @param {String} [methodName1, methodName2, ...] Method names on the object to bind.
-     * @returns {Object} Returns `object`.
-     * @example
-     *
-     * var view = {
-     *  'label': 'docs',
-     *  'onClick': function() { alert('clicked ' + this.label); }
-     * };
-     *
-     * _.bindAll(view);
-     * jQuery('#docs').on('click', view.onClick);
-     * // => alerts 'clicked docs', when the button is clicked
-     */
-    function bindAll(object) {
-      var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object),
-          index = -1,
-          length = funcs.length;
- 
-      while (++index < length) {
-        var key = funcs[index];
-        object[key] = bind(object[key], object);
-      }
-      return object;
-    }
- 
-    /**
-     * Creates a function that, when called, invokes the method at `object[key]`
-     * and prepends any additional `bindKey` arguments to those passed to the bound
-     * function. This method differs from `_.bind` by allowing bound functions to
-     * reference methods that will be redefined or don't yet exist.
-     * See http://michaux.ca/articles/lazy-function-definition-pattern.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Object} object The object the method belongs to.
-     * @param {String} key The key of the method.
-     * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
-     * @returns {Function} Returns the new bound function.
-     * @example
-     *
-     * var object = {
-     *   'name': 'moe',
-     *   'greet': function(greeting) {
-     *     return greeting + ' ' + this.name;
-     *   }
-     * };
-     *
-     * var func = _.bindKey(object, 'greet', 'hi');
-     * func();
-     * // => 'hi moe'
-     *
-     * object.greet = function(greeting) {
-     *   return greeting + ', ' + this.name + '!';
-     * };
-     *
-     * func();
-     * // => 'hi, moe!'
-     */
-    function bindKey(object, key) {
-      return createBound(object, key, nativeSlice.call(arguments, 2), indicatorObject);
-    }
- 
-    /**
-     * Creates a function that is the composition of the passed functions,
-     * where each function consumes the return value of the function that follows.
-     * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`.
-     * Each function is executed with the `this` binding of the composed function.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} [func1, func2, ...] Functions to compose.
-     * @returns {Function} Returns the new composed function.
-     * @example
-     *
-     * var greet = function(name) { return 'hi ' + name; };
-     * var exclaim = function(statement) { return statement + '!'; };
-     * var welcome = _.compose(exclaim, greet);
-     * welcome('moe');
-     * // => 'hi moe!'
-     */
-    function compose() {
-      var funcs = arguments;
-      return function() {
-        var args = arguments,
-            length = funcs.length;
- 
-        while (length--) {
-          args = [funcs[length].apply(this, args)];
-        }
-        return args[0];
-      };
-    }
- 
-    /**
-     * Produces a callback bound to an optional `thisArg`. If `func` is a property
-     * name, the created callback will return the property value for a given element.
-     * If `func` is an object, the created callback will return `true` for elements
-     * that contain the equivalent object properties, otherwise it will return `false`.
-     *
-     * Note: All Lo-Dash methods, that accept a `callback` argument, use `_.createCallback`.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Mixed} [func=identity] The value to convert to a callback.
-     * @param {Mixed} [thisArg] The `this` binding of the created callback.
-     * @param {Number} [argCount=3] The number of arguments the callback accepts.
-     * @returns {Function} Returns a callback function.
-     * @example
-     *
-     * var stooges = [
-     *   { 'name': 'moe', 'age': 40 },
-     *   { 'name': 'larry', 'age': 50 }
-     * ];
-     *
-     * // wrap to create custom callback shorthands
-     * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) {
-     *   var match = /^(.+?)__([gl]t)(.+)$/.exec(callback);
-     *   return !match ? func(callback, thisArg) : function(object) {
-     *     return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3];
-     *   };
-     * });
-     *
-     * _.filter(stooges, 'age__gt45');
-     * // => [{ 'name': 'larry', 'age': 50 }]
-     *
-     * // create mixins with support for "_.pluck" and "_.where" callback shorthands
-     * _.mixin({
-     *   'toLookup': function(collection, callback, thisArg) {
-     *     callback = _.createCallback(callback, thisArg);
-     *     return _.reduce(collection, function(result, value, index, collection) {
-     *       return (result[callback(value, index, collection)] = value, result);
-     *     }, {});
-     *   }
-     * });
-     *
-     * _.toLookup(stooges, 'name');
-     * // => { 'moe': { 'name': 'moe', 'age': 40 }, 'larry': { 'name': 'larry', 'age': 50 } }
-     */
-    function createCallback(func, thisArg, argCount) {
-      if (func == null) {
-        return identity;
-      }
-      var type = typeof func;
-      if (type != 'function') {
-        if (type != 'object') {
-          return function(object) {
-            return object[func];
-          };
-        }
-        var props = keys(func);
-        return function(object) {
-          var length = props.length,
-              result = false;
-          while (length--) {
-            if (!(result = isEqual(object[props[length]], func[props[length]], indicatorObject))) {
-              break;
-            }
-          }
-          return result;
-        };
-      }
-      if (typeof thisArg == 'undefined' || (reThis && !reThis.test(fnToString.call(func)))) {
-        return func;
-      }
-      if (argCount === 1) {
-        return function(value) {
-          return func.call(thisArg, value);
-        };
-      }
-      if (argCount === 2) {
-        return function(a, b) {
-          return func.call(thisArg, a, b);
-        };
-      }
-      if (argCount === 4) {
-        return function(accumulator, value, index, collection) {
-          return func.call(thisArg, accumulator, value, index, collection);
-        };
-      }
-      return function(value, index, collection) {
-        return func.call(thisArg, value, index, collection);
-      };
-    }
- 
-    /**
-     * Creates a function that will delay the execution of `func` until after
-     * `wait` milliseconds have elapsed since the last time it was invoked. Pass
-     * an `options` object to indicate that `func` should be invoked on the leading
-     * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced
-     * function will return the result of the last `func` call.
-     *
-     * Note: If `leading` and `trailing` options are `true`, `func` will be called
-     * on the trailing edge of the timeout only if the the debounced function is
-     * invoked more than once during the `wait` timeout.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to debounce.
-     * @param {Number} wait The number of milliseconds to delay.
-     * @param {Object} options The options object.
-     *  [leading=false] A boolean to specify execution on the leading edge of the timeout.
-     *  [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
-     * @returns {Function} Returns the new debounced function.
-     * @example
-     *
-     * var lazyLayout = _.debounce(calculateLayout, 300);
-     * jQuery(window).on('resize', lazyLayout);
-     *
-     * jQuery('#postbox').on('click', _.debounce(sendMail, 200, {
-     *   'leading': true,
-     *   'trailing': false
-     * });
-     */
-    function debounce(func, wait, options) {
-      var args,
-          result,
-          thisArg,
-          callCount = 0,
-          timeoutId = null,
-          trailing = true;
- 
-      function delayed() {
-        var isCalled = trailing && (!leading || callCount > 1);
-        callCount = timeoutId = 0;
-        if (isCalled) {
-          result = func.apply(thisArg, args);
-        }
-      }
-      if (options === true) {
-        var leading = true;
-        trailing = false;
-      } else if (isObject(options)) {
-        leading = options.leading;
-        trailing = 'trailing' in options ? options.trailing : trailing;
-      }
-      return function() {
-        args = arguments;
-        thisArg = this;
- 
-        // avoid issues with Titanium and `undefined` timeout ids
-        // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192
-        clearTimeout(timeoutId);
- 
-        if (leading && ++callCount < 2) {
-          result = func.apply(thisArg, args);
-        }
-        timeoutId = setTimeout(delayed, wait);
-        return result;
-      };
-    }
- 
-    /**
-     * Defers executing the `func` function until the current call stack has cleared.
-     * Additional arguments will be passed to `func` when it is invoked.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to defer.
-     * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the function with.
-     * @returns {Number} Returns the timer id.
-     * @example
-     *
-     * _.defer(function() { alert('deferred'); });
-     * // returns from the function before `alert` is called
-     */
-    function defer(func) {
-      var args = nativeSlice.call(arguments, 1);
-      return setTimeout(function() { func.apply(undefined, args); }, 1);
-    }
-    // use `setImmediate` if it's available in Node.js
-    Eif (isV8 && freeModule && typeof setImmediate == 'function') {
-      defer = bind(setImmediate, context);
-    }
- 
-    /**
-     * Executes the `func` function after `wait` milliseconds. Additional arguments
-     * will be passed to `func` when it is invoked.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to delay.
-     * @param {Number} wait The number of milliseconds to delay execution.
-     * @param {Mixed} [arg1, arg2, ...] Arguments to invoke the function with.
-     * @returns {Number} Returns the timer id.
-     * @example
-     *
-     * var log = _.bind(console.log, console);
-     * _.delay(log, 1000, 'logged later');
-     * // => 'logged later' (Appears after one second.)
-     */
-    function delay(func, wait) {
-      var args = nativeSlice.call(arguments, 2);
-      return setTimeout(function() { func.apply(undefined, args); }, wait);
-    }
- 
-    /**
-     * Creates a function that memoizes the result of `func`. If `resolver` is
-     * passed, it will be used to determine the cache key for storing the result
-     * based on the arguments passed to the memoized function. By default, the first
-     * argument passed to the memoized function is used as the cache key. The `func`
-     * is executed with the `this` binding of the memoized function.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to have its output memoized.
-     * @param {Function} [resolver] A function used to resolve the cache key.
-     * @returns {Function} Returns the new memoizing function.
-     * @example
-     *
-     * var fibonacci = _.memoize(function(n) {
-     *   return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
-     * });
-     */
-    function memoize(func, resolver) {
-      function memoized() {
-        var cache = memoized.cache,
-            key = keyPrefix + (resolver ? resolver.apply(this, arguments) : arguments[0]);
- 
-        return hasOwnProperty.call(cache, key)
-          ? cache[key]
-          : (cache[key] = func.apply(this, arguments));
-      }
-      memoized.cache = {};
-      return memoized;
-    }
- 
-    /**
-     * Creates a function that is restricted to execute `func` once. Repeat calls to
-     * the function will return the value of the first call. The `func` is executed
-     * with the `this` binding of the created function.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to restrict.
-     * @returns {Function} Returns the new restricted function.
-     * @example
-     *
-     * var initialize = _.once(createApplication);
-     * initialize();
-     * initialize();
-     * // `initialize` executes `createApplication` once
-     */
-    function once(func) {
-      var ran,
-          result;
- 
-      return function() {
-        if (ran) {
-          return result;
-        }
-        ran = true;
-        result = func.apply(this, arguments);
- 
-        // clear the `func` variable so the function may be garbage collected
-        func = null;
-        return result;
-      };
-    }
- 
-    /**
-     * Creates a function that, when called, invokes `func` with any additional
-     * `partial` arguments prepended to those passed to the new function. This
-     * method is similar to `_.bind`, except it does **not** alter the `this` binding.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to partially apply arguments to.
-     * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
-     * @returns {Function} Returns the new partially applied function.
-     * @example
-     *
-     * var greet = function(greeting, name) { return greeting + ' ' + name; };
-     * var hi = _.partial(greet, 'hi');
-     * hi('moe');
-     * // => 'hi moe'
-     */
-    function partial(func) {
-      return createBound(func, nativeSlice.call(arguments, 1));
-    }
- 
-    /**
-     * This method is similar to `_.partial`, except that `partial` arguments are
-     * appended to those passed to the new function.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to partially apply arguments to.
-     * @param {Mixed} [arg1, arg2, ...] Arguments to be partially applied.
-     * @returns {Function} Returns the new partially applied function.
-     * @example
-     *
-     * var defaultsDeep = _.partialRight(_.merge, _.defaults);
-     *
-     * var options = {
-     *   'variable': 'data',
-     *   'imports': { 'jq': $ }
-     * };
-     *
-     * defaultsDeep(options, _.templateSettings);
-     *
-     * options.variable
-     * // => 'data'
-     *
-     * options.imports
-     * // => { '_': _, 'jq': $ }
-     */
-    function partialRight(func) {
-      return createBound(func, nativeSlice.call(arguments, 1), null, indicatorObject);
-    }
- 
-    /**
-     * Creates a function that, when executed, will only call the `func` function
-     * at most once per every `wait` milliseconds. Pass an `options` object to
-     * indicate that `func` should be invoked on the leading and/or trailing edge
-     * of the `wait` timeout. Subsequent calls to the throttled function will
-     * return the result of the last `func` call.
-     *
-     * Note: If `leading` and `trailing` options are `true`, `func` will be called
-     * on the trailing edge of the timeout only if the the throttled function is
-     * invoked more than once during the `wait` timeout.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Function} func The function to throttle.
-     * @param {Number} wait The number of milliseconds to throttle executions to.
-     * @param {Object} options The options object.
-     *  [leading=true] A boolean to specify execution on the leading edge of the timeout.
-     *  [trailing=true] A boolean to specify execution on the trailing edge of the timeout.
-     * @returns {Function} Returns the new throttled function.
-     * @example
-     *
-     * var throttled = _.throttle(updatePosition, 100);
-     * jQuery(window).on('scroll', throttled);
-     *
-     * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, {
-     *   'trailing': false
-     * }));
-     */
-    function throttle(func, wait, options) {
-      var args,
-          result,
-          thisArg,
-          lastCalled = 0,
-          leading = true,
-          timeoutId = null,
-          trailing = true;
- 
-      function trailingCall() {
-        timeoutId = null;
-        if (trailing) {
-          lastCalled = new Date;
-          result = func.apply(thisArg, args);
-        }
-      }
-      if (options === false) {
-        leading = false;
-      } else if (isObject(options)) {
-        leading = 'leading' in options ? options.leading : leading;
-        trailing = 'trailing' in options ? options.trailing : trailing;
-      }
-      return function() {
-        var now = new Date;
-        if (!timeoutId && !leading) {
-          lastCalled = now;
-        }
-        var remaining = wait - (now - lastCalled);
-        args = arguments;
-        thisArg = this;
- 
-        if (remaining <= 0) {
-          clearTimeout(timeoutId);
-          timeoutId = null;
-          lastCalled = now;
-          result = func.apply(thisArg, args);
-        }
-        else if (!timeoutId) {
-          timeoutId = setTimeout(trailingCall, remaining);
-        }
-        return result;
-      };
-    }
- 
-    /**
-     * Creates a function that passes `value` to the `wrapper` function as its
-     * first argument. Additional arguments passed to the function are appended
-     * to those passed to the `wrapper` function. The `wrapper` is executed with
-     * the `this` binding of the created function.
-     *
-     * @static
-     * @memberOf _
-     * @category Functions
-     * @param {Mixed} value The value to wrap.
-     * @param {Function} wrapper The wrapper function.
-     * @returns {Function} Returns the new function.
-     * @example
-     *
-     * var hello = function(name) { return 'hello ' + name; };
-     * hello = _.wrap(hello, function(func) {
-     *   return 'before, ' + func('moe') + ', after';
-     * });
-     * hello();
-     * // => 'before, hello moe, after'
-     */
-    function wrap(value, wrapper) {
-      return function() {
-        var args = [value];
-        push.apply(args, arguments);
-        return wrapper.apply(this, args);
-      };
-    }
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their
-     * corresponding HTML entities.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {String} string The string to escape.
-     * @returns {String} Returns the escaped string.
-     * @example
-     *
-     * _.escape('Moe, Larry & Curly');
-     * // => 'Moe, Larry &amp; Curly'
-     */
-    function escape(string) {
-      return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar);
-    }
- 
-    /**
-     * This function returns the first argument passed to it.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {Mixed} value Any value.
-     * @returns {Mixed} Returns `value`.
-     * @example
-     *
-     * var moe = { 'name': 'moe' };
-     * moe === _.identity(moe);
-     * // => true
-     */
-    function identity(value) {
-      return value;
-    }
- 
-    /**
-     * Adds functions properties of `object` to the `lodash` function and chainable
-     * wrapper.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {Object} object The object of function properties to add to `lodash`.
-     * @example
-     *
-     * _.mixin({
-     *   'capitalize': function(string) {
-     *     return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
-     *   }
-     * });
-     *
-     * _.capitalize('moe');
-     * // => 'Moe'
-     *
-     * _('moe').capitalize();
-     * // => 'Moe'
-     */
-    function mixin(object) {
-      forEach(functions(object), function(methodName) {
-        var func = lodash[methodName] = object[methodName];
- 
-        lodash.prototype[methodName] = function() {
-          var value = this.__wrapped__,
-              args = [value];
- 
-          push.apply(args, arguments);
-          var result = func.apply(lodash, args);
-          return (value && typeof value == 'object' && value == result)
-            ? this
-            : new lodashWrapper(result);
-        };
-      });
-    }
- 
-    /**
-     * Reverts the '_' variable to its previous value and returns a reference to
-     * the `lodash` function.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @returns {Function} Returns the `lodash` function.
-     * @example
-     *
-     * var lodash = _.noConflict();
-     */
-    function noConflict() {
-      context._ = oldDash;
-      return this;
-    }
- 
-    /**
-     * Converts the given `value` into an integer of the specified `radix`.
-     * If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the
-     * `value` is a hexadecimal, in which case a `radix` of `16` is used.
-     *
-     * Note: This method avoids differences in native ES3 and ES5 `parseInt`
-     * implementations. See http://es5.github.com/#E.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {String} value The value to parse.
-     * @param {Number} [radix] The radix used to interpret the value to parse.
-     * @returns {Number} Returns the new integer value.
-     * @example
-     *
-     * _.parseInt('08');
-     * // => 8
-     */
-    var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) {
-      // Firefox and Opera still follow the ES3 specified implementation of `parseInt`
-      return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0);
-    };
- 
-    /**
-     * Produces a random number between `min` and `max` (inclusive). If only one
-     * argument is passed, a number between `0` and the given number will be returned.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {Number} [min=0] The minimum possible value.
-     * @param {Number} [max=1] The maximum possible value.
-     * @returns {Number} Returns a random number.
-     * @example
-     *
-     * _.random(0, 5);
-     * // => a number between 0 and 5
-     *
-     * _.random(5);
-     * // => also a number between 0 and 5
-     */
-    function random(min, max) {
-      if (min == null && max == null) {
-        max = 1;
-      }
-      min = +min || 0;
-      if (max == null) {
-        max = min;
-        min = 0;
-      } else {
-        max = +max || 0;
-      }
-      var rand = nativeRandom();
-      return (min % 1 || max % 1)
-        ? min + nativeMin(rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1))), max)
-        : min + floor(rand * (max - min + 1));
-    }
- 
-    /**
-     * Resolves the value of `property` on `object`. If `property` is a function,
-     * it will be invoked with the `this` binding of `object` and its result returned,
-     * else the property value is returned. If `object` is falsey, then `undefined`
-     * is returned.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {Object} object The object to inspect.
-     * @param {String} property The property to get the value of.
-     * @returns {Mixed} Returns the resolved value.
-     * @example
-     *
-     * var object = {
-     *   'cheese': 'crumpets',
-     *   'stuff': function() {
-     *     return 'nonsense';
-     *   }
-     * };
-     *
-     * _.result(object, 'cheese');
-     * // => 'crumpets'
-     *
-     * _.result(object, 'stuff');
-     * // => 'nonsense'
-     */
-    function result(object, property) {
-      var value = object ? object[property] : undefined;
-      return isFunction(value) ? object[property]() : value;
-    }
- 
-    /**
-     * A micro-templating method that handles arbitrary delimiters, preserves
-     * whitespace, and correctly escapes quotes within interpolated code.
-     *
-     * Note: In the development build, `_.template` utilizes sourceURLs for easier
-     * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
-     *
-     * For more information on precompiling templates see:
-     * http://lodash.com/#custom-builds
-     *
-     * For more information on Chrome extension sandboxes see:
-     * http://developer.chrome.com/stable/extensions/sandboxingEval.html
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {String} text The template text.
-     * @param {Object} data The data object used to populate the text.
-     * @param {Object} options The options object.
-     *  escape - The "escape" delimiter regexp.
-     *  evaluate - The "evaluate" delimiter regexp.
-     *  interpolate - The "interpolate" delimiter regexp.
-     *  sourceURL - The sourceURL of the template's compiled source.
-     *  variable - The data object variable name.
-     * @returns {Function|String} Returns a compiled function when no `data` object
-     *  is given, else it returns the interpolated text.
-     * @example
-     *
-     * // using a compiled template
-     * var compiled = _.template('hello <%= name %>');
-     * compiled({ 'name': 'moe' });
-     * // => 'hello moe'
-     *
-     * var list = '<% _.forEach(people, function(name) { %><li><%= name %></li><% }); %>';
-     * _.template(list, { 'people': ['moe', 'larry'] });
-     * // => '<li>moe</li><li>larry</li>'
-     *
-     * // using the "escape" delimiter to escape HTML in data property values
-     * _.template('<b><%- value %></b>', { 'value': '<script>' });
-     * // => '<b>&lt;script&gt;</b>'
-     *
-     * // using the ES6 delimiter as an alternative to the default "interpolate" delimiter
-     * _.template('hello ${ name }', { 'name': 'curly' });
-     * // => 'hello curly'
-     *
-     * // using the internal `print` function in "evaluate" delimiters
-     * _.template('<% print("hello " + epithet); %>!', { 'epithet': 'stooge' });
-     * // => 'hello stooge!'
-     *
-     * // using custom template delimiters
-     * _.templateSettings = {
-     *   'interpolate': /{{([\s\S]+?)}}/g
-     * };
-     *
-     * _.template('hello {{ name }}!', { 'name': 'mustache' });
-     * // => 'hello mustache!'
-     *
-     * // using the `sourceURL` option to specify a custom sourceURL for the template
-     * var compiled = _.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
-     * compiled(data);
-     * // => find the source of "greeting.jst" under the Sources tab or Resources panel of the web inspector
-     *
-     * // using the `variable` option to ensure a with-statement isn't used in the compiled template
-     * var compiled = _.template('hi <%= data.name %>!', null, { 'variable': 'data' });
-     * compiled.source;
-     * // => function(data) {
-     *   var __t, __p = '', __e = _.escape;
-     *   __p += 'hi ' + ((__t = ( data.name )) == null ? '' : __t) + '!';
-     *   return __p;
-     * }
-     *
-     * // using the `source` property to inline compiled templates for meaningful
-     * // line numbers in error messages and a stack trace
-     * fs.writeFileSync(path.join(cwd, 'jst.js'), '\
-     *   var JST = {\
-     *     "main": ' + _.template(mainText).source + '\
-     *   };\
-     * ');
-     */
-    function template(text, data, options) {
-      // based on John Resig's `tmpl` implementation
-      // http://ejohn.org/blog/javascript-micro-templating/
-      // and Laura Doktorova's doT.js
-      // https://github.com/olado/doT
-      var settings = lodash.templateSettings;
-      text || (text = '');
- 
-      // avoid missing dependencies when `iteratorTemplate` is not defined
-      options = iteratorTemplate ? defaults({}, options, settings) : settings;
- 
-      var imports = iteratorTemplate && defaults({}, options.imports, settings.imports),
-          importsKeys = iteratorTemplate ? keys(imports) : ['_'],
-          importsValues = iteratorTemplate ? values(imports) : [lodash];
- 
-      var isEvaluating,
-          index = 0,
-          interpolate = options.interpolate || reNoMatch,
-          source = "__p += '";
- 
-      // compile the regexp to match each delimiter
-      var reDelimiters = RegExp(
-        (options.escape || reNoMatch).source + '|' +
-        interpolate.source + '|' +
-        (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + '|' +
-        (options.evaluate || reNoMatch).source + '|$'
-      , 'g');
- 
-      text.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
-        interpolateValue || (interpolateValue = esTemplateValue);
- 
-        // escape characters that cannot be included in string literals
-        source += text.slice(index, offset).replace(reUnescapedString, escapeStringChar);
- 
-        // replace delimiters with snippets
-        Iif (escapeValue) {
-          source += "' +\n__e(" + escapeValue + ") +\n'";
-        }
-        if (evaluateValue) {
-          isEvaluating = true;
-          source += "';\n" + evaluateValue + ";\n__p += '";
-        }
-        if (interpolateValue) {
-          source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
-        }
-        index = offset + match.length;
- 
-        // the JS engine embedded in Adobe products requires returning the `match`
-        // string in order to produce the correct `offset` value
-        return match;
-      });
- 
-      source += "';\n";
- 
-      // if `variable` is not specified, wrap a with-statement around the generated
-      // code to add the data object to the top of the scope chain
-      var variable = options.variable,
-          hasVariable = variable;
- 
-      if (!hasVariable) {
-        variable = 'obj';
-        source = 'with (' + variable + ') {\n' + source + '\n}\n';
-      }
-      // cleanup code by stripping empty strings
-      source = (isEvaluating ? source.replace(reEmptyStringLeading, '') : source)
-        .replace(reEmptyStringMiddle, '$1')
-        .replace(reEmptyStringTrailing, '$1;');
- 
-      // frame code as the function body
-      source = 'function(' + variable + ') {\n' +
-        (hasVariable ? '' : variable + ' || (' + variable + ' = {});\n') +
-        "var __t, __p = '', __e = _.escape" +
-        (isEvaluating
-          ? ', __j = Array.prototype.join;\n' +
-            "function print() { __p += __j.call(arguments, '') }\n"
-          : ';\n'
-        ) +
-        source +
-        'return __p\n}';
- 
-      // Use a sourceURL for easier debugging and wrap in a multi-line comment to
-      // avoid issues with Narwhal, IE conditional compilation, and the JS engine
-      // embedded in Adobe products.
-      // http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
-      var sourceURL = '\n/*\n//@ sourceURL=' + (options.sourceURL || '/lodash/template/source[' + (templateCounter++) + ']') + '\n*/';
- 
-      try {
-        var result = Function(importsKeys, 'return ' + source + sourceURL).apply(undefined, importsValues);
-      } catch(e) {
-        e.source = source;
-        throw e;
-      }
-      if (data) {
-        return result(data);
-      }
-      // provide the compiled function's source via its `toString` method, in
-      // supported environments, or the `source` property as a convenience for
-      // inlining compiled templates during the build process
-      result.source = source;
-      return result;
-    }
- 
-    /**
-     * Executes the `callback` function `n` times, returning an array of the results
-     * of each `callback` execution. The `callback` is bound to `thisArg` and invoked
-     * with one argument; (index).
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {Number} n The number of times to execute the callback.
-     * @param {Function} callback The function called per iteration.
-     * @param {Mixed} [thisArg] The `this` binding of `callback`.
-     * @returns {Array} Returns a new array of the results of each `callback` execution.
-     * @example
-     *
-     * var diceRolls = _.times(3, _.partial(_.random, 1, 6));
-     * // => [3, 6, 4]
-     *
-     * _.times(3, function(n) { mage.castSpell(n); });
-     * // => calls `mage.castSpell(n)` three times, passing `n` of `0`, `1`, and `2` respectively
-     *
-     * _.times(3, function(n) { this.cast(n); }, mage);
-     * // => also calls `mage.castSpell(n)` three times
-     */
-    function times(n, callback, thisArg) {
-      n = (n = +n) > -1 ? n : 0;
-      var index = -1,
-          result = Array(n);
- 
-      callback = lodash.createCallback(callback, thisArg, 1);
-      while (++index < n) {
-        result[index] = callback(index);
-      }
-      return result;
-    }
- 
-    /**
-     * The inverse of `_.escape`, this method converts the HTML entities
-     * `&amp;`, `&lt;`, `&gt;`, `&quot;`, and `&#39;` in `string` to their
-     * corresponding characters.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {String} string The string to unescape.
-     * @returns {String} Returns the unescaped string.
-     * @example
-     *
-     * _.unescape('Moe, Larry &amp; Curly');
-     * // => 'Moe, Larry & Curly'
-     */
-    function unescape(string) {
-      return string == null ? '' : String(string).replace(reEscapedHtml, unescapeHtmlChar);
-    }
- 
-    /**
-     * Generates a unique ID. If `prefix` is passed, the ID will be appended to it.
-     *
-     * @static
-     * @memberOf _
-     * @category Utilities
-     * @param {String} [prefix] The value to prefix the ID with.
-     * @returns {String} Returns the unique ID.
-     * @example
-     *
-     * _.uniqueId('contact_');
-     * // => 'contact_104'
-     *
-     * _.uniqueId();
-     * // => '105'
-     */
-    function uniqueId(prefix) {
-      var id = ++idCounter;
-      return String(prefix == null ? '' : prefix) + id;
-    }
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * Invokes `interceptor` with the `value` as the first argument, and then
-     * returns `value`. The purpose of this method is to "tap into" a method chain,
-     * in order to perform operations on intermediate results within the chain.
-     *
-     * @static
-     * @memberOf _
-     * @category Chaining
-     * @param {Mixed} value The value to pass to `interceptor`.
-     * @param {Function} interceptor The function to invoke.
-     * @returns {Mixed} Returns `value`.
-     * @example
-     *
-     * _([1, 2, 3, 4])
-     *  .filter(function(num) { return num % 2 == 0; })
-     *  .tap(alert)
-     *  .map(function(num) { return num * num; })
-     *  .value();
-     * // => // [2, 4] (alerted)
-     * // => [4, 16]
-     */
-    function tap(value, interceptor) {
-      interceptor(value);
-      return value;
-    }
- 
-    /**
-     * Produces the `toString` result of the wrapped value.
-     *
-     * @name toString
-     * @memberOf _
-     * @category Chaining
-     * @returns {String} Returns the string result.
-     * @example
-     *
-     * _([1, 2, 3]).toString();
-     * // => '1,2,3'
-     */
-    function wrapperToString() {
-      return String(this.__wrapped__);
-    }
- 
-    /**
-     * Extracts the wrapped value.
-     *
-     * @name valueOf
-     * @memberOf _
-     * @alias value
-     * @category Chaining
-     * @returns {Mixed} Returns the wrapped value.
-     * @example
-     *
-     * _([1, 2, 3]).valueOf();
-     * // => [1, 2, 3]
-     */
-    function wrapperValueOf() {
-      return this.__wrapped__;
-    }
- 
-    /*--------------------------------------------------------------------------*/
- 
-    // add functions that return wrapped values when chaining
-    lodash.after = after;
-    lodash.assign = assign;
-    lodash.at = at;
-    lodash.bind = bind;
-    lodash.bindAll = bindAll;
-    lodash.bindKey = bindKey;
-    lodash.compact = compact;
-    lodash.compose = compose;
-    lodash.countBy = countBy;
-    lodash.createCallback = createCallback;
-    lodash.debounce = debounce;
-    lodash.defaults = defaults;
-    lodash.defer = defer;
-    lodash.delay = delay;
-    lodash.difference = difference;
-    lodash.filter = filter;
-    lodash.flatten = flatten;
-    lodash.forEach = forEach;
-    lodash.forIn = forIn;
-    lodash.forOwn = forOwn;
-    lodash.functions = functions;
-    lodash.groupBy = groupBy;
-    lodash.initial = initial;
-    lodash.intersection = intersection;
-    lodash.invert = invert;
-    lodash.invoke = invoke;
-    lodash.keys = keys;
-    lodash.map = map;
-    lodash.max = max;
-    lodash.memoize = memoize;
-    lodash.merge = merge;
-    lodash.min = min;
-    lodash.omit = omit;
-    lodash.once = once;
-    lodash.pairs = pairs;
-    lodash.partial = partial;
-    lodash.partialRight = partialRight;
-    lodash.pick = pick;
-    lodash.pluck = pluck;
-    lodash.range = range;
-    lodash.reject = reject;
-    lodash.rest = rest;
-    lodash.shuffle = shuffle;
-    lodash.sortBy = sortBy;
-    lodash.tap = tap;
-    lodash.throttle = throttle;
-    lodash.times = times;
-    lodash.toArray = toArray;
-    lodash.transform = transform;
-    lodash.union = union;
-    lodash.uniq = uniq;
-    lodash.unzip = unzip;
-    lodash.values = values;
-    lodash.where = where;
-    lodash.without = without;
-    lodash.wrap = wrap;
-    lodash.zip = zip;
-    lodash.zipObject = zipObject;
- 
-    // add aliases
-    lodash.collect = map;
-    lodash.drop = rest;
-    lodash.each = forEach;
-    lodash.extend = assign;
-    lodash.methods = functions;
-    lodash.object = zipObject;
-    lodash.select = filter;
-    lodash.tail = rest;
-    lodash.unique = uniq;
- 
-    // add functions to `lodash.prototype`
-    mixin(lodash);
- 
-    // add Underscore compat
-    lodash.chain = lodash;
-    lodash.prototype.chain = function() { return this; };
- 
-    /*--------------------------------------------------------------------------*/
- 
-    // add functions that return unwrapped values when chaining
-    lodash.clone = clone;
-    lodash.cloneDeep = cloneDeep;
-    lodash.contains = contains;
-    lodash.escape = escape;
-    lodash.every = every;
-    lodash.find = find;
-    lodash.findIndex = findIndex;
-    lodash.findKey = findKey;
-    lodash.has = has;
-    lodash.identity = identity;
-    lodash.indexOf = indexOf;
-    lodash.isArguments = isArguments;
-    lodash.isArray = isArray;
-    lodash.isBoolean = isBoolean;
-    lodash.isDate = isDate;
-    lodash.isElement = isElement;
-    lodash.isEmpty = isEmpty;
-    lodash.isEqual = isEqual;
-    lodash.isFinite = isFinite;
-    lodash.isFunction = isFunction;
-    lodash.isNaN = isNaN;
-    lodash.isNull = isNull;
-    lodash.isNumber = isNumber;
-    lodash.isObject = isObject;
-    lodash.isPlainObject = isPlainObject;
-    lodash.isRegExp = isRegExp;
-    lodash.isString = isString;
-    lodash.isUndefined = isUndefined;
-    lodash.lastIndexOf = lastIndexOf;
-    lodash.mixin = mixin;
-    lodash.noConflict = noConflict;
-    lodash.parseInt = parseInt;
-    lodash.random = random;
-    lodash.reduce = reduce;
-    lodash.reduceRight = reduceRight;
-    lodash.result = result;
-    lodash.runInContext = runInContext;
-    lodash.size = size;
-    lodash.some = some;
-    lodash.sortedIndex = sortedIndex;
-    lodash.template = template;
-    lodash.unescape = unescape;
-    lodash.uniqueId = uniqueId;
- 
-    // add aliases
-    lodash.all = every;
-    lodash.any = some;
-    lodash.detect = find;
-    lodash.findWhere = find;
-    lodash.foldl = reduce;
-    lodash.foldr = reduceRight;
-    lodash.include = contains;
-    lodash.inject = reduce;
- 
-    forOwn(lodash, function(func, methodName) {
-      if (!lodash.prototype[methodName]) {
-        lodash.prototype[methodName] = function() {
-          var args = [this.__wrapped__];
-          push.apply(args, arguments);
-          return func.apply(lodash, args);
-        };
-      }
-    });
- 
-    /*--------------------------------------------------------------------------*/
- 
-    // add functions capable of returning wrapped and unwrapped values when chaining
-    lodash.first = first;
-    lodash.last = last;
- 
-    // add aliases
-    lodash.take = first;
-    lodash.head = first;
- 
-    forOwn(lodash, function(func, methodName) {
-      if (!lodash.prototype[methodName]) {
-        lodash.prototype[methodName]= function(callback, thisArg) {
-          var result = func(this.__wrapped__, callback, thisArg);
-          return callback == null || (thisArg && typeof callback != 'function')
-            ? result
-            : new lodashWrapper(result);
-        };
-      }
-    });
- 
-    /*--------------------------------------------------------------------------*/
- 
-    /**
-     * The semantic version number.
-     *
-     * @static
-     * @memberOf _
-     * @type String
-     */
-    lodash.VERSION = '1.2.1';
- 
-    // add "Chaining" functions to the wrapper
-    lodash.prototype.toString = wrapperToString;
-    lodash.prototype.value = wrapperValueOf;
-    lodash.prototype.valueOf = wrapperValueOf;
- 
-    // add `Array` functions that return unwrapped values
-    basicEach(['join', 'pop', 'shift'], function(methodName) {
-      var func = arrayProto[methodName];
-      lodash.prototype[methodName] = function() {
-        return func.apply(this.__wrapped__, arguments);
-      };
-    });
- 
-    // add `Array` functions that return the wrapped value
-    basicEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) {
-      var func = arrayProto[methodName];
-      lodash.prototype[methodName] = function() {
-        func.apply(this.__wrapped__, arguments);
-        return this;
-      };
-    });
- 
-    // add `Array` functions that return new wrapped values
-    basicEach(['concat', 'slice', 'splice'], function(methodName) {
-      var func = arrayProto[methodName];
-      lodash.prototype[methodName] = function() {
-        return new lodashWrapper(func.apply(this.__wrapped__, arguments));
-      };
-    });
- 
-    // avoid array-like object bugs with `Array#shift` and `Array#splice`
-    // in Firefox < 10 and IE < 9
-    Iif (!support.spliceObjects) {
-      basicEach(['pop', 'shift', 'splice'], function(methodName) {
-        var func = arrayProto[methodName],
-            isSplice = methodName == 'splice';
- 
-        lodash.prototype[methodName] = function() {
-          var value = this.__wrapped__,
-              result = func.apply(value, arguments);
- 
-          if (value.length === 0) {
-            delete value[0];
-          }
-          return isSplice ? new lodashWrapper(result) : result;
-        };
-      });
-    }
- 
-    // add pseudo private property to be used and removed during the build process
-    lodash._basicEach = basicEach;
-    lodash._iteratorTemplate = iteratorTemplate;
-    lodash._shimKeys = shimKeys;
- 
-    return lodash;
-  }
- 
-  /*--------------------------------------------------------------------------*/
- 
-  // expose Lo-Dash
-  var _ = runInContext();
- 
-  // some AMD build optimizers, like r.js, check for specific condition patterns like the following:
-  Iif (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
-    // Expose Lo-Dash to the global object even when an AMD loader is present in
-    // case Lo-Dash was injected by a third-party script and not intended to be
-    // loaded as a module. The global assignment can be reverted in the Lo-Dash
-    // module via its `noConflict()` method.
-    window._ = _;
- 
-    // define as an anonymous module so, through path mapping, it can be
-    // referenced as the "underscore" module
-    define(function() {
-      return _;
-    });
-  }
-  // check for `exports` after `define` in case a build optimizer adds an `exports` object
-  else Eif (freeExports && !freeExports.nodeType) {
-    // in Node.js or RingoJS v0.8.0+
-    Eif (freeModule) {
-      (freeModule.exports = _)._ = _;
-    }
-    // in Narwhal or RingoJS v0.7.0-
-    else {
-      freeExports._ = _;
-    }
-  }
-  else {
-    // in a browser or Rhino
-    window._ = _;
-  }
-}(this));
- 
- -
- - - - - - - - diff --git a/coverage/prettify.css b/coverage/prettify.css deleted file mode 100644 index b317a7cda3..0000000000 --- a/coverage/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/coverage/prettify.js b/coverage/prettify.js deleted file mode 100644 index ef51e03866..0000000000 --- a/coverage/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/test/run-rest.sh b/test/run-rest.sh new file mode 100644 index 0000000000..4f81a65146 --- /dev/null +++ b/test/run-rest.sh @@ -0,0 +1,18 @@ +cd "$(dirname "$0")" + +for cmd in rhino "rhino -require" narwhal ringo phantomjs; do + echo "Testing in $cmd..." + $cmd test.js ../dist/lodash.compat.js && $cmd test.js ../dist/lodash.compat.min.js + echo "" +done + +echo "Testing in node..." +node test.js ../dist/lodash.js && node test.js ../dist/lodash.min.js + +echo "" +echo "Testing build..." +node test-build.js + +echo "" +echo "Testing in a browser..." +open index.html From 821602ef1c1ea20c8fc8f7df9b54ca423e947b78 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 30 May 2013 10:44:08 +0200 Subject: [PATCH 087/117] package.json: Remove Grunt `devDependencies` Follow-up commit to dc3512de9f5b7b7a03b7b77cd091dcc80c2fdaf8 [formerly 6d38406eafbfc880c0b5aabf853c987c65f03482]. Former-commit-id: f8c310cad3fe165b6005312bad74a9abc5148a47 --- package.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 09b09f3697..294d157daf 100644 --- a/package.json +++ b/package.json @@ -30,9 +30,7 @@ "lodash": "./build.js" }, "devDependencies": { - "istanbul": "~0.1.35", - "grunt": "~0.4.1", - "grunt-shell": "~0.2.2" + "istanbul": "~0.1.35" }, "engines": [ "node", From 6446daf1a6c68f1ab3c44a4e75bd24dd0c2e29f5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 30 May 2013 08:23:08 -0400 Subject: [PATCH 088/117] Remove Instanbul note from README and devDependency from package.json. Former-commit-id: 891c387534df492f9e4d836daac7adc930205fb3 --- README.md | 9 --------- package.json | 3 --- 2 files changed, 12 deletions(-) diff --git a/README.md b/README.md index 1365cf90c5..93e0fc1715 100644 --- a/README.md +++ b/README.md @@ -246,15 +246,6 @@ require({ }); ``` -## Unit tests & code coverage - -After cloning this repository, run `npm install` to install the dependencies needed for Lo-Dash development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`. - -Once that’s done, you can run the unit tests in Node using `npm test` or `node test/test.js`. To run the tests in Rhino, Ringo, Narwhal, PhantomJS, and web browsers as well, use `grunt test`. - -To generate [the code coverage report](http://rawgithub.com/bestiejs/lodash/master/coverage/lodash/lodash.js.html), use `grunt cover`. - - ## Release Notes ### v1.2.1 diff --git a/package.json b/package.json index 294d157daf..422ff0b381 100644 --- a/package.json +++ b/package.json @@ -29,9 +29,6 @@ "bin": { "lodash": "./build.js" }, - "devDependencies": { - "istanbul": "~0.1.35" - }, "engines": [ "node", "rhino" From eccab3cd578ce58b0228c4b4d77daf7900894cd4 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 30 May 2013 09:37:09 -0400 Subject: [PATCH 089/117] Fix build test for older Node versions w/o setImmediate. Former-commit-id: 9f21f174626cd86eefd0a26cf0b36a60858ba501 --- test/test-build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-build.js b/test/test-build.js index a9d766bdbe..d44097e0a0 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -1535,7 +1535,7 @@ vm.runInContext(data.source, context, true); var lodash = context._; - if (methodName == 'chain' || methodName == 'defer' || methodName == 'findWhere') { + if (methodName == 'chain' || methodName == 'findWhere' || (methodName == 'defer' && global.setImmediate)) { notEqual(strip(lodash[methodName]), strip(_[methodName]), basename); } else if (!/\.min$/.test(basename)) { equal(strip(lodash[methodName]), strip(_[methodName]), basename); From 9e63270fc5b1c98806bc337f69b87c52bc423ad1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 2 Jun 2013 17:29:57 -0700 Subject: [PATCH 090/117] Add Volo ignore entry to package.json. Former-commit-id: 9fe60cf0dcfeb4f688f53ffb1995a619d420d586 --- package.json | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/package.json b/package.json index 422ff0b381..45f33a1e8a 100644 --- a/package.json +++ b/package.json @@ -35,5 +35,27 @@ ], "jam": { "main": "./dist/lodash.compat.js" + }, + "volo": { + "type": "directory", + "ignore": [ + ".*", + "*.custom.*", + "*.template.*", + "*.d.ts", + "*.map", + "*.md", + "*.txt", + "build.js", + "index.js", + "bower.json", + "component.json", + "build", + "doc", + "node_modules", + "perf", + "test", + "vendor" + ] } } From 13ead0085dfe1d4c9fcbc0ad3eb1cf7feeb7094f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 2 Jun 2013 21:25:57 -0700 Subject: [PATCH 091/117] Add array and object pools to lodash. Former-commit-id: f038284d6a544e146dc271ed0fbea0d7401593d4 --- build.js | 122 ++++++++++++++---- build/pre-compile.js | 50 +++++--- lodash.js | 290 ++++++++++++++++++++++++++++++------------- 3 files changed, 338 insertions(+), 124 deletions(-) diff --git a/build.js b/build.js index 8bb481c111..a6578fe868 100755 --- a/build.js +++ b/build.js @@ -85,7 +85,7 @@ 'bind': ['createBound'], 'bindAll': ['bind', 'functions'], 'bindKey': ['createBound'], - 'clone': ['assign', 'forEach', 'forOwn', 'isArray', 'isObject', 'isNode', 'slice'], + 'clone': ['assign', 'forEach', 'forOwn', 'getArray', 'isArray', 'isObject', 'isNode', 'releaseArray', 'slice'], 'cloneDeep': ['clone'], 'compact': [], 'compose': [], @@ -114,7 +114,7 @@ 'identity': [], 'indexOf': ['basicIndexOf', 'sortedIndex'], 'initial': ['slice'], - 'intersection': ['createCache'], + 'intersection': ['createCache', 'getArray', 'releaseArray'], 'invert': ['keys'], 'invoke': ['forEach'], 'isArguments': [], @@ -123,7 +123,7 @@ 'isDate': [], 'isElement': [], 'isEmpty': ['forOwn', 'isArguments', 'isFunction'], - 'isEqual': ['forIn', 'isArguments', 'isFunction', 'isNode'], + 'isEqual': ['forIn', 'getArray', 'isArguments', 'isFunction', 'isNode', 'releaseArray'], 'isFinite': [], 'isFunction': [], 'isNaN': ['isNumber'], @@ -140,7 +140,7 @@ 'map': ['basicEach', 'createCallback', 'isArray'], 'max': ['basicEach', 'charAtCallback', 'createCallback', 'isArray', 'isString'], 'memoize': [], - 'merge': ['forEach', 'forOwn', 'isArray', 'isObject', 'isPlainObject'], + 'merge': ['forEach', 'forOwn', 'getArray', 'isArray', 'isObject', 'isPlainObject', 'releaseArray'], 'min': ['basicEach', 'charAtCallback', 'createCallback', 'isArray', 'isString'], 'mixin': ['forEach', 'functions'], 'noConflict': [], @@ -163,7 +163,7 @@ 'shuffle': ['forEach'], 'size': ['keys'], 'some': ['basicEach', 'createCallback', 'isArray'], - 'sortBy': ['compareAscending', 'createCallback', 'forEach'], + 'sortBy': ['compareAscending', 'createCallback', 'forEach', 'getObject', 'releaseObject'], 'sortedIndex': ['createCallback', 'identity'], 'tap': ['value'], 'template': ['defaults', 'escape', 'escapeStringChar', 'keys', 'values'], @@ -173,7 +173,7 @@ 'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'], 'unescape': ['unescapeHtmlChar'], 'union': ['isArray', 'uniq'], - 'uniq': ['createCache', 'getIndexOf', 'overloadWrapper'], + 'uniq': ['createCache', 'getArray', 'getIndexOf', 'overloadWrapper', 'releaseArray'], 'uniqueId': [], 'unzip': ['max', 'pluck'], 'value': ['basicEach', 'forOwn', 'isArray', 'lodashWrapper'], @@ -190,17 +190,21 @@ 'charAtCallback': [], 'compareAscending': [], 'createBound': ['createObject', 'isFunction', 'isObject'], - 'createCache': ['basicIndexOf', 'getIndexOf'], - 'createIterator': ['iteratorTemplate'], + 'createCache': ['basicIndexOf', 'getArray', 'getIndexOf', 'getObject', 'releaseObject'], + 'createIterator': ['getObject', 'iteratorTemplate', 'releaseObject'], 'createObject': [ 'isObject', 'noop'], 'escapeHtmlChar': [], 'escapeStringChar': [], + 'getArray': [], 'getIndexOf': ['basicIndexOf', 'indexOf'], + 'getObject': [], 'iteratorTemplate': [], 'isNode': [], 'lodashWrapper': [], 'noop': [], 'overloadWrapper': ['createCallback'], + 'releaseArray': [], + 'releaseObject': [], 'shimIsPlainObject': ['forIn', 'isArguments', 'isFunction', 'isNode'], 'shimKeys': ['createIterator', 'isArguments'], 'slice': [], @@ -222,9 +226,7 @@ 'shadowedProps', 'top', 'useHas', - 'useKeys', - 'shimIsPlainObject', - 'shimKyes' + 'useKeys' ]; /** List of all methods */ @@ -309,9 +311,6 @@ 'unzip' ]; - /** List of Underscore methods */ - var underscoreMethods = _.without.apply(_, [allMethods].concat(lodashOnlyMethods)); - /** List of ways to export the `lodash` function */ var exportsAll = [ 'amd', @@ -341,15 +340,22 @@ 'createIterator', 'escapeHtmlChar', 'escapeStringChar', + 'getArray', + 'getObject', 'isNode', 'iteratorTemplate', 'lodashWrapper', 'overloadWrapper', + 'releaseArray', + 'releaseObject', 'shimIsPlainObject', 'shimKeys', 'slice', 'unescapeHtmlChar' - ] + ]; + + /** List of Underscore methods */ + var underscoreMethods = _.without.apply(_, [allMethods].concat(lodashOnlyMethods, privateMethods)); /*--------------------------------------------------------------------------*/ @@ -990,7 +996,7 @@ // match a function declaration 'function ' + funcName + '\\b[\\s\\S]+?\\n\\1}|' + // match a variable declaration with function expression - 'var ' + funcName + ' *=.*?function[\\s\\S]+?\\n\\1};' + + 'var ' + funcName + ' *=.*?function[\\s\\S]+?\\n\\1}(?:\\(\\)\\))?;' + // end non-capturing group ')\\n' ))); @@ -1051,24 +1057,30 @@ return source; } // remove data object property assignment - var modified = snippet - .replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '') - .replace(/,(?=\s*})/, ''); + var modified = snippet.replace(RegExp("^(?: *\\/\\/.*\\n)* *data\\." + identifier + " *= *(.+\\n+)", 'm'), function(match, postlude) { + return /\bdata\b/.test(postlude) ? postlude : ''; + }); source = source.replace(snippet, function() { return modified; }); - // clip at the `factory` assignment + // clip to the `factory` assignment snippet = modified.match(/Function\([\s\S]+$/)[0]; - modified = snippet - .replace(RegExp('\\b' + identifier + '\\b,? *', 'g'), '') - .replace(/, *(?=',)/, '') - .replace(/,(?=\s*\))/, '') + // remove `factory` arguments + source = source.replace(snippet, function(match) { + return match + .replace(RegExp('\\b' + identifier + '\\b,? *', 'g'), '') + .replace(/, *(?=',)/, '') + .replace(/,(?=\s*\))/, ''); + }); - source = source.replace(snippet, function() { - return modified; + // remove property assignment from `getObject` + source = source.replace(matchFunction(source, 'getObject'), function(match) { + return match + .replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '') + .replace(/,(?=\s*})/, ''); }); return source; @@ -1952,6 +1964,15 @@ dependencyMap.where.push('find', 'isEmpty'); } + _.each(['clone', 'difference', 'intersection', 'isEqual', 'sortBy', 'uniq'], function(methodName) { + if (methodName == 'clone' + ? (!useLodashMethod('clone') && !useLodashMethod('cloneDeep')) + : !useLodashMethod(methodName) + ) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'getArray', 'getObject', 'releaseArray', 'releaseObject'); + } + }); + _.each(['debounce', 'throttle'], function(methodName) { if (!useLodashMethod(methodName)) { dependencyMap[methodName] = []; @@ -1964,6 +1985,12 @@ } }); + _.each(['flatten', 'uniq'], function(methodName) { + if (!useLodashMethod(methodName)) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'overloadWrapper'); + } + }); + _.each(['max', 'min'], function(methodName) { if (!useLodashMethod(methodName)) { dependencyMap[methodName] = _.without(dependencyMap[methodName], 'charAtCallback', 'isArray', 'isString'); @@ -1973,6 +2000,12 @@ if (isModern || isUnderscore) { dependencyMap.reduceRight = _.without(dependencyMap.reduceRight, 'isString'); + _.each(['assign', 'basicEach', 'defaults', 'forIn', 'forOwn', 'shimKeys'], function(methodName) { + if (!(isUnderscore && useLodashMethod(methodName))) { + dependencyMap[methodName] = _.without(dependencyMap[methodName], 'createIterator'); + } + }); + _.each(['at', 'forEach', 'toArray'], function(methodName) { if (!(isUnderscore && useLodashMethod(methodName))) { dependencyMap[methodName] = _.without(dependencyMap[methodName], 'isString'); @@ -2644,6 +2677,32 @@ '}' ].join('\n')); } + // replace `_.sortBy` + if (!useLodashMethod('sortBy')) { + source = replaceFunction(source, 'sortBy', [ + 'function sortBy(collection, callback, thisArg) {', + ' var index = -1,', + ' length = collection ? collection.length : 0,', + " result = Array(typeof length == 'number' ? length : 0);", + '', + ' callback = lodash.createCallback(callback, thisArg);', + ' forEach(collection, function(value, key, collection) {', + ' result[++index] = {', + " 'criteria': callback(value, key, collection),", + " 'index': index,", + " 'value': value", + ' };', + ' });', + '', + ' length = result.length;', + ' result.sort(compareAscending);', + ' while (length--) {', + ' result[length] = result[length].value;', + ' }', + ' return result;', + '}' + ].join('\n')); + } // replace `_.template` if (!useLodashMethod('template')) { // remove `_.templateSettings.imports assignment @@ -2846,7 +2905,10 @@ // replace `slice` with `nativeSlice.call` _.each(['clone', 'first', 'initial', 'last', 'rest', 'toArray'], function(methodName) { - if (!useLodashMethod(methodName)) { + if (methodName == 'clone' + ? (!useLodashMethod('clone') && !useLodashMethod('cloneDeep')) + : !useLodashMethod(methodName) + ) { source = source.replace(matchFunction(source, methodName), function(match) { return match.replace(/([^.])\bslice\(/g, '$1nativeSlice.call('); }); @@ -3163,6 +3225,12 @@ source = removeVar(source, 'htmlEscapes'); source = removeVar(source, 'htmlUnescapes'); } + if (isRemoved(source, 'getArray', 'releaseArray')) { + source = removeVar(source, 'arrayPool'); + } + if (isRemoved(source, 'getObject', 'releaseObject')) { + source = removeVar(source, 'objectPool'); + } if (isRemoved(source, 'invert')) { source = replaceVar(source, 'htmlUnescapes', "{'&':'&','<':'<','>':'>','"':'\"',''':\"'\"}"); } diff --git a/build/pre-compile.js b/build/pre-compile.js index 235dde7779..e5daf834f0 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -312,11 +312,32 @@ // remove debug sourceURL use in `_.template` source = source.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, ''); - // minify internal properties used by 'compareAscending' and `_.sortBy` + // minify internal properties (function() { - var properties = ['criteria', 'index', 'value'], - snippets = source.match(/( +)function (?:compareAscending|sortBy)\b[\s\S]+?\n\1}/g); - + var methods = [ + 'compareAscending', + 'createCache', + 'difference', + 'getObject', + 'intersection', + 'releaseObject', + 'sortBy', + 'uniq' + ]; + + var props = [ + 'array', + 'cache', + 'contains', + 'criteria', + 'index', + 'indexOf', + 'initArray', + 'release', + 'value' + ]; + + var snippets = source.match(RegExp('^( +)(?:var|function) +(?:' + methods.join('|') + ')\\b[\\s\\S]+?\\n\\1}', 'gm')); if (!snippets) { return; } @@ -324,11 +345,12 @@ var modified = snippet; // minify properties - properties.forEach(function(property, index) { - var minName = minNames[index], - reBracketProp = RegExp("\\['(" + property + ")'\\]", 'g'), - reDotProp = RegExp('\\.' + property + '\\b', 'g'), - rePropColon = RegExp("([^?\\s])\\s*([\"'])?\\b" + property + "\\2 *:", 'g'); + props.forEach(function(prop, index) { + // use minified names different than those chosen for `iteratorOptions` + var minName = minNames[iteratorOptions.length + index], + reBracketProp = RegExp("\\['(" + prop + ")'\\]", 'g'), + reDotProp = RegExp('\\.' + prop + '\\b', 'g'), + rePropColon = RegExp("([^?\\s])\\s*([\"'])?\\b" + prop + "\\2 *:", 'g'); modified = modified .replace(reBracketProp, "['" + minName + "']") @@ -352,8 +374,8 @@ 'createIterator\\((?:{|[a-zA-Z]+)[\\s\\S]*?\\);\\n', // match variables storing `createIterator` options '( +)var [a-zA-Z]+IteratorOptions\\b[\\s\\S]+?\\n\\2}', - // match the the `createIterator` function - '( +)function createIterator\\b[\\s\\S]+?\\n\\3}' + // match the `createIterator`, `getObject`, and `releaseObject` functions + '( +)function (?:createIterator|getObject|releaseObject)\\b[\\s\\S]+?\\n\\3}' ].join('|'), 'g') ); @@ -363,7 +385,7 @@ } snippets.forEach(function(snippet, index) { - var isCreateIterator = /function createIterator\b/.test(snippet), + var isFunc = /^ *function +/m.test(snippet), isIteratorTemplate = /var iteratorTemplate\b/.test(snippet), modified = snippet; @@ -392,8 +414,8 @@ var minName = minNames[index]; // minify variable names present in strings - if (isCreateIterator) { - modified = modified.replace(RegExp('(([\'"])[^\\n\\2]*?)\\b' + varName + '\\b(?=[^\\n\\2]*\\2[ ,+]+$)', 'gm'), '$1' + minName); + if (isFunc) { + modified = modified.replace(RegExp('(([\'"])[^\\n\\2]*?)\\b' + varName + '\\b(?=[^\\n\\2]*\\2[ ,+;]+$)', 'gm'), '$1' + minName); } // ensure properties in compiled strings aren't minified else { diff --git a/lodash.js b/lodash.js index a918e09493..9b19a747d5 100644 --- a/lodash.js +++ b/lodash.js @@ -23,6 +23,10 @@ window = freeGlobal; } + /** Used to pool arrays and objects used internally */ + var arrayPool = [], + objectPool = []; + /** Used to generate unique IDs */ var idCounter = 0; @@ -139,6 +143,74 @@ '\u2029': 'u2029' }; + /** + * Gets an array from the array pool or creates a new one if the pool is empty. + * + * @private + * @returns {Array} The array from the pool. + */ + function getArray() { + return arrayPool.pop() || []; + } + + /** + * Gets an object from the object pool or creates a new one if the pool is empty. + * + * @private + * @returns {Object} The object from the pool. + */ + function getObject() { + return objectPool.pop() || { + 'args': null, + 'array': null, + 'arrays': null, + 'contains': null, + 'criteria': null, + 'false': null, + 'firstArg': null, + 'function': null, + 'index': null, + 'indexOf': null, + 'init': null, + 'initArray': null, + 'null': null, + 'number': null, + 'object': null, + 'push': null, + 'release': null, + 'shadowedProps': null, + 'string': null, + 'support': null, + 'true': null, + 'undefined': null, + 'useHas': null, + 'useKeys': null, + 'value': null + }; + } + + /** + * Releases the given `array` back to the array pool. + * + * @private + * @param {Array} [array] The array to release. + */ + function releaseArray(array) { + array.length = 0; + arrayPool.push(array); + } + + /** + * Releases the given `object` back to the object pool. + * + * @private + * @param {Object} [object] The object to release. + */ + function releaseObject(object) { + object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; + objectPool.push(object); + } + /*--------------------------------------------------------------------------*/ /** @@ -580,8 +652,8 @@ // iterate own properties using `Object.keys` ' <% if (useHas && useKeys) { %>\n' + ' var ownIndex = -1,\n' + - ' ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n' + - ' length = ownProps.length;\n\n' + + ' ownProps = objectTypes[typeof iterable] && keys(iterable),\n' + + ' length = ownProps ? ownProps.length : 0;\n\n' + ' while (++ownIndex < length) {\n' + ' index = ownProps[ownIndex];\n<%' + " if (conditions.length) { %> if (<%= conditions.join(' && ') %>) {\n <% } %>" + @@ -778,7 +850,6 @@ return bound; } - /** * Creates a function optimized to search large arrays for a given `value`, * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. @@ -788,42 +859,28 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - function createCache(array) { - array || (array = []); - - var bailout, - index = -1, - indexOf = getIndexOf(), - length = array.length, - isLarge = length >= largeArraySize && lodash.indexOf != indexOf, - objCache = {}; - - var caches = { - 'false': false, - 'function': false, - 'null': false, - 'number': {}, - 'object': objCache, - 'string': {}, - 'true': false, - 'undefined': false - }; + var createCache = (function() { function basicContains(value) { - return indexOf(array, value) > -1; + return this.indexOf(this.array, value) > -1; } function basicPush(value) { - array.push(value); + this.array.push(value); } function cacheContains(value) { - var type = typeof value; + var cache = this.cache, + type = typeof value; + if (type == 'boolean' || value == null) { - return caches[value]; + return cache[value]; } - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); return type == 'object' ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) @@ -831,12 +888,17 @@ } function cachePush(value) { - var type = typeof value; + var cache = this.cache, + type = typeof value; + if (type == 'boolean' || value == null) { - caches[value] = true; + cache[value] = true; } else { - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); if (type == 'object') { bailout = (cache[key] || (cache[key] = [])).push(value) == length; @@ -846,18 +908,49 @@ } } - if (isLarge) { - while (++index < length) { - cachePush(array[index]); - } - if (bailout) { - isLarge = caches = objCache = null; + function release() { + var cache = this.cache; + if (cache.initArray) { + releaseArray(this.array); } + releaseObject(cache); } - return isLarge - ? { 'contains': cacheContains, 'push': cachePush } - : { 'contains': basicContains, 'push': basicPush }; - } + + return function(array) { + var bailout, + index = -1, + initArray = !array && (array = getArray()), + length = array.length, + isLarge = length >= largeArraySize && lodash.indexOf != indexOf; + + var cache = getObject(); + cache.initArray = initArray; + cache['false'] = cache['function'] = cache['null'] = cache['true'] = cache['undefined'] = false; + + var result = getObject(); + result.array = array; + result.indexOf = getIndexOf(); + result.cache = cache; + result.contains = cacheContains; + result.push = cachePush; + result.release = release; + + if (isLarge) { + while (++index < length) { + result.push(array[index]); + } + if (bailout) { + isLarge = false; + result.release(); + } + } + if (!isLarge) { + result.contains = basicContains; + result.push = basicPush; + } + return result; + }; + }()); /** * Creates compiled iteration functions. @@ -874,20 +967,17 @@ * @returns {Function} Returns the compiled function. */ function createIterator() { - var data = { - // data properties - 'shadowedProps': shadowedProps, - 'support': support, - - // iterator options - 'arrays': '', - 'bottom': '', - 'init': 'iterable', - 'loop': '', - 'top': '', - 'useHas': true, - 'useKeys': !!keys - }; + var data = getObject(); + + // data properties + data.shadowedProps = shadowedProps; + data.support = support; + + // iterator options + data.arrays = data.bottom = data.loop = data.top = ''; + data.init = 'iterable'; + data.useHas = true; + data.useKeys = !!keys; // merge options into a template data object for (var object, index = 0; object = arguments[index]; index++) { @@ -900,16 +990,19 @@ // create the function factory var factory = Function( - 'errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, ' + - 'keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, ' + - 'stringProto, toString', + 'errorClass, errorProto, hasOwnProperty, isArguments, isArray, ' + + 'isString, keys, lodash, objectProto, objectTypes, nonEnumProps, ' + + 'stringClass, stringProto, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); + + releaseObject(data); + // return the compiled function return factory( - errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, - keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, - stringProto, toString + errorClass, errorProto, hasOwnProperty, isArguments, isArray, + isString, keys, lodash, objectProto, objectTypes, nonEnumProps, + stringClass, stringProto, toString ); } @@ -1368,8 +1461,9 @@ return ctor(result.source, reFlags.exec(result)); } // check for circular references and return corresponding clone - stackA || (stackA = []); - stackB || (stackB = []); + var initStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); var length = stackA.length; while (length--) { @@ -1399,6 +1493,10 @@ result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); }); + if (initStack) { + releaseArray(stackA); + releaseArray(stackB); + } return result; } @@ -1845,8 +1943,9 @@ // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.com/#x15.12.3) - stackA || (stackA = []); - stackB || (stackB = []); + var initStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); var length = stackA.length; while (length--) { @@ -1908,6 +2007,10 @@ } }); } + if (initStack) { + releaseArray(stackA); + releaseArray(stackB); + } return result; } @@ -2217,8 +2320,9 @@ stackA = args[4], stackB = args[5]; } else { - stackA = []; - stackB = []; + var initStack = true; + stackA = getArray(); + stackB = getArray(); // allows working with `_.reduce` and `_.reduceRight` without // using their `callback` arguments, `index|key` and `collection` @@ -2284,6 +2388,11 @@ object[key] = value; }); } + + if (initStack) { + releaseArray(stackA); + releaseArray(stackB); + } return object; } @@ -3443,17 +3552,18 @@ callback = lodash.createCallback(callback, thisArg); forEach(collection, function(value, key, collection) { - result[++index] = { - 'criteria': callback(value, key, collection), - 'index': index, - 'value': value - }; + var object = result[++index] = getObject(); + object.criteria = callback(value, key, collection); + object.index = index; + object.value = value; }); length = result.length; result.sort(compareAscending); while (length--) { - result[length] = result[length].value; + var object = result[length]; + result[length] = object.value; + releaseObject(object); } return result; } @@ -3555,15 +3665,16 @@ var index = -1, length = array ? array.length : 0, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - contains = createCache(flattened).contains, + cache = createCache(flattened), result = []; while (++index < length) { var value = array[index]; - if (!contains(value)) { + if (!cache.contains(value)) { result.push(value); } } + cache.release(); return result; } @@ -3867,27 +3978,35 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = createCache(), - caches = {}, + caches = getArray(), index = -1, length = array ? array.length : 0, isLarge = length >= largeArraySize, result = []; + caches[0] = createCache(); + outer: while (++index < length) { - var value = array[index]; + var cache = caches[0], + value = array[index]; + if (!cache.contains(value)) { var argsIndex = argsLength; cache.push(value); while (--argsIndex) { - if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) { + cache = caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex])); + if (!cache.contains(value)) { continue outer; } } result.push(value); } } + while (argsLength--) { + caches[argsLength].release(); + } + releaseArray(caches); return result; } @@ -4257,11 +4376,11 @@ */ var uniq = overloadWrapper(function(array, isSorted, callback) { var index = -1, - indexOf = getIndexOf(), length = array ? array.length : 0, isLarge = !isSorted && length >= largeArraySize, + indexOf = isLarge || getIndexOf(), result = [], - seen = isLarge ? createCache() : (callback ? [] : result); + seen = isLarge ? createCache() : (callback ? getArray() : result); while (++index < length) { var value = array[index], @@ -4277,6 +4396,11 @@ result.push(value); } } + if (isLarge) { + seen.release(); + } else if (callback) { + releaseArray(seen); + } return result; }); From 34a4876761e5bc461f770c5b7dbe98121358aa8b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 3 Jun 2013 07:59:44 -0700 Subject: [PATCH 092/117] Cleanup .travis and .ignore files. Former-commit-id: 268e1eb34f30581ed1a36236970673f389f94bb3 --- .gitignore | 3 --- .npmignore | 2 -- .travis.yml | 1 + 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 5bc084a2e5..150de05ff2 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,3 @@ node_modules vendor/closure-compiler vendor/uglifyjs -coverage/index.html -coverage/*.json -coverage/lodash/vendor diff --git a/.npmignore b/.npmignore index 8aa449cc71..c9ec59ceff 100644 --- a/.npmignore +++ b/.npmignore @@ -6,9 +6,7 @@ *.md bower.json component.json -coverage doc -Gruntfile.js perf test vendor/*.gz diff --git a/.travis.yml b/.travis.yml index 270983e87b..458651f2a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: node_js node_js: - 0.6 - 0.9 + - 0.10 env: - TEST_COMMAND="istanbul cover ./test/test.js" - TEST_COMMAND="phantomjs ./test/test.js ../dist/lodash.compat.js" From e0891a2d71bd6d5ea22f2370ba9b21fd72233fdf Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 3 Jun 2013 08:00:29 -0700 Subject: [PATCH 093/117] Clarify `lodash underscore` test name in test-build.js. Former-commit-id: 4723604102d38ea252f867aeab16ce167b1d1a49 --- test/test-build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-build.js b/test/test-build.js index d44097e0a0..59f8a67810 100644 --- a/test/test-build.js +++ b/test/test-build.js @@ -1056,7 +1056,7 @@ ]; commands.forEach(function(command, index) { - asyncTest('`lodash ' + command +'`', function() { + asyncTest('`lodash underscore ' + command +'`', function() { var start = _.after(2, _.once(QUnit.start)); build(['-s', 'underscore', command], function(data) { From 9b214d75df67bae902c623d22bfbf3d87e79ca0f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 3 Jun 2013 08:00:46 -0700 Subject: [PATCH 094/117] Update DocDown. Former-commit-id: ecb4c7428007bfb6b721000c81254a03c826b1ff --- vendor/docdown/src/DocDown/Entry.php | 52 ++++++++++++------------ vendor/docdown/src/DocDown/Generator.php | 4 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/vendor/docdown/src/DocDown/Entry.php b/vendor/docdown/src/DocDown/Entry.php index f7e96f76e2..a973d9a679 100644 --- a/vendor/docdown/src/DocDown/Entry.php +++ b/vendor/docdown/src/DocDown/Entry.php @@ -58,7 +58,7 @@ public function __construct( $entry, $source, $lang = 'js' ) { * @returns {Array} The array of entries. */ public static function getEntries( $source ) { - preg_match_all('#/\*\*(?![-!])[\s\S]*?\*/\s*[^\n]+#', $source, $result); + preg_match_all('#/\*\*(?![-!])[\s\S]*?\*/\s*.+#', $source, $result); return array_pop($result); } @@ -77,7 +77,7 @@ private function isFunction() { $this->isCtor() || count($this->getParams()) || count($this->getReturns()) || - preg_match('/\* *@function\b/', $this->entry) + preg_match('/\*[\t ]*@function\b/', $this->entry) ); } return $this->_isFunction; @@ -94,10 +94,10 @@ private function isFunction() { */ public function getAliases( $index = null ) { if (!isset($this->_aliases)) { - preg_match('#\* *@alias\s+([^\n]+)#', $this->entry, $result); + preg_match('#\*[\t ]*@alias\s+(.+)#', $this->entry, $result); if (count($result)) { - $result = trim(preg_replace('/(?:^|\n)\s*\* ?/', ' ', $result[1])); + $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1])); $result = preg_split('/,\s*/', $result); natsort($result); @@ -129,7 +129,7 @@ public function getCall() { } // resolve name // avoid $this->getName() because it calls $this->getCall() - preg_match('#\* *@name\s+([^\n]+)#', $this->entry, $name); + preg_match('#\*[\t ]*@name\s+(.+)#', $this->entry, $name); if (count($name)) { $name = trim($name[1]); } else { @@ -163,9 +163,9 @@ public function getCategory() { return $this->_category; } - preg_match('#\* *@category\s+([^\n]+)#', $this->entry, $result); + preg_match('#\*[\t ]*@category\s+(.+)#', $this->entry, $result); if (count($result)) { - $result = trim(preg_replace('/(?:^|\n)\s*\* ?/', ' ', $result[1])); + $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1])); } else { $result = $this->getType() == 'Function' ? 'Methods' : 'Properties'; } @@ -187,9 +187,9 @@ public function getDesc() { preg_match('#/\*\*(?:\s*\*)?([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result); if (count($result)) { $type = $this->getType(); - $result = preg_replace('/:\n *\* */', ":
\n", $result[1]); - $result = preg_replace('/(?:^|\n) *\*\n *\* */', "\n\n", $result); - $result = preg_replace('/(?:^|\n) *\* ?/', ' ', $result); + $result = preg_replace('/:\n[\t ]*\*[\t ]*/', ":
\n", $result[1]); + $result = preg_replace('/(?:^|\n)[\t ]*\*\n[\t ]*\*[\t ]*/', "\n\n", $result); + $result = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result); $result = trim($result); $result = ($type == 'Function' ? '' : '(' . str_replace('|', ', ', trim($type, '{}')) . '): ') . $result; } @@ -208,9 +208,9 @@ public function getExample() { return $this->_example; } - preg_match('#\* *@example\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result); + preg_match('#\*[\t ]*@example\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result); if (count($result)) { - $result = trim(preg_replace('/(?:^|\n)\s*\* ?/', "\n", $result[1])); + $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', "\n", $result[1])); $result = '```' . $this->lang . "\n" . $result . "\n```"; } $this->_example = $result; @@ -235,7 +235,7 @@ public function isAlias() { */ public function isCtor() { if (!isset($this->_isCtor)) { - $this->_isCtor = !!preg_match('/\* *@constructor\b/', $this->entry); + $this->_isCtor = !!preg_match('/\*[\t ]*@constructor\b/', $this->entry); } return $this->_isCtor; } @@ -248,7 +248,7 @@ public function isCtor() { */ public function isLicense() { if (!isset($this->_isLicense)) { - $this->_isLicense = !!preg_match('/\* *@license\b/', $this->entry); + $this->_isLicense = !!preg_match('/\*[\t ]*@license\b/', $this->entry); } return $this->_isLicense; } @@ -274,7 +274,7 @@ public function isPlugin() { */ public function isPrivate() { if (!isset($this->_isPrivate)) { - $this->_isPrivate = $this->isLicense() || !!preg_match('/\* *@private\b/', $this->entry) || !preg_match('/\* *@[a-z]+\b/', $this->entry); + $this->_isPrivate = $this->isLicense() || !!preg_match('/\*[\t ]*@private\b/', $this->entry) || !preg_match('/\*[\t ]*@[a-z]+\b/', $this->entry); } return $this->_isPrivate; } @@ -291,7 +291,7 @@ public function isStatic() { } $public = !$this->isPrivate(); - $result = $public && !!preg_match('/\* *@static\b/', $this->entry); + $result = $public && !!preg_match('/\*[\t ]*@static\b/', $this->entry); // set in cases where it isn't explicitly stated if ($public && !$result) { @@ -334,9 +334,9 @@ public function getLineNumber() { */ public function getMembers( $index = null ) { if (!isset($this->_members)) { - preg_match('#\* *@member(?:Of)?\s+([^\n]+)#', $this->entry, $result); + preg_match('#\*[\t ]*@member(?:Of)?\s+(.+)#', $this->entry, $result); if (count($result)) { - $result = trim(preg_replace('/(?:^|\n)\s*\* ?/', ' ', $result[1])); + $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1])); $result = preg_split('/,\s*/', $result); natsort($result); } @@ -358,9 +358,9 @@ public function getName() { return $this->_name; } - preg_match('#\* *@name\s+([^\n]+)#', $this->entry, $result); + preg_match('#\*[\t ]*@name\s+(.+)#', $this->entry, $result); if (count($result)) { - $result = trim(preg_replace('/(?:^|\n)\s*\* ?/', ' ', $result[1])); + $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1])); } else { $result = array_shift(explode('(', $this->getCall())); } @@ -377,7 +377,7 @@ public function getName() { */ public function getParams( $index = null ) { if (!isset($this->_params)) { - preg_match_all('#\* *@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w|]+(?:\[.+\])?)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result); + preg_match_all('#\*[\t ]*@param\s+\{([^}]+)\}\s+(\[.+\]|[$\w|]+(?:\[.+\])?)\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#i', $this->entry, $result); if (count($result = array_filter(array_slice($result, 1)))) { // repurpose array foreach ($result as $param) { @@ -385,7 +385,7 @@ public function getParams( $index = null ) { if (!is_array($result[0][$key])) { $result[0][$key] = array(); } - $result[0][$key][] = trim(preg_replace('/(?:^|\n)\s*\* */', ' ', $value)); + $result[0][$key][] = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]*/', ' ', $value)); } } $result = $result[0]; @@ -408,11 +408,11 @@ public function getReturns() { return $this->_returns; } - preg_match('#\* *@returns\s+\{([^}]+)\}\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result); + preg_match('#\*[\t ]*@returns\s+\{([^}]+)\}\s+([\s\S]*?)(?=\*\s\@[a-z]|\*/)#', $this->entry, $result); if (count($result)) { $result = array_map('trim', array_slice($result, 1)); $result[0] = str_replace('|', ', ', $result[0]); - $result[1] = preg_replace('/(?:^|\n)\s*\* ?/', ' ', $result[1]); + $result[1] = preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1]); } $this->_returns = $result; return $result; @@ -429,9 +429,9 @@ public function getType() { return $this->_type; } - preg_match('#\* *@type\s+([^\n]+)#', $this->entry, $result); + preg_match('#\*[\t ]*@type\s+(.+)#', $this->entry, $result); if (count($result)) { - $result = trim(preg_replace('/(?:^|\n)\s*\* ?/', ' ', $result[1])); + $result = trim(preg_replace('/(?:^|\n)[\t ]*\*[\t ]?/', ' ', $result[1])); } else { $result = $this->isFunction() ? 'Function' : 'Unknown'; } diff --git a/vendor/docdown/src/DocDown/Generator.php b/vendor/docdown/src/DocDown/Generator.php index 285a925282..5dc2583f8b 100644 --- a/vendor/docdown/src/DocDown/Generator.php +++ b/vendor/docdown/src/DocDown/Generator.php @@ -121,7 +121,7 @@ private static function format( $string ) { $string = preg_replace('/(^|\s)(\([^)]+\))/', '$1*$2*', $string); // mark numbers as inline code - $string = preg_replace('/ (-?\d+(?:.\d+)?)(?!\.[^\n])/', ' `$1`', $string); + $string = preg_replace('/[\t ](-?\d+(?:.\d+)?)(?!\.[^\n])/', ' `$1`', $string); // detokenize inline code snippets $counter = 0; @@ -557,7 +557,7 @@ function sortCompare($a, $b) { array_push($result, $closeTag, $closeTag, '', ' [1]: #' . $toc . ' "Jump back to the TOC."'); // cleanup whitespace - return trim(preg_replace('/ +\n/', "\n", join($result, "\n"))); + return trim(preg_replace('/[\t ]+\n/', "\n", join($result, "\n"))); } } ?> From 819f4d2151dea49f2e58eb0320d4ad16f58f579a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 3 Jun 2013 08:43:04 -0700 Subject: [PATCH 095/117] Add `maxPoolSize` to limit array and object pools. Former-commit-id: 677cdb053c7ef60274d71d9ecf4d6f866ef6a8eb --- build.js | 3 +++ lodash.js | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/build.js b/build.js index a6578fe868..47828d6eb1 100755 --- a/build.js +++ b/build.js @@ -3231,6 +3231,9 @@ if (isRemoved(source, 'getObject', 'releaseObject')) { source = removeVar(source, 'objectPool'); } + if (isRemoved(source, 'releaseArray', 'releaseObject')) { + source = removeVar(source, 'maxPoolSize'); + } if (isRemoved(source, 'invert')) { source = replaceVar(source, 'htmlUnescapes', "{'&':'&','<':'<','>':'>','"':'\"',''':\"'\"}"); } diff --git a/lodash.js b/lodash.js index 9b19a747d5..2cf26a5eb9 100644 --- a/lodash.js +++ b/lodash.js @@ -39,6 +39,9 @@ /** Used as the size when optimizations are enabled for large arrays */ var largeArraySize = 75; + /** Used as the max size of the `arrayPool` and `objectPool` */ + var maxPoolSize = 10; + /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, @@ -196,6 +199,9 @@ * @param {Array} [array] The array to release. */ function releaseArray(array) { + if (arrayPool.length == maxPoolSize) { + arrayPool.length = maxPoolSize - 1; + } array.length = 0; arrayPool.push(array); } @@ -207,6 +213,9 @@ * @param {Object} [object] The object to release. */ function releaseObject(object) { + if (objectPool.length == maxPoolSize) { + objectPool.length = maxPoolSize - 1; + } object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; objectPool.push(object); } From 658d14f31d197996a7c9be86e36f25326af61859 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 4 Jun 2013 08:36:45 -0700 Subject: [PATCH 096/117] Cleanup var names and properties. Former-commit-id: a3455f40184b61a7abe3f5749ea1c0a141c0e574 --- build.js | 30 +++++++++++++++++++++++------- build/pre-compile.js | 2 +- lodash.js | 37 ++++++++++++++++++++----------------- 3 files changed, 44 insertions(+), 25 deletions(-) diff --git a/build.js b/build.js index 47828d6eb1..74c6b5e0ad 100755 --- a/build.js +++ b/build.js @@ -224,6 +224,7 @@ 'init', 'loop', 'shadowedProps', + 'support', 'top', 'useHas', 'useKeys' @@ -1044,7 +1045,7 @@ } /** - * Removes the all references to `varName` from `createIterator` in `source`. + * Removes all references to `identifier` from `createIterator` in `source`. * * @private * @param {String} source The source to process. @@ -1076,14 +1077,23 @@ .replace(/,(?=\s*\))/, ''); }); - // remove property assignment from `getObject` - source = source.replace(matchFunction(source, 'getObject'), function(match) { + return removeFromGetObject(source, identifier); + } + + /** + * Removes all references to `identifier` from `getObject` in `source`. + * + * @private + * @param {String} source The source to process. + * @param {String} identifier The name of the property to remove. + * @returns {String} Returns the modified source. + */ + function removeFromGetObject(source, identifier) { + return source.replace(matchFunction(source, 'getObject'), function(match) { return match .replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '') .replace(/,(?=\s*})/, ''); }); - - return source; } /** @@ -3014,6 +3024,10 @@ if (isModern || isUnderscore) { source = removeFunction(source, 'createIterator'); + iteratorOptions.forEach(function(prop) { + source = removeFromGetObject(source, prop); + }); + // inline all functions defined with `createIterator` _.functions(lodash).forEach(function(methodName) { // strip leading underscores to match pseudo private functions @@ -3120,8 +3134,10 @@ // prepend data object references to property names to avoid having to // use a with-statement - iteratorOptions.forEach(function(property) { - snippet = snippet.replace(RegExp('([^\\w.])\\b' + property + '\\b', 'g'), '$1obj.' + property); + iteratorOptions.forEach(function(prop) { + if (prop !== 'support') { + snippet = snippet.replace(RegExp('([^\\w.])\\b' + prop + '\\b', 'g'), '$1obj.' + prop); + } }); // remove unnecessary code diff --git a/build/pre-compile.js b/build/pre-compile.js index e5daf834f0..e4bc7e5215 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -332,7 +332,7 @@ 'criteria', 'index', 'indexOf', - 'initArray', + 'initedArray', 'release', 'value' ]; diff --git a/lodash.js b/lodash.js index 2cf26a5eb9..881d33cf4c 100644 --- a/lodash.js +++ b/lodash.js @@ -167,6 +167,7 @@ 'args': null, 'array': null, 'arrays': null, + 'bottom': null, 'contains': null, 'criteria': null, 'false': null, @@ -175,7 +176,8 @@ 'index': null, 'indexOf': null, 'init': null, - 'initArray': null, + 'initedArray': null, + 'loop': null, 'null': null, 'number': null, 'object': null, @@ -184,6 +186,7 @@ 'shadowedProps': null, 'string': null, 'support': null, + 'top': null, 'true': null, 'undefined': null, 'useHas': null, @@ -919,7 +922,7 @@ function release() { var cache = this.cache; - if (cache.initArray) { + if (cache.initedArray) { releaseArray(this.array); } releaseObject(cache); @@ -928,19 +931,20 @@ return function(array) { var bailout, index = -1, - initArray = !array && (array = getArray()), + indexOf = getIndexOf(), + initedArray = !array && (array = getArray()), length = array.length, - isLarge = length >= largeArraySize && lodash.indexOf != indexOf; + isLarge = length >= largeArraySize && lodash.indexOf !== indexOf; var cache = getObject(); - cache.initArray = initArray; + cache.initedArray = initedArray; cache['false'] = cache['function'] = cache['null'] = cache['true'] = cache['undefined'] = false; var result = getObject(); result.array = array; - result.indexOf = getIndexOf(); result.cache = cache; result.contains = cacheContains; + result.indexOf = indexOf; result.push = cachePush; result.release = release; @@ -1069,7 +1073,7 @@ * @returns {Function} Returns the "indexOf" function. */ function getIndexOf(array, value, fromIndex) { - var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result; + var result = (result = lodash.indexOf) === indexOf ? basicIndexOf : result; return result; } @@ -1470,7 +1474,7 @@ return ctor(result.source, reFlags.exec(result)); } // check for circular references and return corresponding clone - var initStack = !stackA; + var initedStack = !stackA; stackA || (stackA = getArray()); stackB || (stackB = getArray()); @@ -1502,7 +1506,7 @@ result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); }); - if (initStack) { + if (initedStack) { releaseArray(stackA); releaseArray(stackB); } @@ -1952,7 +1956,7 @@ // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.com/#x15.12.3) - var initStack = !stackA; + var initedStack = !stackA; stackA || (stackA = getArray()); stackB || (stackB = getArray()); @@ -2016,7 +2020,7 @@ } }); } - if (initStack) { + if (initedStack) { releaseArray(stackA); releaseArray(stackB); } @@ -2329,7 +2333,7 @@ stackA = args[4], stackB = args[5]; } else { - var initStack = true; + var initedStack = true; stackA = getArray(); stackB = getArray(); @@ -2398,7 +2402,7 @@ }); } - if (initStack) { + if (initedStack) { releaseArray(stackA); releaseArray(stackB); } @@ -3987,12 +3991,11 @@ function intersection(array) { var args = arguments, argsLength = args.length, - caches = getArray(), index = -1, length = array ? array.length : 0, - isLarge = length >= largeArraySize, result = []; + var caches = getArray(); caches[0] = createCache(); outer: @@ -4385,9 +4388,9 @@ */ var uniq = overloadWrapper(function(array, isSorted, callback) { var index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = !isSorted && length >= largeArraySize, - indexOf = isLarge || getIndexOf(), + isLarge = !isSorted && length >= largeArraySize && lodash.indexOf !== indexOf, result = [], seen = isLarge ? createCache() : (callback ? getArray() : result); From 2c59dcd9296232ddac8b72cb0dbbfd27a2c631f5 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 4 Jun 2013 08:37:12 -0700 Subject: [PATCH 097/117] Rebuild docs and files. Former-commit-id: 94d3e29ccf0ba47599a9d662e5d4068713009c9b --- dist/lodash.compat.js | 298 +++++++++++++++++++++++++--------- dist/lodash.compat.min.js | 87 +++++----- dist/lodash.js | 262 ++++++++++++++++++++++-------- dist/lodash.min.js | 78 ++++----- dist/lodash.underscore.js | 117 +------------ dist/lodash.underscore.min.js | 32 ++-- doc/README.md | 250 ++++++++++++++-------------- 7 files changed, 637 insertions(+), 487 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index e6948585e8..3f39222de1 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -24,6 +24,10 @@ window = freeGlobal; } + /** Used to pool arrays and objects used internally */ + var arrayPool = [], + objectPool = []; + /** Used to generate unique IDs */ var idCounter = 0; @@ -36,6 +40,9 @@ /** Used as the size when optimizations are enabled for large arrays */ var largeArraySize = 75; + /** Used as the max size of the `arrayPool` and `objectPool` */ + var maxPoolSize = 10; + /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, @@ -140,6 +147,82 @@ '\u2029': 'u2029' }; + /** + * Gets an array from the array pool or creates a new one if the pool is empty. + * + * @private + * @returns {Array} The array from the pool. + */ + function getArray() { + return arrayPool.pop() || []; + } + + /** + * Gets an object from the object pool or creates a new one if the pool is empty. + * + * @private + * @returns {Object} The object from the pool. + */ + function getObject() { + return objectPool.pop() || { + 'args': null, + 'array': null, + 'arrays': null, + 'bottom': null, + 'contains': null, + 'criteria': null, + 'false': null, + 'firstArg': null, + 'function': null, + 'index': null, + 'indexOf': null, + 'init': null, + 'initedArray': null, + 'loop': null, + 'null': null, + 'number': null, + 'object': null, + 'push': null, + 'release': null, + 'shadowedProps': null, + 'string': null, + 'top': null, + 'true': null, + 'undefined': null, + 'useHas': null, + 'useKeys': null, + 'value': null + }; + } + + /** + * Releases the given `array` back to the array pool. + * + * @private + * @param {Array} [array] The array to release. + */ + function releaseArray(array) { + if (arrayPool.length == maxPoolSize) { + arrayPool.length = maxPoolSize - 1; + } + array.length = 0; + arrayPool.push(array); + } + + /** + * Releases the given `object` back to the object pool. + * + * @private + * @param {Object} [object] The object to release. + */ + function releaseObject(object) { + if (objectPool.length == maxPoolSize) { + objectPool.length = maxPoolSize - 1; + } + object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; + objectPool.push(object); + } + /*--------------------------------------------------------------------------*/ /** @@ -556,7 +639,7 @@ var conditions = []; if (support.enumPrototypes) { conditions.push('!(skipProto && index == "prototype")'); } if (support.enumErrorProps) { conditions.push('!(skipErrorProps && (index == "message" || index == "name"))'); } if (obj.useHas && obj.useKeys) { - __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] ? keys(iterable) : [],\n length = ownProps.length;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n'; + __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n'; if (conditions.length) { __p += ' if (' + (conditions.join(' && ')) + @@ -771,42 +854,28 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - function createCache(array) { - array || (array = []); - - var bailout, - index = -1, - indexOf = getIndexOf(), - length = array.length, - isLarge = length >= largeArraySize && lodash.indexOf != indexOf, - objCache = {}; - - var caches = { - 'false': false, - 'function': false, - 'null': false, - 'number': {}, - 'object': objCache, - 'string': {}, - 'true': false, - 'undefined': false - }; + var createCache = (function() { function basicContains(value) { - return indexOf(array, value) > -1; + return this.indexOf(this.array, value) > -1; } function basicPush(value) { - array.push(value); + this.array.push(value); } function cacheContains(value) { - var type = typeof value; + var cache = this.cache, + type = typeof value; + if (type == 'boolean' || value == null) { - return caches[value]; + return cache[value]; + } + if (type != 'number' && type != 'string') { + type = 'object'; } - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); return type == 'object' ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) @@ -814,12 +883,17 @@ } function cachePush(value) { - var type = typeof value; + var cache = this.cache, + type = typeof value; + if (type == 'boolean' || value == null) { - caches[value] = true; + cache[value] = true; } else { - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); if (type == 'object') { bailout = (cache[key] || (cache[key] = [])).push(value) == length; @@ -829,18 +903,50 @@ } } - if (isLarge) { - while (++index < length) { - cachePush(array[index]); - } - if (bailout) { - isLarge = caches = objCache = null; + function release() { + var cache = this.cache; + if (cache.initedArray) { + releaseArray(this.array); } + releaseObject(cache); } - return isLarge - ? { 'contains': cacheContains, 'push': cachePush } - : { 'contains': basicContains, 'push': basicPush }; - } + + return function(array) { + var bailout, + index = -1, + indexOf = getIndexOf(), + initedArray = !array && (array = getArray()), + length = array.length, + isLarge = length >= largeArraySize && lodash.indexOf !== indexOf; + + var cache = getObject(); + cache.initedArray = initedArray; + cache['false'] = cache['function'] = cache['null'] = cache['true'] = cache['undefined'] = false; + + var result = getObject(); + result.array = array; + result.cache = cache; + result.contains = cacheContains; + result.indexOf = indexOf; + result.push = cachePush; + result.release = release; + + if (isLarge) { + while (++index < length) { + result.push(array[index]); + } + if (bailout) { + isLarge = false; + result.release(); + } + } + if (!isLarge) { + result.contains = basicContains; + result.push = basicPush; + } + return result; + }; + }()); /** * Creates compiled iteration functions. @@ -857,18 +963,15 @@ * @returns {Function} Returns the compiled function. */ function createIterator() { - var data = { - // data properties - 'shadowedProps': shadowedProps, - // iterator options - 'arrays': '', - 'bottom': '', - 'init': 'iterable', - 'loop': '', - 'top': '', - 'useHas': true, - 'useKeys': !!keys - }; + var data = getObject(); + + // data properties + data.shadowedProps = shadowedProps; + // iterator options + data.arrays = data.bottom = data.loop = data.top = ''; + data.init = 'iterable'; + data.useHas = true; + data.useKeys = !!keys; // merge options into a template data object for (var object, index = 0; object = arguments[index]; index++) { @@ -881,16 +984,19 @@ // create the function factory var factory = Function( - 'errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, ' + - 'keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, ' + - 'stringProto, toString', + 'errorClass, errorProto, hasOwnProperty, isArguments, isArray, ' + + 'isString, keys, lodash, objectProto, objectTypes, nonEnumProps, ' + + 'stringClass, stringProto, toString', 'return function(' + args + ') {\n' + iteratorTemplate(data) + '\n}' ); + + releaseObject(data); + // return the compiled function return factory( - errorClass, errorProto, hasOwnProperty, isArguments, isArray, isString, - keys, lodash, objectProto, objectTypes, nonEnumProps, stringClass, - stringProto, toString + errorClass, errorProto, hasOwnProperty, isArguments, isArray, + isString, keys, lodash, objectProto, objectTypes, nonEnumProps, + stringClass, stringProto, toString ); } @@ -948,7 +1054,7 @@ * @returns {Function} Returns the "indexOf" function. */ function getIndexOf(array, value, fromIndex) { - var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result; + var result = (result = lodash.indexOf) === indexOf ? basicIndexOf : result; return result; } @@ -1349,8 +1455,9 @@ return ctor(result.source, reFlags.exec(result)); } // check for circular references and return corresponding clone - stackA || (stackA = []); - stackB || (stackB = []); + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); var length = stackA.length; while (length--) { @@ -1380,6 +1487,10 @@ result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); }); + if (initedStack) { + releaseArray(stackA); + releaseArray(stackB); + } return result; } @@ -1826,8 +1937,9 @@ // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.com/#x15.12.3) - stackA || (stackA = []); - stackB || (stackB = []); + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); var length = stackA.length; while (length--) { @@ -1889,6 +2001,10 @@ } }); } + if (initedStack) { + releaseArray(stackA); + releaseArray(stackB); + } return result; } @@ -2198,8 +2314,9 @@ stackA = args[4], stackB = args[5]; } else { - stackA = []; - stackB = []; + var initedStack = true; + stackA = getArray(); + stackB = getArray(); // allows working with `_.reduce` and `_.reduceRight` without // using their `callback` arguments, `index|key` and `collection` @@ -2265,6 +2382,11 @@ object[key] = value; }); } + + if (initedStack) { + releaseArray(stackA); + releaseArray(stackB); + } return object; } @@ -3424,17 +3546,18 @@ callback = lodash.createCallback(callback, thisArg); forEach(collection, function(value, key, collection) { - result[++index] = { - 'criteria': callback(value, key, collection), - 'index': index, - 'value': value - }; + var object = result[++index] = getObject(); + object.criteria = callback(value, key, collection); + object.index = index; + object.value = value; }); length = result.length; result.sort(compareAscending); while (length--) { - result[length] = result[length].value; + var object = result[length]; + result[length] = object.value; + releaseObject(object); } return result; } @@ -3536,15 +3659,16 @@ var index = -1, length = array ? array.length : 0, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - contains = createCache(flattened).contains, + cache = createCache(flattened), result = []; while (++index < length) { var value = array[index]; - if (!contains(value)) { + if (!cache.contains(value)) { result.push(value); } } + cache.release(); return result; } @@ -3848,27 +3972,34 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = createCache(), - caches = {}, index = -1, length = array ? array.length : 0, - isLarge = length >= largeArraySize, result = []; + var caches = getArray(); + caches[0] = createCache(); + outer: while (++index < length) { - var value = array[index]; + var cache = caches[0], + value = array[index]; + if (!cache.contains(value)) { var argsIndex = argsLength; cache.push(value); while (--argsIndex) { - if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) { + cache = caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex])); + if (!cache.contains(value)) { continue outer; } } result.push(value); } } + while (argsLength--) { + caches[argsLength].release(); + } + releaseArray(caches); return result; } @@ -4240,9 +4371,9 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = !isSorted && length >= largeArraySize, + isLarge = !isSorted && length >= largeArraySize && lodash.indexOf !== indexOf, result = [], - seen = isLarge ? createCache() : (callback ? [] : result); + seen = isLarge ? createCache() : (callback ? getArray() : result); while (++index < length) { var value = array[index], @@ -4258,6 +4389,11 @@ result.push(value); } } + if (isLarge) { + seen.release(); + } else if (callback) { + releaseArray(seen); + } return result; }); diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 2248ebd73e..c6a7d5f263 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,46 +4,47 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(e){function a(n){return n&&typeof n=="object"&&!Ar(n)&&ur.call(n,"__wrapped__")?n:new X(n)}function T(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(n=l&&a.indexOf!=f,g={},v={"false":!1,"function":!1,"null":!1,number:{},object:g,string:{},"true":!1,undefined:!1}; -if(s){for(;++ik;k++)e+="m='"+t.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",t.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+t.f+"}"; -e+="}"}return(t.b||xr.nonEnumArgs)&&(e+="}"),e+=t.c+";return C",n("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}")(I,Ut,ur,et,Ar,pt,Br,a,Vt,q,kr,F,Wt,lr)}function M(n){return lt(n)?pr(n):{}}function U(n){return Pr[n]}function V(n){return"\\"+D[n]}function W(){var n=(n=a.indexOf)==Ot?T:n;return n}function Q(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function X(n){this.__wrapped__=n}function Y(){}function Z(n){return function(t,e,u,o){return typeof e!="boolean"&&null!=e&&(o=u,u=o&&o[e]===t?r:e,e=!1),null!=u&&(u=a.createCallback(u,o)),n(t,e,u,o) -}}function nt(n){var t,e;return!n||lr.call(n)!=P||(t=n.constructor,ct(t)&&!(t instanceof t))||!xr.argsClass&&et(n)||!xr.nodeClass&&Q(n)?!1:xr.ownLast?(qr(n,function(n,t,r){return e=ur.call(r,t),!1}),false!==e):(qr(n,function(n,t){e=t}),e===r||ur.call(n,e))}function tt(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=$t(0>r?0:r);++er?yr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(pt(n)?n.indexOf(t,r):u(n,t,r)):Nr(n,function(n){return++eu&&(u=i)}}else t=!t&&pt(n)?L:a.createCallback(t,r),Nr(n,function(n,r,a){r=t(n,r,a),r>e&&(e=r,u=n)});return u}function Ct(n,t,r,e){var u=3>arguments.length;if(t=a.createCallback(t,e,4),Ar(n)){var o=-1,i=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var c=Br(n),o=c.length;else xr.unindexedChars&&pt(n)&&(u=n.split(""));return t=a.createCallback(t,e,4),dt(n,function(n,e,a){e=c?c[--o]:--o,r=i?(i=!1,u[e]):t(r,u[e],e,a)}),r}function wt(n,t,r){var e;if(t=a.createCallback(t,r),Ar(n)){r=-1;for(var u=n.length;++rr?yr(0,e+r):r||0}else if(r)return r=St(n,t),n[r]===t?r:-1;return n?T(n,t,r):-1}function Et(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=a.createCallback(t,r);++u>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:y,variable:"",imports:{_:a}};var Or={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},zr=ot(Pr),Fr=K(Or,{h:Or.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),$r=K(Or),qr=K(Er,Sr,{i:!1}),Dr=K(Er,Sr); -ct(/x/)&&(ct=function(n){return typeof n=="function"&&lr.call(n)==B});var Rr=er?function(n){if(!n||lr.call(n)!=P||!xr.argsClass&&et(n))return!1;var t=n.valueOf,r=typeof t=="function"&&(r=er(t))&&er(r);return r?n==r||er(n)==r:nt(n)}:nt,Tr=bt,Lr=Z(function Jr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e=l,i=[],c=o?J():r?[]:i;++en?t():function(){return 1>--n?t.apply(this,arguments):void 0}},a.assign=Fr,a.at=function(n){var t=-1,r=nr.apply(Mt,_r.call(arguments,1)),e=r.length,u=$t(e);for(xr.unindexedChars&&pt(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),c=cr(e,t),a}},a.defaults=$r,a.defer=Nt,a.delay=function(n,t){var e=_r.call(arguments,2);return cr(function(){n.apply(r,e)},t)},a.difference=kt,a.filter=yt,a.flatten=Lr,a.forEach=dt,a.forIn=qr,a.forOwn=Dr,a.functions=at,a.groupBy=function(n,t,r){var e={};return t=a.createCallback(t,r),dt(n,function(n,r,u){r=Jt(t(n,r,u)),(ur.call(e,r)?e[r]:e[r]=[]).push(n) -}),e},a.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=null==t||r?1:t||e;return tt(n,0,mr(yr(0,u-e),u))},a.intersection=function(n){var t=arguments,r=t.length,e=J(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ae(i,r))&&(o[r]=n)}),o},a.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},a.pairs=function(n){for(var t=-1,r=Br(n),e=r.length,u=$t(e);++tr?yr(0,e+r):mr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},a.mixin=zt,a.noConflict=function(){return e._=Qt,this},a.parseInt=Hr,a.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=br();return n%1||t%1?n+mr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+tr(r*(t-n+1))},a.reduce=Ct,a.reduceRight=jt,a.result=function(n,t){var e=n?n[t]:r;return ct(e)?n[t]():e},a.runInContext=t,a.size=function(n){var t=n?n.length:0; -return typeof t=="number"?t:Br(n).length},a.some=wt,a.sortedIndex=St,a.template=function(n,t,e){var u=a.templateSettings;n||(n=""),e=$r({},e,u);var o,i=$r({},e.imports,u.imports),u=Br(i),i=gt(i),c=0,l=e.interpolate||_,g="__p+='",l=Ht((e.escape||_).source+"|"+l.source+"|"+(l===y?v:_).source+"|"+(e.evaluate||_).source+"|$","g");n.replace(l,function(t,r,e,u,a,i){return e||(e=u),g+=n.slice(c,i).replace(j,V),r&&(g+="'+__e("+r+")+'"),a&&(o=!0,g+="';"+a+";__p+='"),e&&(g+="'+((__t=("+e+"))==null?'':__t)+'"),c=i+t.length,t -}),g+="';\n",l=e=e.variable,l||(e="obj",g="with("+e+"){"+g+"}"),g=(o?g.replace(f,""):g).replace(p,"$1").replace(s,"$1;"),g="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+g+"return __p}";try{var h=Rt(u,"return "+g).apply(r,i)}catch(m){throw m.source=g,m}return t?h(t):(h.source=g,h)},a.unescape=function(n){return null==n?"":Jt(n).replace(g,rt)},a.uniqueId=function(n){var t=++o;return Jt(null==n?"":n)+t -},a.all=ht,a.any=wt,a.detect=mt,a.findWhere=mt,a.foldl=Ct,a.foldr=jt,a.include=vt,a.inject=Ct,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(){var t=[this.__wrapped__];return ar.apply(t,arguments),n.apply(a,t)})}),a.first=xt,a.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=u;for(t=a.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return tt(n,yr(0,u-e))}},a.take=xt,a.head=xt,Dr(a,function(n,t){a.prototype[t]||(a.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r); -return null==t||r&&typeof t!="function"?e:new X(e)})}),a.VERSION="1.2.1",a.prototype.toString=function(){return Jt(this.__wrapped__)},a.prototype.value=Ft,a.prototype.valueOf=Ft,Nr(["join","pop","shift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Nr(["push","reverse","sort","unshift"],function(n){var t=Mt[n];a.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Nr(["concat","slice","splice"],function(n){var t=Mt[n];a.prototype[n]=function(){return new X(t.apply(this.__wrapped__,arguments)) -}}),xr.spliceObjects||Nr(["pop","shift","splice"],function(n){var t=Mt[n],r="splice"==n;a.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new X(e):e}}),a}var r,e=typeof exports=="object"&&exports,u=typeof module=="object"&&module&&module.exports==e&&module,a=typeof global=="object"&&global;(a.global===a||a.window===a)&&(n=a);var o=0,i={},c=+new Date+"",l=75,f=/\b__p\+='';/g,p=/\b(__p\+=)''\+/g,s=/(__e\(.*?\)|\b__t\))\+'';/g,g=/&(?:amp|lt|gt|quot|#39);/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,h=/\w*$/,y=/<%=([\s\S]+?)%>/g,m=(m=/\bthis\b/)&&m.test(t)&&m,d=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",b=RegExp("^["+d+"]*0+(?=.$)"),_=/($^)/,C=/[&<>"']/g,j=/['\n\r\t\u2028\u2029\\]/g,w="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),x="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),O="[object Arguments]",E="[object Array]",S="[object Boolean]",A="[object Date]",I="[object Error]",B="[object Function]",N="[object Number]",P="[object Object]",z="[object RegExp]",F="[object String]",$={}; -$[B]=!1,$[O]=$[E]=$[S]=$[A]=$[N]=$[P]=$[z]=$[F]=!0;var q={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},R=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=R, define(function(){return R})):e&&!e.nodeType?u?(u.exports=R)._=R:e._=R:n._=R}(this); \ No newline at end of file +;!function(n){function t(){return g.pop()||[]}function r(){return h.pop()||{a:l,k:l,b:l,c:l,m:l,n:l,"false":l,d:l,"function":l,o:l,p:l,e:l,q:l,f:l,"null":l,number:l,object:l,push:l,r:l,g:l,string:l,h:l,"true":l,undefined:l,i:l,j:l,s:l}}function e(n){g.length==b&&(g.length=b-1),n.length=0,g.push(n)}function u(n){h.length==b&&(h.length=b-1),n.k=n.l=n.n=n.object=n.t=n.u=n.s=l,h.push(n)}function o(f){function s(n){return n&&typeof n=="object"&&!Fr(n)&&fr.call(n,"__wrapped__")?n:new et(n)}function g(n,t,r){r=(r||0)-1; +for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nk;k++)o+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(o+="||(!v[m]&&r[m]!==y[m])"),o+="){"+n.f+"}"; +o+="}"}return(n.b||Br.nonEnumArgs)&&(o+="}"),o+=n.c+";return C",t=t("i,j,l,n,o,q,t,u,y,z,w,G,H,J",e+o+"}"),u(n),t(T,Zt,fr,ct,Fr,yt,Dr,s,nr,U,Ir,K,tr,vr)}function Y(n){return vt(n)?yr(n):{}}function Z(n){return Tr[n]}function nt(n){return"\\"+V[n]}function tt(){var n=(n=s.indexOf)===Nt?g:n;return n}function rt(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function et(n){this.__wrapped__=n}function ut(){}function ot(n){return function(t,r,e,u){return typeof r!="boolean"&&r!=l&&(u=e,e=u&&u[r]===t?a:r,r=c),e!=l&&(e=s.createCallback(e,u)),n(t,r,e,u) +}}function at(n){var t,r;return!n||vr.call(n)!=H||(t=n.constructor,ht(t)&&!(t instanceof t))||!Br.argsClass&&ct(n)||!Br.nodeClass&&rt(n)?c:Br.ownLast?(Jr(n,function(n,t,e){return r=fr.call(e,t),c}),r!==false):(Jr(n,function(n,t){r=t}),r===a||fr.call(n,r))}function it(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Gt(0>r?0:r);++er?jr(0,o+r):r)||0,o&&typeof o=="number"?a=-1<(yt(n)?n.indexOf(t,r):u(n,t,r)):Rr(n,function(n){return++eu&&(u=a)}}else t=!t&&yt(n)?h:s.createCallback(t,r),Rr(n,function(n,r,o){r=t(n,r,o),r>e&&(e=r,u=n)});return u}function Et(n,t,r,e){var u=3>arguments.length;if(t=s.createCallback(t,e,4),Fr(n)){var o=-1,a=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var i=Dr(n),o=i.length;else Br.unindexedChars&&yt(n)&&(u=n.split(""));return t=s.createCallback(t,e,4),wt(n,function(n,e,l){e=i?i[--o]:--o,r=a?(a=c,u[e]):t(r,u[e],e,l)}),r}function At(n,t,r){var e;if(t=s.createCallback(t,r),Fr(n)){r=-1;for(var u=n.length;++rr?jr(0,e+r):r||0}else if(r)return r=qt(n,t),n[r]===t?r:-1;return n?g(n,t,r):-1}function Pt(n,t,r){if(typeof t!="number"&&t!=l){var e=0,u=-1,o=n?n.length:0;for(t=s.createCallback(t,r);++u>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:E,variable:"",imports:{_:s}}; +var Nr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b=d&&s.p!==i,v=r();if(v.q=l,v["false"]=v["function"]=v["null"]=v["true"]=v.undefined=c,l=r(),l.k=e,l.l=v,l.m=a,l.p=i,l.push=f,l.r=p,h)for(;++u":">",'"':""","'":"'"},Lr=st(Tr),Gr=X(Nr,{h:Nr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Hr=X(Nr),Jr=X(Pr,qr,{i:c}),Kr=X(Pr,qr); +ht(/x/)&&(ht=function(n){return typeof n=="function"&&vr.call(n)==L});var Mr=cr?function(n){if(!n||vr.call(n)!=H||!Br.argsClass&&ct(n))return c;var t=n.valueOf,r=typeof t=="function"&&(r=cr(t))&&cr(r);return r?n==r||cr(n)==r:at(n)}:at,Ur=xt,Vr=ot(function Xr(n,t,r){for(var e=-1,u=n?n.length:0,o=[];++e=d&&s.p!==a,c=[],f=l?zr():u?t():c;++on?t():function(){return 1>--n?t.apply(this,arguments):void 0}},s.assign=Gr,s.at=function(n){var t=-1,r=ar.apply(Yt,Or.call(arguments,1)),e=r.length,u=Gt(e);for(Br.unindexedChars&&yt(n)&&(n=n.split(""));++t++f&&(o=n.apply(a,u)),p=hr(e,t),o}},s.defaults=Hr,s.defer=Dt,s.delay=function(n,t){var r=Or.call(arguments,2);return hr(function(){n.apply(a,r)},t)},s.difference=It,s.filter=jt,s.flatten=Vr,s.forEach=wt,s.forIn=Jr,s.forOwn=Kr,s.functions=pt,s.groupBy=function(n,t,r){var e={};return t=s.createCallback(t,r),wt(n,function(n,r,u){r=Qt(t(n,r,u)),(fr.call(e,r)?e[r]:e[r]=[]).push(n)}),e},s.initial=function(n,t,r){if(!n)return[]; +var e=0,u=n.length;if(typeof t!="number"&&t!=l){var o=u;for(t=s.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=t==l||r?1:t||e;return it(n,0,kr(jr(0,u-e),u))},s.intersection=function(n){var r=arguments,u=r.length,o=-1,a=n?n.length:0,i=[],l=t();l[0]=zr();n:for(;++oe(a,r))&&(o[r]=n)}),o},s.once=function(n){var t,r;return function(){return t?r:(t=i,r=n.apply(this,arguments),n=l,r)}},s.pairs=function(n){for(var t=-1,r=Dr(n),e=r.length,u=Gt(e);++tr?jr(0,e+r):kr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},s.mixin=Tt,s.noConflict=function(){return f._=rr,this},s.parseInt=Qr,s.random=function(n,t){n==l&&t==l&&(t=1),n=+n||0,t==l?(t=n,n=0):t=+t||0;var r=xr();return n%1||t%1?n+kr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+ir(r*(t-n+1))},s.reduce=Et,s.reduceRight=St,s.result=function(n,t){var r=n?n[t]:a;return ht(r)?n[t]():r},s.runInContext=o,s.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Dr(n).length +},s.some=At,s.sortedIndex=qt,s.template=function(n,t,r){var e=s.templateSettings;n||(n=""),r=Hr({},r,e);var u,o=Hr({},r.imports,e.imports),e=Dr(o),o=bt(o),l=0,c=r.interpolate||B,f="__p+='",c=Wt((r.escape||B).source+"|"+c.source+"|"+(c===E?x:B).source+"|"+(r.evaluate||B).source+"|$","g");n.replace(c,function(t,r,e,o,a,c){return e||(e=o),f+=n.slice(l,c).replace(P,nt),r&&(f+="'+__e("+r+")+'"),a&&(u=i,f+="';"+a+";__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),l=c+t.length,t}),f+="';\n",c=r=r.variable,c||(r="obj",f="with("+r+"){"+f+"}"),f=(u?f.replace(_,""):f).replace(C,"$1").replace(j,"$1;"),f="function("+r+"){"+(c?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}"; +try{var p=Kt(e,"return "+f).apply(a,o)}catch(g){throw g.source=f,g}return t?p(t):(p.source=f,p)},s.unescape=function(n){return n==l?"":Qt(n).replace(w,lt)},s.uniqueId=function(n){var t=++v;return Qt(n==l?"":n)+t},s.all=Ct,s.any=At,s.detect=kt,s.findWhere=kt,s.foldl=Et,s.foldr=St,s.include=_t,s.inject=Et,Kr(s,function(n,t){s.prototype[t]||(s.prototype[t]=function(){var t=[this.__wrapped__];return pr.apply(t,arguments),n.apply(s,t)})}),s.first=Bt,s.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=l){var o=u; +for(t=s.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==l||r)return n[u-1];return it(n,jr(0,u-e))}},s.take=Bt,s.head=Bt,Kr(s,function(n,t){s.prototype[t]||(s.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==l||r&&typeof t!="function"?e:new et(e)})}),s.VERSION="1.2.1",s.prototype.toString=function(){return Qt(this.__wrapped__)},s.prototype.value=Lt,s.prototype.valueOf=Lt,Rr(["join","pop","shift"],function(n){var t=Yt[n];s.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),Rr(["push","reverse","sort","unshift"],function(n){var t=Yt[n];s.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Rr(["concat","slice","splice"],function(n){var t=Yt[n];s.prototype[n]=function(){return new et(t.apply(this.__wrapped__,arguments))}}),Br.spliceObjects||Rr(["pop","shift","splice"],function(n){var t=Yt[n],r="splice"==n;s.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new et(e):e}}),s}var a,i=!0,l=null,c=!1,f=typeof exports=="object"&&exports,p=typeof module=="object"&&module&&module.exports==f&&module,s=typeof global=="object"&&global; +(s.global===s||s.window===s)&&(n=s);var g=[],h=[],v=0,m={},y=+new Date+"",d=75,b=10,_=/\b__p\+='';/g,C=/\b(__p\+=)''\+/g,j=/(__e\(.*?\)|\b__t\))\+'';/g,w=/&(?:amp|lt|gt|quot|#39);/g,x=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,E=/<%=([\s\S]+?)%>/g,S=(S=/\bthis\b/)&&S.test(o)&&S,A=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",I=RegExp("^["+A+"]*0+(?=.$)"),B=/($^)/,N=/[&<>"']/g,P=/['\n\r\t\u2028\u2029\\]/g,q="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),z="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),F="[object Arguments]",$="[object Array]",D="[object Boolean]",R="[object Date]",T="[object Error]",L="[object Function]",G="[object Number]",H="[object Object]",J="[object RegExp]",K="[object String]",M={}; +M[L]=c,M[F]=M[$]=M[D]=M[R]=M[G]=M[H]=M[J]=M[K]=i;var U={"boolean":c,"function":i,object:i,number:c,string:c,undefined:c},V={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},W=o();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=W, define(function(){return W})):f&&!f.nodeType?p?(p.exports=W)._=W:f._=W:n._=W}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 387439e781..aa2670aaeb 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -24,6 +24,10 @@ window = freeGlobal; } + /** Used to pool arrays and objects used internally */ + var arrayPool = [], + objectPool = []; + /** Used to generate unique IDs */ var idCounter = 0; @@ -36,6 +40,9 @@ /** Used as the size when optimizations are enabled for large arrays */ var largeArraySize = 75; + /** Used as the max size of the `arrayPool` and `objectPool` */ + var maxPoolSize = 10; + /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, reEmptyStringMiddle = /\b(__p \+=) '' \+/g, @@ -134,6 +141,72 @@ '\u2029': 'u2029' }; + /** + * Gets an array from the array pool or creates a new one if the pool is empty. + * + * @private + * @returns {Array} The array from the pool. + */ + function getArray() { + return arrayPool.pop() || []; + } + + /** + * Gets an object from the object pool or creates a new one if the pool is empty. + * + * @private + * @returns {Object} The object from the pool. + */ + function getObject() { + return objectPool.pop() || { + 'array': null, + 'contains': null, + 'criteria': null, + 'false': null, + 'function': null, + 'index': null, + 'indexOf': null, + 'initedArray': null, + 'null': null, + 'number': null, + 'object': null, + 'push': null, + 'release': null, + 'string': null, + 'true': null, + 'undefined': null, + 'value': null + }; + } + + /** + * Releases the given `array` back to the array pool. + * + * @private + * @param {Array} [array] The array to release. + */ + function releaseArray(array) { + if (arrayPool.length == maxPoolSize) { + arrayPool.length = maxPoolSize - 1; + } + array.length = 0; + arrayPool.push(array); + } + + /** + * Releases the given `object` back to the object pool. + * + * @private + * @param {Object} [object] The object to release. + */ + function releaseObject(object) { + if (objectPool.length == maxPoolSize) { + objectPool.length = maxPoolSize - 1; + } + object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; + objectPool.push(object); + } + /*--------------------------------------------------------------------------*/ /** @@ -501,42 +574,28 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - function createCache(array) { - array || (array = []); - - var bailout, - index = -1, - indexOf = getIndexOf(), - length = array.length, - isLarge = length >= largeArraySize && lodash.indexOf != indexOf, - objCache = {}; - - var caches = { - 'false': false, - 'function': false, - 'null': false, - 'number': {}, - 'object': objCache, - 'string': {}, - 'true': false, - 'undefined': false - }; + var createCache = (function() { function basicContains(value) { - return indexOf(array, value) > -1; + return this.indexOf(this.array, value) > -1; } function basicPush(value) { - array.push(value); + this.array.push(value); } function cacheContains(value) { - var type = typeof value; + var cache = this.cache, + type = typeof value; + if (type == 'boolean' || value == null) { - return caches[value]; + return cache[value]; + } + if (type != 'number' && type != 'string') { + type = 'object'; } - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); return type == 'object' ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) @@ -544,12 +603,17 @@ } function cachePush(value) { - var type = typeof value; + var cache = this.cache, + type = typeof value; + if (type == 'boolean' || value == null) { - caches[value] = true; + cache[value] = true; } else { - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); if (type == 'object') { bailout = (cache[key] || (cache[key] = [])).push(value) == length; @@ -559,18 +623,50 @@ } } - if (isLarge) { - while (++index < length) { - cachePush(array[index]); - } - if (bailout) { - isLarge = caches = objCache = null; + function release() { + var cache = this.cache; + if (cache.initedArray) { + releaseArray(this.array); } + releaseObject(cache); } - return isLarge - ? { 'contains': cacheContains, 'push': cachePush } - : { 'contains': basicContains, 'push': basicPush }; - } + + return function(array) { + var bailout, + index = -1, + indexOf = getIndexOf(), + initedArray = !array && (array = getArray()), + length = array.length, + isLarge = length >= largeArraySize && lodash.indexOf !== indexOf; + + var cache = getObject(); + cache.initedArray = initedArray; + cache['false'] = cache['function'] = cache['null'] = cache['true'] = cache['undefined'] = false; + + var result = getObject(); + result.array = array; + result.cache = cache; + result.contains = cacheContains; + result.indexOf = indexOf; + result.push = cachePush; + result.release = release; + + if (isLarge) { + while (++index < length) { + result.push(array[index]); + } + if (bailout) { + isLarge = false; + result.release(); + } + } + if (!isLarge) { + result.contains = basicContains; + result.push = basicPush; + } + return result; + }; + }()); /** * Creates a new object with the specified `prototype`. @@ -615,7 +711,7 @@ * @returns {Function} Returns the "indexOf" function. */ function getIndexOf(array, value, fromIndex) { - var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result; + var result = (result = lodash.indexOf) === indexOf ? basicIndexOf : result; return result; } @@ -878,8 +974,8 @@ iterable = args[argsIndex]; if (iterable && objectTypes[typeof iterable]) { var ownIndex = -1, - ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], - length = ownProps.length; + ownProps = objectTypes[typeof iterable] && keys(iterable), + length = ownProps ? ownProps.length : 0; while (++ownIndex < length) { index = ownProps[ownIndex]; @@ -982,8 +1078,9 @@ return ctor(result.source, reFlags.exec(result)); } // check for circular references and return corresponding clone - stackA || (stackA = []); - stackB || (stackB = []); + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); var length = stackA.length; while (length--) { @@ -1013,6 +1110,10 @@ result[key] = clone(objValue, deep, callback, undefined, stackA, stackB); }); + if (initedStack) { + releaseArray(stackA); + releaseArray(stackB); + } return result; } @@ -1091,8 +1192,8 @@ iterable = args[argsIndex]; if (iterable && objectTypes[typeof iterable]) { var ownIndex = -1, - ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], - length = ownProps.length; + ownProps = objectTypes[typeof iterable] && keys(iterable), + length = ownProps ? ownProps.length : 0; while (++ownIndex < length) { index = ownProps[ownIndex]; @@ -1202,8 +1303,8 @@ if (!objectTypes[typeof iterable]) return result; callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg); var ownIndex = -1, - ownProps = objectTypes[typeof iterable] ? keys(iterable) : [], - length = ownProps.length; + ownProps = objectTypes[typeof iterable] && keys(iterable), + length = ownProps ? ownProps.length : 0; while (++ownIndex < length) { index = ownProps[ownIndex]; @@ -1499,8 +1600,9 @@ // assume cyclic structures are equal // the algorithm for detecting cyclic structures is adapted from ES 5.1 // section 15.12.3, abstract operation `JO` (http://es5.github.com/#x15.12.3) - stackA || (stackA = []); - stackB || (stackB = []); + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); var length = stackA.length; while (length--) { @@ -1562,6 +1664,10 @@ } }); } + if (initedStack) { + releaseArray(stackA); + releaseArray(stackB); + } return result; } @@ -1865,8 +1971,9 @@ stackA = args[4], stackB = args[5]; } else { - stackA = []; - stackB = []; + var initedStack = true; + stackA = getArray(); + stackB = getArray(); // allows working with `_.reduce` and `_.reduceRight` without // using their `callback` arguments, `index|key` and `collection` @@ -1932,6 +2039,11 @@ object[key] = value; }); } + + if (initedStack) { + releaseArray(stackA); + releaseArray(stackB); + } return object; } @@ -3100,17 +3212,18 @@ callback = lodash.createCallback(callback, thisArg); forEach(collection, function(value, key, collection) { - result[++index] = { - 'criteria': callback(value, key, collection), - 'index': index, - 'value': value - }; + var object = result[++index] = getObject(); + object.criteria = callback(value, key, collection); + object.index = index; + object.value = value; }); length = result.length; result.sort(compareAscending); while (length--) { - result[length] = result[length].value; + var object = result[length]; + result[length] = object.value; + releaseObject(object); } return result; } @@ -3210,15 +3323,16 @@ var index = -1, length = array ? array.length : 0, flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - contains = createCache(flattened).contains, + cache = createCache(flattened), result = []; while (++index < length) { var value = array[index]; - if (!contains(value)) { + if (!cache.contains(value)) { result.push(value); } } + cache.release(); return result; } @@ -3522,27 +3636,34 @@ function intersection(array) { var args = arguments, argsLength = args.length, - cache = createCache(), - caches = {}, index = -1, length = array ? array.length : 0, - isLarge = length >= largeArraySize, result = []; + var caches = getArray(); + caches[0] = createCache(); + outer: while (++index < length) { - var value = array[index]; + var cache = caches[0], + value = array[index]; + if (!cache.contains(value)) { var argsIndex = argsLength; cache.push(value); while (--argsIndex) { - if (!(caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]).contains))(value)) { + cache = caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex])); + if (!cache.contains(value)) { continue outer; } } result.push(value); } } + while (argsLength--) { + caches[argsLength].release(); + } + releaseArray(caches); return result; } @@ -3914,9 +4035,9 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = !isSorted && length >= largeArraySize, + isLarge = !isSorted && length >= largeArraySize && lodash.indexOf !== indexOf, result = [], - seen = isLarge ? createCache() : (callback ? [] : result); + seen = isLarge ? createCache() : (callback ? getArray() : result); while (++index < length) { var value = array[index], @@ -3932,6 +4053,11 @@ result.push(value); } } + if (isLarge) { + seen.release(); + } else if (callback) { + releaseArray(seen); + } return result; }); diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 234b9a84a6..6938cdfdf1 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,41 +4,43 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(o){function f(n){if(!n||fe.call(n)!=B)return a;var t=n.valueOf,e=typeof t=="function"&&(e=re(t))&&re(e);return e?n==e||re(n)==e:et(n)}function P(n,t,e){if(!n||!q[typeof n])return n;t=t&&typeof e=="undefined"?t:W.createCallback(t,e);for(var r=-1,u=q[typeof n]?xe(n):[],a=u.length;++rt||typeof n=="undefined")return 1;if(n=s&&W.indexOf!=l,y={},h={"false":a,"function":a,"null":a,number:{},object:y,string:{},"true":a,undefined:a};if(g){for(;++ce?0:e);++re?ye(0,o+e):e)||0,o&&typeof o=="number"?i=-1<(st(n)?n.indexOf(t,e):u(n,t,e)):P(n,function(n){return++ru&&(u=o)}}else t=!t&&st(n)?H:W.createCallback(t,e),dt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function jt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Dt(r);++earguments.length;t=W.createCallback(t,r,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(e=n[++o]);++oarguments.length;if(typeof u!="number")var i=xe(n),u=i.length;return t=W.createCallback(t,r,4),dt(n,function(r,f,c){f=i?i[--u]:--u,e=o?(o=a,n[f]):t(e,n[f],f,c)}),e}function xt(n,t,e){var r;t=W.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?ye(0,r+e):e||0}else if(e)return e=Nt(n,t),n[e]===t?e:-1;return n?G(n,t,e):-1}function It(n,t,e){if(typeof t!="number"&&t!=u){var r=0,a=-1,o=n?n.length:0;for(t=W.createCallback(t,e);++a>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:d,variable:"",imports:{_:W}},nt.prototype=W.prototype;var Ce=pe,xe=ge?function(n){return lt(n)?ge(n):[]}:V,Oe={"&":"&","<":"<",">":">",'"':""","'":"'"},Ee=it(Oe),Se=tt(function Ae(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=s,i=[],f=o?Q():e?[]:i;++rn?t():function(){return 1>--n?t.apply(this,arguments):void 0}},W.assign=U,W.at=function(n){for(var t=-1,e=ne.apply(Jt,de.call(arguments,1)),r=e.length,u=Dt(r);++t++l&&(f=n.apply(c,i)),p=ie(o,t),f}},W.defaults=M,W.defer=Ft,W.delay=function(n,t){var r=de.call(arguments,2);return ie(function(){n.apply(e,r)},t)},W.difference=Ot,W.filter=bt,W.flatten=Se,W.forEach=dt,W.forIn=K,W.forOwn=P,W.functions=ot,W.groupBy=function(n,t,e){var r={};return t=W.createCallback(t,e),dt(n,function(n,e,u){e=Gt(t(n,e,u)),(ue.call(r,e)?r[e]:r[e]=[]).push(n) -}),r},W.initial=function(n,t,e){if(!n)return[];var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a;for(t=W.createCallback(t,e);o--&&t(n[o],o,n);)r++}else r=t==u||e?1:t||r;return rt(n,0,he(ye(0,a-r),a))},W.intersection=function(n){var t=arguments,e=t.length,r=Q(),u={},a=-1,o=n?n.length:0,i=[];n:for(;++ar(o,e))&&(a[e]=n)}),a},W.once=function(n){var t,e;return function(){return t?e:(t=r,e=n.apply(this,arguments),n=u,e)}},W.pairs=function(n){for(var t=-1,e=xe(n),r=e.length,u=Dt(r);++te?ye(0,r+e):he(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},W.mixin=Tt,W.noConflict=function(){return o._=Qt,this},W.parseInt=Ne,W.random=function(n,t){n==u&&t==u&&(t=1),n=+n||0,t==u?(t=n,n=0):t=+t||0;var e=me();return n%1||t%1?n+he(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+te(e*(t-n+1))},W.reduce=wt,W.reduceRight=Ct,W.result=function(n,t){var r=n?n[t]:e;return ct(r)?n[t]():r},W.runInContext=t,W.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:xe(n).length -},W.some=xt,W.sortedIndex=Nt,W.template=function(n,t,u){var a=W.templateSettings;n||(n=""),u=M({},u,a);var o,i=M({},u.imports,a.imports),a=xe(i),i=gt(i),f=0,c=u.interpolate||w,l="__p+='",c=Wt((u.escape||w).source+"|"+c.source+"|"+(c===d?b:w).source+"|"+(u.evaluate||w).source+"|$","g");n.replace(c,function(t,e,u,a,i,c){return u||(u=a),l+=n.slice(f,c).replace(x,Y),e&&(l+="'+__e("+e+")+'"),i&&(o=r,l+="';"+i+";__p+='"),u&&(l+="'+((__t=("+u+"))==null?'':__t)+'"),f=c+t.length,t}),l+="';\n",c=u=u.variable,c||(u="obj",l="with("+u+"){"+l+"}"),l=(o?l.replace(v,""):l).replace(g,"$1").replace(y,"$1;"),l="function("+u+"){"+(c?"":u+"||("+u+"={});")+"var __t,__p='',__e=_.escape"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}"; -try{var p=Kt(a,"return "+l).apply(e,i)}catch(s){throw s.source=l,s}return t?p(t):(p.source=l,p)},W.unescape=function(n){return n==u?"":Gt(n).replace(h,ut)},W.uniqueId=function(n){var t=++c;return Gt(n==u?"":n)+t},W.all=ht,W.any=xt,W.detect=mt,W.findWhere=mt,W.foldl=wt,W.foldr=Ct,W.include=yt,W.inject=wt,P(W,function(n,t){W.prototype[t]||(W.prototype[t]=function(){var t=[this.__wrapped__];return ae.apply(t,arguments),n.apply(W,t)})}),W.first=Et,W.last=function(n,t,e){if(n){var r=0,a=n.length;if(typeof t!="number"&&t!=u){var o=a; -for(t=W.createCallback(t,e);o--&&t(n[o],o,n);)r++}else if(r=t,r==u||e)return n[a-1];return rt(n,ye(0,a-r))}},W.take=Et,W.head=Et,P(W,function(n,t){W.prototype[t]||(W.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==u||e&&typeof t!="function"?r:new nt(r)})}),W.VERSION="1.2.1",W.prototype.toString=function(){return Gt(this.__wrapped__)},W.prototype.value=qt,W.prototype.valueOf=qt,dt(["join","pop","shift"],function(n){var t=Jt[n];W.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),dt(["push","reverse","sort","unshift"],function(n){var t=Jt[n];W.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),dt(["concat","slice","splice"],function(n){var t=Jt[n];W.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments))}}),W}var e,r=!0,u=null,a=!1,o=typeof exports=="object"&&exports,i=typeof module=="object"&&module&&module.exports==o&&module,f=typeof global=="object"&&global;(f.global===f||f.window===f)&&(n=f);var c=0,l={},p=+new Date+"",s=75,v=/\b__p\+='';/g,g=/\b(__p\+=)''\+/g,y=/(__e\(.*?\)|\b__t\))\+'';/g,h=/&(?:amp|lt|gt|quot|#39);/g,b=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,m=/\w*$/,d=/<%=([\s\S]+?)%>/g,_=(_=/\bthis\b/)&&_.test(t)&&_,k=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",j=RegExp("^["+k+"]*0+(?=.$)"),w=/($^)/,C=/[&<>"']/g,x=/['\n\r\t\u2028\u2029\\]/g,O="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),E="[object Arguments]",S="[object Array]",I="[object Boolean]",N="[object Date]",A="[object Function]",$="[object Number]",B="[object Object]",F="[object RegExp]",R="[object String]",T={}; -T[A]=a,T[E]=T[S]=T[I]=T[N]=T[$]=T[B]=T[F]=T[R]=r;var q={"boolean":a,"function":r,object:r,number:a,string:a,undefined:a},D={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},z=t();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=z, define(function(){return z})):o&&!o.nodeType?i?(i.exports=z)._=z:o._=z:n._=z}(this); \ No newline at end of file +;!function(n){function t(){return v.pop()||[]}function e(){return g.pop()||{k:f,m:f,n:f,"false":f,"function":f,o:f,p:f,q:f,"null":f,number:f,object:f,push:f,r:f,string:f,"true":f,undefined:f,s:f}}function r(n){v.length==d&&(v.length=d-1),n.length=0,v.push(n)}function u(n){g.length==d&&(g.length=d-1),n.k=n.l=n.n=n.object=n.a=n.b=n.s=f,g.push(n)}function a(c){function s(n){if(!n||pe.call(n)!=P)return l;var t=n.valueOf,e=typeof t=="function"&&(e=oe(t))&&oe(e);return e?n==e||oe(n)==e:at(n)}function v(n,t,e){if(!n||!V[typeof n])return n; +t=t&&typeof e=="undefined"?t:L.createCallback(t,e);for(var r=-1,u=V[typeof n]&&Ie(n),a=u?u.length:0;++rt||typeof n=="undefined")return 1;if(ne?0:e);++re?be(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(ht(n)?n.indexOf(t,e):u(n,t,e)):v(n,function(n){return++ru&&(u=o) +}}else t=!t&&ht(n)?X:L.createCallback(t,e),jt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function xt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Kt(r);++earguments.length;t=L.createCallback(t,r,4);var a=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++a]);++aarguments.length; +if(typeof u!="number")var o=Ie(n),u=o.length;return t=L.createCallback(t,r,4),jt(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=l,n[i]):t(e,n[i],i,f)}),e}function St(n,t,e){var r;t=L.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?be(0,r+e):e||0}else if(e)return e=qt(n,t),n[e]===t?e:-1;return n?Q(n,t,e):-1}function $t(n,t,e){if(typeof t!="number"&&t!=f){var r=0,u=-1,a=n?n.length:0;for(t=L.createCallback(t,e);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:O,variable:"",imports:{_:L}};var Ee=function(){function n(n){return-1=b&&L.p!==i,g=e();if(g.q=f,g["false"]=g["function"]=g["null"]=g["true"]=g.undefined=l,f=e(),f.k=r,f.l=g,f.m=o,f.p=i,f.push=c,f.r=p,v)for(;++u":">",'"':""","'":"'"},Ae=ct(Ne),$e=ut(function Fe(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=b&&L.p!==o,l=[],c=f?Ee():u?t():l;++an?t():function(){return 1>--n?t.apply(this,arguments):void 0}},L.assign=H,L.at=function(n){for(var t=-1,e=re.apply(Xt,je.call(arguments,1)),r=e.length,u=Kt(r);++t++c&&(a=n.apply(o,u)),p=ce(r,t),a}},L.defaults=d,L.defer=Tt,L.delay=function(n,t){var e=je.call(arguments,2);return ce(function(){n.apply(o,e)},t)},L.difference=It,L.filter=_t,L.flatten=$e,L.forEach=jt,L.forIn=g,L.forOwn=v,L.functions=lt,L.groupBy=function(n,t,e){var r={};return t=L.createCallback(t,e),jt(n,function(n,e,u){e=Lt(t(n,e,u)),(ie.call(r,e)?r[e]:r[e]=[]).push(n)}),r},L.initial=function(n,t,e){if(!n)return[]; +var r=0,u=n.length;if(typeof t!="number"&&t!=f){var a=u;for(t=L.createCallback(t,e);a--&&t(n[a],a,n);)r++}else r=t==f||e?1:t||r;return ot(n,0,de(be(0,u-r),u))},L.intersection=function(n){var e=arguments,u=e.length,a=-1,o=n?n.length:0,i=[],f=t();f[0]=Ee();n:for(;++ar(o,e))&&(a[e]=n)}),a},L.once=function(n){var t,e;return function(){return t?e:(t=i,e=n.apply(this,arguments),n=f,e)}},L.pairs=function(n){for(var t=-1,e=Ie(n),r=e.length,u=Kt(r);++te?be(0,r+e):de(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},L.mixin=zt,L.noConflict=function(){return c._=Zt,this},L.parseInt=Be,L.random=function(n,t){n==f&&t==f&&(t=1),n=+n||0,t==f?(t=n,n=0):t=+t||0;var e=ke();return n%1||t%1?n+de(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ue(e*(t-n+1))},L.reduce=Ot,L.reduceRight=Et,L.result=function(n,t){var e=n?n[t]:o;return st(e)?n[t]():e},L.runInContext=a,L.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ie(n).length +},L.some=St,L.sortedIndex=qt,L.template=function(n,t,e){var r=L.templateSettings;n||(n=""),e=d({},e,r);var u,a=d({},e.imports,r.imports),r=Ie(a),a=mt(a),f=0,l=e.interpolate||N,c="__p+='",l=Jt((e.escape||N).source+"|"+l.source+"|"+(l===O?C:N).source+"|"+(e.evaluate||N).source+"|$","g");n.replace(l,function(t,e,r,a,o,l){return r||(r=a),c+=n.slice(f,l).replace($,tt),e&&(c+="'+__e("+e+")+'"),o&&(u=i,c+="';"+o+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),f=l+t.length,t}),c+="';\n",l=e=e.variable,l||(e="obj",c="with("+e+"){"+c+"}"),c=(u?c.replace(_,""):c).replace(k,"$1").replace(j,"$1;"),c="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}"; +try{var p=Vt(r,"return "+c).apply(o,a)}catch(s){throw s.source=c,s}return t?p(t):(p.source=c,p)},L.unescape=function(n){return n==f?"":Lt(n).replace(w,it)},L.uniqueId=function(n){var t=++h;return Lt(n==f?"":n)+t},L.all=dt,L.any=St,L.detect=kt,L.findWhere=kt,L.foldl=Ot,L.foldr=Et,L.include=bt,L.inject=Ot,v(L,function(n,t){L.prototype[t]||(L.prototype[t]=function(){var t=[this.__wrapped__];return fe.apply(t,arguments),n.apply(L,t)})}),L.first=Nt,L.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=f){var a=u; +for(t=L.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==f||e)return n[u-1];return ot(n,be(0,u-r))}},L.take=Nt,L.head=Nt,v(L,function(n,t){L.prototype[t]||(L.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==f||e&&typeof t!="function"?r:new rt(r)})}),L.VERSION="1.2.1",L.prototype.toString=function(){return Lt(this.__wrapped__)},L.prototype.value=Pt,L.prototype.valueOf=Pt,jt(["join","pop","shift"],function(n){var t=Xt[n];L.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),jt(["push","reverse","sort","unshift"],function(n){var t=Xt[n];L.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),jt(["concat","slice","splice"],function(n){var t=Xt[n];L.prototype[n]=function(){return new rt(t.apply(this.__wrapped__,arguments))}}),L}var o,i=!0,f=null,l=!1,c=typeof exports=="object"&&exports,p=typeof module=="object"&&module&&module.exports==c&&module,s=typeof global=="object"&&global;(s.global===s||s.window===s)&&(n=s);var v=[],g=[],h=0,y={},m=+new Date+"",b=75,d=10,_=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,j=/(__e\(.*?\)|\b__t\))\+'';/g,w=/&(?:amp|lt|gt|quot|#39);/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,x=/\w*$/,O=/<%=([\s\S]+?)%>/g,E=(E=/\bthis\b/)&&E.test(a)&&E,S=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",I=RegExp("^["+S+"]*0+(?=.$)"),N=/($^)/,A=/[&<>"']/g,$=/['\n\r\t\u2028\u2029\\]/g,q="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",F="[object Array]",R="[object Boolean]",T="[object Date]",D="[object Function]",z="[object Number]",P="[object Object]",K="[object RegExp]",M="[object String]",U={}; +U[D]=l,U[B]=U[F]=U[R]=U[T]=U[z]=U[P]=U[K]=U[M]=i;var V={"boolean":l,"function":i,object:i,number:l,string:l,undefined:l},W={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},G=a();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=G, define(function(){return G})):c&&!c.nodeType?p?(p.exports=G)._=G:c._=G:n._=G}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index a16885dbcf..73d81c5824 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -317,18 +317,6 @@ return -1; } - /** - * Used by `_.max` and `_.min` as the default `callback` when a given - * `collection` is a string value. - * - * @private - * @param {String} value The character to inspect. - * @returns {Number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - /** * Used by `sortBy` to compare transformed `collection` values, stable sorting * them in ascending order. @@ -416,86 +404,6 @@ return bound; } - /** - * Creates a function optimized to search large arrays for a given `value`, - * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. - * - * @private - * @param {Array} [array=[]] The array to search. - * @param {Mixed} value The value to search for. - * @returns {Boolean} Returns `true`, if `value` is found, else `false`. - */ - function createCache(array) { - array || (array = []); - - var bailout, - index = -1, - indexOf = getIndexOf(), - length = array.length, - isLarge = length >= largeArraySize && lodash.indexOf != indexOf, - objCache = {}; - - var caches = { - 'false': false, - 'function': false, - 'null': false, - 'number': {}, - 'object': objCache, - 'string': {}, - 'true': false, - 'undefined': false - }; - - function basicContains(value) { - return indexOf(array, value) > -1; - } - - function basicPush(value) { - array.push(value); - } - - function cacheContains(value) { - var type = typeof value; - if (type == 'boolean' || value == null) { - return caches[value]; - } - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; - - return type == 'object' - ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) - : !!cache[key]; - } - - function cachePush(value) { - var type = typeof value; - if (type == 'boolean' || value == null) { - caches[value] = true; - } else { - var cache = caches[type] || (type = 'object', objCache), - key = type == 'number' ? value : keyPrefix + value; - - if (type == 'object') { - bailout = (cache[key] || (cache[key] = [])).push(value) == length; - } else { - cache[key] = true; - } - } - } - - if (isLarge) { - while (++index < length) { - cachePush(array[index]); - } - if (bailout) { - isLarge = caches = objCache = null; - } - } - return isLarge - ? { 'contains': cacheContains, 'push': cachePush } - : { 'contains': basicContains, 'push': basicPush }; - } - /** * Creates a new object with the specified `prototype`. * @@ -550,7 +458,7 @@ * @returns {Function} Returns the "indexOf" function. */ function getIndexOf(array, value, fromIndex) { - var result = (result = lodash.indexOf) == indexOf ? basicIndexOf : result; + var result = (result = lodash.indexOf) === indexOf ? basicIndexOf : result; return result; } @@ -576,29 +484,6 @@ // no operation performed } - /** - * Creates a function that juggles arguments, allowing argument overloading - * for `_.flatten` and `_.uniq`, before passing them to the given `func`. - * - * @private - * @param {Function} func The function to wrap. - * @returns {Function} Returns the new function. - */ - function overloadWrapper(func) { - return function(array, flag, callback, thisArg) { - // juggle arguments - if (typeof flag != 'boolean' && flag != null) { - thisArg = callback; - callback = !(thisArg && thisArg[flag] === array) ? flag : undefined; - flag = false; - } - if (callback != null) { - callback = createCallback(callback, thisArg); - } - return func(array, flag, callback, thisArg); - }; - } - /** * Used by `unescape` to convert HTML entities to characters. * diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 45328b0e53..6704703102 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,11 +4,11 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n){return n instanceof t?n:new l(n)}function r(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nt||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)}); else for(;++ou&&(u=r);return u}function k(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=W(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=$t(n),u=i.length;return t=W(t,e,4),N(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f) @@ -16,20 +16,20 @@ else for(;++ou&&(u=r);return u}function k(n,t){var r=-1,e=n?n.lengt return Rt.call(n,0,kt(Ft(0,e),u))}}function I(n,t){for(var r=-1,e=n?n.length:0,u=[];++re?Ft(0,u+e):e||0}else if(e)return e=P(n,t),n[e]===t?e:-1;return n?r(n,t,e):-1}function C(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=W(t,r);++u>>1,r(n[e])o(l,c))&&(r&&l.push(c),a.push(e))}return a}function V(n,t){return Mt.fastBind||xt&&2"']/g,rt=/['\n\r\t\u2028\u2029\\]/g,et="[object Arguments]",ut="[object Array]",ot="[object Boolean]",it="[object Date]",at="[object Number]",ft="[object Object]",lt="[object RegExp]",ct="[object String]",pt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},vt=Array.prototype,L=Object.prototype,gt=n._,ht=RegExp("^"+(L.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),yt=Math.ceil,mt=n.clearTimeout,_t=vt.concat,bt=Math.floor,dt=L.hasOwnProperty,jt=vt.push,wt=n.setTimeout,At=L.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Nt=n.isNaN,Bt=ht.test(Bt=Object.keys)&&Bt,Ft=Math.max,kt=Math.min,qt=Math.random,Rt=vt.slice,L=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+L),Mt={}; -!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(vt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(o=function(n){if(d(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}}),l.prototype=t.prototype,s(arguments)||(s=function(n){return n?dt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==ut:!1},Et=function(n){var t,r=[];if(!n||!pt[typeof n])return r; -for(t in n)dt.call(n,t)&&r.push(t);return r},$t=Bt?function(n){return d(n)?Bt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=y(It),Ct=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(t(n[r],r,n)===X)break;return n},Pt=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(dt.call(n,r)&&t(n[r],r,n)===X)break;return n};b(/x/)&&(b=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},t.bind=V,t.bindAll=function(n){for(var t=1"']/g,rt=/['\n\r\t\u2028\u2029\\]/g,et="[object Arguments]",ut="[object Array]",ot="[object Boolean]",it="[object Date]",at="[object Number]",ft="[object Object]",lt="[object RegExp]",ct="[object String]",pt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},vt=Array.prototype,L=Object.prototype,gt=n._,ht=RegExp("^"+(L.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),yt=Math.ceil,mt=n.clearTimeout,_t=vt.concat,dt=Math.floor,bt=L.hasOwnProperty,jt=vt.push,wt=n.setTimeout,At=L.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Nt=n.isNaN,Bt=ht.test(Bt=Object.keys)&&Bt,Ft=Math.max,kt=Math.min,qt=Math.random,Rt=vt.slice,L=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+L),Mt={}; +!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(vt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(o=function(n){if(b(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}}),l.prototype=t.prototype,s(arguments)||(s=function(n){return n?bt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==ut:!1},Et=function(n){var t,r=[];if(!n||!pt[typeof n])return r; +for(t in n)bt.call(n,t)&&r.push(t);return r},$t=Bt?function(n){return b(n)?Bt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=y(It),Ct=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(t(n[r],r,n)===X)break;return n},Pt=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(bt.call(n,r)&&t(n[r],r,n)===X)break;return n};d(/x/)&&(d=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},t.bind=V,t.bindAll=function(n){for(var t=1u(i,a)){for(var l=r;--l;)if(0>u(t[l],a))continue n;i.push(a)}}return i},t.invert=y,t.invoke=function(n,t){var r=Rt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=B,t.max=F,t.memoize=function(n,t){var r={};return function(){var e=Y+(t?t.apply(this,arguments):arguments[0]);return dt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=W(t,r),N(n,function(n,r,o){r=t(n,r,o),rt(r,u)&&(e[u]=n) +return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=B,t.max=F,t.memoize=function(n,t){var r={};return function(){var e=Y+(t?t.apply(this,arguments):arguments[0]);return bt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=W(t,r),N(n,function(n,r,o){r=t(n,r,o),rt(r,u)&&(e[u]=n) }),e},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+bt(r*(t-n+1))},t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null; -return b(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){var u=t.templateSettings;n||(n=""),e=g({},e,u);var o=0,i="__p+='",u=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,u,f){return i+=n.slice(o,f).replace(rt,a),r&&(i+="'+_['escape']("+r+")+'"),u&&(i+="';"+u+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t +return jt.apply(r,arguments),t.apply(this,r)}},t.zip=function(n){for(var t=-1,r=n?F(k(arguments,"length")):0,e=Array(0>r?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+dt(r*(t-n+1))},t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null; +return d(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){var u=t.templateSettings;n||(n=""),e=g({},e,u);var o=0,i="__p+='",u=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,u,f){return i+=n.slice(o,f).replace(rt,a),r&&(i+="'+_['escape']("+r+")+'"),u&&(i+="';"+u+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t }),i+="';\n",u||(u="obj",i="with("+u+"||{}){"+i+"}"),i="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},t.uniqueId=function(n){var t=++Q+"";return n?n+t:t},t.all=O,t.any=D,t.detect=S,t.findWhere=function(n,t){return M(n,t,!0)},t.foldl=q,t.foldr=R,t.include=x,t.inject=q,t.first=$,t.last=function(n,t,r){if(n){var e=0,u=n.length; if(typeof t!="number"&&null!=t){var o=u;for(t=W(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Ft(0,u-e))}},t.take=$,t.head=$,t.VERSION="1.2.1",H(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var r=vt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this }}),N(["concat","join","slice"],function(n){var r=vt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new l(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):J&&!J.nodeType?K?(K.exports=t)._=t:J._=t:n._=t}(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index f37ef9f410..2ebf266460 100644 --- a/doc/README.md +++ b/doc/README.md @@ -218,7 +218,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3524 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3647 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -242,7 +242,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3554 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3677 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -267,7 +267,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3590 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3714 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -295,7 +295,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3660 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3784 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -355,7 +355,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3722 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3846 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -398,7 +398,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3766 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3890 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -430,7 +430,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3833 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3957 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -487,7 +487,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3867 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3991 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -511,7 +511,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3951 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4082 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -568,7 +568,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3992 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4123 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -597,7 +597,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4033 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4164 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -635,7 +635,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4112 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4243 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -695,7 +695,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4176 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4307 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -744,7 +744,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4208 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4339 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -768,7 +768,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4258 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4389 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -815,7 +815,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4297 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4433 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -839,7 +839,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4323 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4459 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -864,7 +864,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4343 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4479 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -888,7 +888,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4365 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4501 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -923,7 +923,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L313 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L397 "View in source") [Ⓣ][1] Creates a `lodash` object, which wraps the given `value`, to enable method chaining. @@ -979,7 +979,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5443 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5579 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1009,7 +1009,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5460 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5596 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1030,7 +1030,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5477 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5613 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1061,7 +1061,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2512 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2634 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1089,7 +1089,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2554 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2676 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1127,7 +1127,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2609 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2731 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1163,7 +1163,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2661 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2783 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1209,7 +1209,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2722 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2844 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1255,7 +1255,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2789 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2911 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1304,7 +1304,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2836 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2958 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1336,7 +1336,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2886 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3008 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1373,7 +1373,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2919 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3041 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1402,7 +1402,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2971 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3093 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1447,7 +1447,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3028 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3150 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1489,7 +1489,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3097 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3219 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1531,7 +1531,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3147 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3269 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1561,7 +1561,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3179 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3301 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1599,7 +1599,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3222 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3344 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1630,7 +1630,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3282 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3404 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1673,7 +1673,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3303 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3425 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1697,7 +1697,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3336 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3458 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1727,7 +1727,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3383 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3505 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1773,7 +1773,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3439 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3561 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1810,7 +1810,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3474 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3597 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1834,7 +1834,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3506 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3629 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1871,7 +1871,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4405 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4541 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1899,7 +1899,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4438 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4574 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1930,7 +1930,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4469 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4605 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1961,7 +1961,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4515 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4651 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2002,7 +2002,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4538 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4674 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2029,7 +2029,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4597 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4733 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2083,7 +2083,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4673 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4809 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2116,7 +2116,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4726 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4862 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2141,7 +2141,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4752 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4888 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2168,7 +2168,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4777 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4913 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2194,7 +2194,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4807 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4943 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2220,7 +2220,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4842 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4978 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2247,7 +2247,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4873 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5009 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2284,7 +2284,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4906 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5042 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2316,7 +2316,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4971 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5107 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2352,7 +2352,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1266 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1372 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2390,7 +2390,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1321 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1427 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2437,7 +2437,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1446 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1557 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2483,7 +2483,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1470 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1581 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2509,7 +2509,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1492 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1603 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2537,7 +2537,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1533 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1644 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2573,7 +2573,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1558 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1669 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2601,7 +2601,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1575 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1686 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2628,7 +2628,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1600 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1711 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2653,7 +2653,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1617 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1728 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2677,7 +2677,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1129 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1235 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2704,7 +2704,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1155 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1261 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2731,7 +2731,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1643 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1754 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2755,7 +2755,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1660 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1771 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2779,7 +2779,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1677 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1788 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2803,7 +2803,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1702 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1813 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2833,7 +2833,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1761 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1872 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2878,7 +2878,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1942 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2058 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2916,7 +2916,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2075 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2940,7 +2940,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2022 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2138 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2975,7 +2975,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2044 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2160 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3002,7 +3002,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2061 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2177 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3026,7 +3026,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1989 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2105 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3056,7 +3056,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2089 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2205 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3091,7 +3091,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2114 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2230 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3115,7 +3115,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2131 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2247 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3139,7 +3139,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2148 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2264 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3163,7 +3163,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1188 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1294 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3187,7 +3187,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2207 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2323 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3243,7 +3243,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2316 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2438 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3274,7 +3274,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2351 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2473 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3298,7 +3298,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2389 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2511 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3329,7 +3329,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2444 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2566 "View in source") [Ⓣ][1] An alternative to `_.reduce`, this method transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3366,7 +3366,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2477 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2599 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3397,7 +3397,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4995 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5131 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3421,7 +3421,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5013 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5149 "View in source") [Ⓣ][1] This function returns the first argument passed to it. @@ -3446,7 +3446,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5039 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5175 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3476,7 +3476,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5068 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5204 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3496,7 +3496,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5092 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5228 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3523,7 +3523,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5115 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5251 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3551,7 +3551,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5159 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5295 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3586,7 +3586,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L153 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L237 "View in source") [Ⓣ][1] Create a new `lodash` function using the given `context` object. @@ -3604,7 +3604,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5243 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5379 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3686,7 +3686,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5368 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5504 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3718,7 +3718,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5395 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5531 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3742,7 +3742,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5415 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5551 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3776,7 +3776,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L509 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L593 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3795,7 +3795,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5658 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5794 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3807,7 +3807,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L327 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L411 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3819,7 +3819,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L352 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L436 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3831,7 +3831,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L344 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L428 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3843,7 +3843,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L361 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L445 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -3855,7 +3855,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L374 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L458 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3869,7 +3869,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L382 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L466 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3881,7 +3881,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L399 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L483 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3893,7 +3893,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L410 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L494 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3907,7 +3907,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L390 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L474 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3919,7 +3919,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L424 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L508 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3933,7 +3933,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L435 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L519 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3947,7 +3947,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L461 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L545 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3959,7 +3959,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L469 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L553 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3971,7 +3971,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L477 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L561 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3983,7 +3983,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L485 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L569 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3995,7 +3995,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L493 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L577 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -4007,7 +4007,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L501 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L585 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. From 2c950f74bcc96091d6ed60ee8a4c58e96ab3c1fe Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 4 Jun 2013 09:12:11 -0700 Subject: [PATCH 098/117] Remove props related to `_.sortBy` if the method isn't included in a given build. Former-commit-id: b3da4dab8257b9001b7458263a28bf22b0a2c831 --- build.js | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/build.js b/build.js index 74c6b5e0ad..a7d8726348 100755 --- a/build.js +++ b/build.js @@ -1058,8 +1058,8 @@ return source; } // remove data object property assignment - var modified = snippet.replace(RegExp("^(?: *\\/\\/.*\\n)* *data\\." + identifier + " *= *(.+\\n+)", 'm'), function(match, postlude) { - return /\bdata\b/.test(postlude) ? postlude : ''; + var modified = snippet.replace(RegExp("^(?: *\\/\\/.*\\n)* *(\\w+)\\." + identifier + " *= *(.+\\n+)", 'm'), function(match, object, postlude) { + return RegExp('\\b' + object + '\\.').test(postlude) ? postlude : ''; }); source = source.replace(snippet, function() { @@ -1077,23 +1077,31 @@ .replace(/,(?=\s*\))/, ''); }); - return removeFromGetObject(source, identifier); + return removeFromObjectPoolFunctions(source, identifier); } /** - * Removes all references to `identifier` from `getObject` in `source`. + * Removes all references to `identifier` from the `objectPool` functions in `source`. * * @private * @param {String} source The source to process. * @param {String} identifier The name of the property to remove. * @returns {String} Returns the modified source. */ - function removeFromGetObject(source, identifier) { - return source.replace(matchFunction(source, 'getObject'), function(match) { - return match - .replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '') - .replace(/,(?=\s*})/, ''); + function removeFromObjectPoolFunctions(source, identifier) { + _.each(['getObject', 'releaseObject'], function(methodName) { + source = source.replace(matchFunction(source, methodName), function(match) { + // remove object property assignments + return match + .replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '') + .replace(/,(?=\s*})/, '') + .replace(RegExp("^(?: *\\/\\/.*\\n)* *(\\w+)\\." + identifier + " *= *(.+\\n+)", 'm'), function(match, object, postlude) { + return RegExp('\\b' + object + '\\.').test(postlude) ? postlude : ''; + }); + }); }); + + return source; } /** @@ -3025,7 +3033,7 @@ source = removeFunction(source, 'createIterator'); iteratorOptions.forEach(function(prop) { - source = removeFromGetObject(source, prop); + source = removeFromObjectPoolFunctions(source, prop); }); // inline all functions defined with `createIterator` @@ -3300,6 +3308,11 @@ source = removeVar(source, 'reLeadingSpacesAndZeros'); source = removeVar(source, 'whitespace'); } + if (isRemoved(source, 'sortBy')) { + source = removeFromObjectPoolFunctions(source, 'criteria'); + source = removeFromObjectPoolFunctions(source, 'index'); + source = removeFromObjectPoolFunctions(source, 'value'); + } if (isRemoved(source, 'template')) { // remove `templateSettings` assignment source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, ''); From 036483d19580b41dc6f73dde6326ccc0ca8fb5fc Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 5 Jun 2013 08:06:05 -0700 Subject: [PATCH 099/117] Simplify the object pool and large array cache. Former-commit-id: d15df51efe575cd6fa773622f135ccfb6f675545 --- lodash.js | 206 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 106 insertions(+), 100 deletions(-) diff --git a/lodash.js b/lodash.js index 881d33cf4c..2362cfb376 100644 --- a/lodash.js +++ b/lodash.js @@ -166,23 +166,17 @@ return objectPool.pop() || { 'args': null, 'array': null, - 'arrays': null, 'bottom': null, - 'contains': null, 'criteria': null, 'false': null, 'firstArg': null, - 'function': null, 'index': null, - 'indexOf': null, 'init': null, - 'initedArray': null, 'loop': null, 'null': null, 'number': null, 'object': null, 'push': null, - 'release': null, 'shadowedProps': null, 'string': null, 'support': null, @@ -216,6 +210,10 @@ * @param {Object} [object] The object to release. */ function releaseObject(object) { + var cache = object.cache; + if (cache) { + releaseObject(cache); + } if (objectPool.length == maxPoolSize) { objectPool.length = maxPoolSize - 1; } @@ -614,9 +612,9 @@ '<%= top %>;' + // array-like iteration: - '<% if (arrays) { %>\n' + + '<% if (array) { %>\n' + 'var length = iterable.length; index = -1;\n' + - 'if (<%= arrays %>) {' + + 'if (<%= array %>) {' + // add support for accessing string characters by index if needed ' <% if (support.unindexedChars) { %>\n' + @@ -703,7 +701,7 @@ ' }' + ' <% } %>' + ' <% } %>' + - ' <% if (arrays || support.nonEnumArgs) { %>\n}<% } %>\n' + + ' <% if (array || support.nonEnumArgs) { %>\n}<% } %>\n' + // add code to the bottom of the iteration function '<%= bottom %>;\n' + @@ -729,14 +727,14 @@ var eachIteratorOptions = { 'args': 'collection, callback, thisArg', 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg)", - 'arrays': "typeof length == 'number'", + 'array': "typeof length == 'number'", 'loop': 'if (callback(iterable[index], index, collection) === false) return result' }; /** Reusable iterator options for `forIn` and `forOwn` */ var forOwnIteratorOptions = { 'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top, - 'arrays': false + 'array': false }; /*--------------------------------------------------------------------------*/ @@ -871,33 +869,43 @@ * @param {Mixed} value The value to search for. * @returns {Boolean} Returns `true`, if `value` is found, else `false`. */ - var createCache = (function() { + function createCache(array) { + var index = -1, + length = array.length; - function basicContains(value) { - return this.indexOf(this.array, value) > -1; - } + var cache = getObject(); + cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - function basicPush(value) { - this.array.push(value); - } + var result = getObject(); + result.array = array; + result.cache = cache; + result.push = cachePush; - function cacheContains(value) { - var cache = this.cache, - type = typeof value; + while (++index < length) { + result.push(array[index]); + } + return cache.object === false + ? releaseObject(result) + : result; + } - if (type == 'boolean' || value == null) { - return cache[value]; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = cache[type] || (cache[type] = {}); + function cacheIndexOf(cache, value) { + var type = typeof value; + cache = cache.cache; - return type == 'object' - ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) - : !!cache[key]; + if (type == 'boolean' || value == null) { + return cache[value]; } + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); + + return type == 'object' + ? (cache[key] && basicIndexOf(cache[key], value) > -1 ? 0 : -1) + : (cache[key] ? 0 : -1); + } function cachePush(value) { var cache = this.cache, @@ -909,68 +917,26 @@ if (type != 'number' && type != 'string') { type = 'object'; } - var key = type == 'number' ? value : keyPrefix + value; - cache = cache[type] || (cache[type] = {}); + var key = type == 'number' ? value : keyPrefix + value, + typeCache = cache[type] || (cache[type] = {}); if (type == 'object') { - bailout = (cache[key] || (cache[key] = [])).push(value) == length; + if ((typeCache[key] || (typeCache[key] = [])).push(value) === this.array.length) { + cache[type] = false; + } } else { - cache[key] = true; + typeCache[key] = true; } } } - function release() { - var cache = this.cache; - if (cache.initedArray) { - releaseArray(this.array); - } - releaseObject(cache); - } - - return function(array) { - var bailout, - index = -1, - indexOf = getIndexOf(), - initedArray = !array && (array = getArray()), - length = array.length, - isLarge = length >= largeArraySize && lodash.indexOf !== indexOf; - - var cache = getObject(); - cache.initedArray = initedArray; - cache['false'] = cache['function'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.contains = cacheContains; - result.indexOf = indexOf; - result.push = cachePush; - result.release = release; - - if (isLarge) { - while (++index < length) { - result.push(array[index]); - } - if (bailout) { - isLarge = false; - result.release(); - } - } - if (!isLarge) { - result.contains = basicContains; - result.push = basicPush; - } - return result; - }; - }()); /** * Creates compiled iteration functions. * * @private * @param {Object} [options1, options2, ...] The compile options object(s). - * arrays - A string of code to determine if the iterable is an array or array-like. + * array - A string of code to determine if the iterable is an array or array-like. * useHas - A boolean to specify using `hasOwnProperty` checks in the object loop. * useKeys - A boolean to specify using `_.keys` for own property iteration. * args - A string of comma separated arguments the iteration function will accept. @@ -987,7 +953,7 @@ data.support = support; // iterator options - data.arrays = data.bottom = data.loop = data.top = ''; + data.array = data.bottom = data.loop = data.top = ''; data.init = 'iterable'; data.useHas = true; data.useKeys = !!keys; @@ -3676,18 +3642,31 @@ */ function difference(array) { var index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, - flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - cache = createCache(flattened), + seen = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), result = []; + var isLarge = length >= largeArraySize && indexOf == basicIndexOf; + + if (isLarge) { + var cache = createCache(seen); + if (cache) { + indexOf = cacheIndexOf; + seen = cache; + } else { + isLarge = false; + } + } while (++index < length) { var value = array[index]; - if (!cache.contains(value)) { + if (indexOf(seen, value) < 0) { result.push(value); } } - cache.release(); + if (isLarge) { + releaseObject(seen); + } return result; } @@ -3991,33 +3970,48 @@ function intersection(array) { var args = arguments, argsLength = args.length, + caches = getArray(), index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, result = []; - var caches = getArray(); - caches[0] = createCache(); + var isLarge = length >= largeArraySize && indexOf == basicIndexOf; + caches[0] = getArray(); + if (isLarge) { + var cache = createCache(caches[0]); + if (cache) { + indexOf = cacheIndexOf; + caches[0] = cache; + } else { + isLarge = false; + } + } outer: while (++index < length) { - var cache = caches[0], + var seen = caches[0], value = array[index]; - if (!cache.contains(value)) { + if (indexOf(seen, value) < 0) { var argsIndex = argsLength; - cache.push(value); + seen.push(value); while (--argsIndex) { - cache = caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex])); - if (!cache.contains(value)) { + seen = isLarge ? (caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]))) : args[argsIndex]; + if (indexOf(seen, value) < 0) { continue outer; } } result.push(value); } } - while (argsLength--) { - caches[argsLength].release(); + seen = isLarge ? caches[0].array : caches[0]; + if (isLarge) { + while (argsLength--) { + releaseObject(caches[argsLength]); + } } + releaseArray(seen); releaseArray(caches); return result; } @@ -4390,17 +4384,28 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = !isSorted && length >= largeArraySize && lodash.indexOf !== indexOf, - result = [], - seen = isLarge ? createCache() : (callback ? getArray() : result); + result = []; + + var isLarge = !isSorted && length >= largeArraySize && indexOf == basicIndexOf, + seen = (callback || isLarge) ? getArray() : result; + if (isLarge) { + var cache = createCache(seen); + if (cache) { + indexOf = cacheIndexOf; + seen = cache; + } else { + isLarge = false; + seen = callback ? seen : (releaseArray(seen), result); + } + } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) + : indexOf(seen, computed) < 0 ) { if (callback || isLarge) { seen.push(computed); @@ -4409,7 +4414,8 @@ } } if (isLarge) { - seen.release(); + releaseArray(seen.array); + releaseObject(seen); } else if (callback) { releaseArray(seen); } From 7dfa3839680a8e1f6a79c8500ea3f62e366d85c0 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 6 Jun 2013 08:43:24 -0700 Subject: [PATCH 100/117] Move some functions out of `runInContext` and cleanup `_.intersection`. Former-commit-id: dfefa6e202b3cd5a7925ddef6ac73dcab5bef8d1 --- lodash.js | 476 +++++++++++++++++++++++++++--------------------------- 1 file changed, 242 insertions(+), 234 deletions(-) diff --git a/lodash.js b/lodash.js index 2362cfb376..bf345287b3 100644 --- a/lodash.js +++ b/lodash.js @@ -146,6 +146,166 @@ '\u2029': 'u2029' }; + /*--------------------------------------------------------------------------*/ + + /** + * A basic implementation of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. + * + * @private + * @param {Array} array The array to search. + * @param {Mixed} value The value to search for. + * @param {Number} [fromIndex=0] The index to search from. + * @returns {Number} Returns the index of the matched value or `-1`. + */ + function basicIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * An implementation of `_.contains` for cache objects that mimics the return + * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. + * + * @private + * @param {Object} cache The cache object to inspect. + * @param {Mixed} value The value to search for. + * @returns {Number} Returns `0` if `value` is found, else `-1`. + */ + function cacheIndexOf(cache, value) { + var type = typeof value; + cache = cache.cache; + + if (type == 'boolean' || value == null) { + return cache[value]; + } + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); + + return type == 'object' + ? (cache[key] && basicIndexOf(cache[key], value) > -1 ? 0 : -1) + : (cache[key] ? 0 : -1); + } + + /** + * Adds a given `value` to the corresponding cache object. + * + * @private + * @param {Mixed} value The value to add to the cache. + */ + function cachePush(value) { + var cache = this.cache, + type = typeof value; + + if (type == 'boolean' || value == null) { + cache[value] = true; + } else { + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value, + typeCache = cache[type] || (cache[type] = {}); + + if (type == 'object') { + if ((typeCache[key] || (typeCache[key] = [])).push(value) === this.array.length) { + cache[type] = false; + } + } else { + typeCache[key] = true; + } + } + } + + /** + * Used by `_.max` and `_.min` as the default `callback` when a given + * `collection` is a string value. + * + * @private + * @param {String} value The character to inspect. + * @returns {Number} Returns the code unit of given character. + */ + function charAtCallback(value) { + return value.charCodeAt(0); + } + + /** + * Used by `sortBy` to compare transformed `collection` values, stable sorting + * them in ascending order. + * + * @private + * @param {Object} a The object to compare to `b`. + * @param {Object} b The object to compare to `a`. + * @returns {Number} Returns the sort order indicator of `1` or `-1`. + */ + function compareAscending(a, b) { + var ai = a.index, + bi = b.index; + + a = a.criteria; + b = b.criteria; + + // ensure a stable sort in V8 and other engines + // http://code.google.com/p/v8/issues/detail?id=90 + if (a !== b) { + if (a > b || typeof a == 'undefined') { + return 1; + } + if (a < b || typeof b == 'undefined') { + return -1; + } + } + return ai < bi ? -1 : 1; + } + + /** + * Creates a cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [array=[]] The array to search. + * @returns {Null|Object} Returns the cache object or `null` if caching should not be used. + */ + function createCache(array) { + var index = -1, + length = array.length; + + var cache = getObject(); + cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; + + var result = getObject(); + result.array = array; + result.cache = cache; + result.push = cachePush; + + while (++index < length) { + result.push(array[index]); + } + return cache.object === false + ? (releaseObject(result), null) + : result; + } + + /** + * Used by `template` to escape characters for inclusion in compiled + * string literals. + * + * @private + * @param {String} match The matched character to escape. + * @returns {String} Returns the escaped character. + */ + function escapeStringChar(match) { + return '\\' + stringEscapes[match]; + } + /** * Gets an array from the array pool or creates a new one if the pool is empty. * @@ -189,6 +349,28 @@ }; } + /** + * Checks if `value` is a DOM node in IE < 9. + * + * @private + * @param {Mixed} value The value to check. + * @returns {Boolean} Returns `true` if the `value` is a DOM node, else `false`. + */ + function isNode(value) { + // IE < 9 presents DOM nodes as `Object` objects except they have `toString` + // methods that are `typeof` "string" and still can coerce nodes to strings + return typeof value.toString != 'function' && typeof (value + '') == 'string'; + } + + /** + * A no-operation function. + * + * @private + */ + function noop() { + // no operation performed + } + /** * Releases the given `array` back to the array pool. * @@ -221,6 +403,34 @@ objectPool.push(object); } + /** + * Slices the `collection` from the `start` index up to, but not including, + * the `end` index. + * + * Note: This function is used, instead of `Array#slice`, to support node lists + * in IE < 9 and to ensure dense arrays are returned. + * + * @private + * @param {Array|Object|String} collection The collection to slice. + * @param {Number} start The start index. + * @param {Number} end The end index. + * @returns {Array} Returns the new array. + */ + function slice(array, start, end) { + start || (start = 0); + if (typeof end == 'undefined') { + end = array ? array.length : 0; + } + var index = -1, + length = end - start || 0, + result = Array(length < 0 ? 0 : length); + + while (++index < length) { + result[index] = array[start + index]; + } + return result; + } + /*--------------------------------------------------------------------------*/ /** @@ -399,6 +609,19 @@ : new lodashWrapper(value); } + /** + * A fast path for creating `lodash` wrapper objects. + * + * @private + * @param {Mixed} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns a `lodash` instance. + */ + function lodashWrapper(value) { + this.__wrapped__ = value; + } + // ensure `new lodashWrapper` is an instance of `lodash` + lodashWrapper.prototype = lodash.prototype; + /** * An object used to flag environments features. * @@ -739,69 +962,6 @@ /*--------------------------------------------------------------------------*/ - /** - * A basic version of `_.indexOf` without support for binary searches - * or `fromIndex` constraints. - * - * @private - * @param {Array} array The array to search. - * @param {Mixed} value The value to search for. - * @param {Number} [fromIndex=0] The index to search from. - * @returns {Number} Returns the index of the matched value or `-1`. - */ - function basicIndexOf(array, value, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Used by `_.max` and `_.min` as the default `callback` when a given - * `collection` is a string value. - * - * @private - * @param {String} value The character to inspect. - * @returns {Number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - - /** - * Used by `sortBy` to compare transformed `collection` values, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {Number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ai = a.index, - bi = b.index; - - a = a.criteria; - b = b.criteria; - - // ensure a stable sort in V8 and other engines - // http://code.google.com/p/v8/issues/detail?id=90 - if (a !== b) { - if (a > b || typeof a == 'undefined') { - return 1; - } - if (a < b || typeof b == 'undefined') { - return -1; - } - } - return ai < bi ? -1 : 1; - } - /** * Creates a function that, when called, invokes `func` with the `this` binding * of `thisArg` and prepends any `partialArgs` to the arguments passed to the @@ -860,77 +1020,6 @@ return bound; } - /** - * Creates a function optimized to search large arrays for a given `value`, - * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. - * - * @private - * @param {Array} [array=[]] The array to search. - * @param {Mixed} value The value to search for. - * @returns {Boolean} Returns `true`, if `value` is found, else `false`. - */ - function createCache(array) { - var index = -1, - length = array.length; - - var cache = getObject(); - cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.push = cachePush; - - while (++index < length) { - result.push(array[index]); - } - return cache.object === false - ? releaseObject(result) - : result; - } - - function cacheIndexOf(cache, value) { - var type = typeof value; - cache = cache.cache; - - if (type == 'boolean' || value == null) { - return cache[value]; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = cache[type] || (cache[type] = {}); - - return type == 'object' - ? (cache[key] && basicIndexOf(cache[key], value) > -1 ? 0 : -1) - : (cache[key] ? 0 : -1); - } - - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value, - typeCache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - if ((typeCache[key] || (typeCache[key] = [])).push(value) === this.array.length) { - cache[type] = false; - } - } else { - typeCache[key] = true; - } - } - } - - /** * Creates compiled iteration functions. * @@ -1018,18 +1107,6 @@ return htmlEscapes[match]; } - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {String} match The matched character to escape. - * @returns {String} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized, this method returns the custom method, otherwise it returns @@ -1043,41 +1120,6 @@ return result; } - /** - * Checks if `value` is a DOM node in IE < 9. - * - * @private - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true` if the `value` is a DOM node, else `false`. - */ - function isNode(value) { - // IE < 9 presents DOM nodes as `Object` objects except they have `toString` - // methods that are `typeof` "string" and still can coerce nodes to strings - return typeof value.toString != 'function' && typeof (value + '') == 'string'; - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {Mixed} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value) { - this.__wrapped__ = value; - } - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - /** - * A no-operation function. - * - * @private - */ - function noop() { - // no operation performed - } - /** * Creates a function that juggles arguments, allowing argument overloading * for `_.flatten` and `_.uniq`, before passing them to the given `func`. @@ -1141,34 +1183,6 @@ return result === undefined || hasOwnProperty.call(value, result); } - /** - * Slices the `collection` from the `start` index up to, but not including, - * the `end` index. - * - * Note: This function is used, instead of `Array#slice`, to support node lists - * in IE < 9 and to ensure dense arrays are returned. - * - * @private - * @param {Array|Object|String} collection The collection to slice. - * @param {Number} start The start index. - * @param {Number} end The end index. - * @returns {Array} Returns the new array. - */ - function slice(array, start, end) { - start || (start = 0); - if (typeof end == 'undefined') { - end = array ? array.length : 0; - } - var index = -1, - length = end - start || 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = array[start + index]; - } - return result; - } - /** * Used by `unescape` to convert HTML entities to characters. * @@ -1485,7 +1499,7 @@ * `undefined`, cloning will be handled by the method instead. The `callback` * is bound to `thisArg` and invoked with one argument; (value). * - * Note: This function is loosely based on the structured clone algorithm. Functions + * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and * objects created by constructors other than `Object` are cloned to plain `Object` objects. * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. @@ -3970,49 +3984,43 @@ function intersection(array) { var args = arguments, argsLength = args.length, + argsIndex = -1, caches = getArray(), index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - result = []; - - var isLarge = length >= largeArraySize && indexOf == basicIndexOf; - caches[0] = getArray(); + result = [], + seen = getArray(); - if (isLarge) { - var cache = createCache(caches[0]); - if (cache) { - indexOf = cacheIndexOf; - caches[0] = cache; - } else { - isLarge = false; - } + while (++argsIndex < argsLength) { + var value = argsIndex ? args[argsIndex] : seen; + caches[argsIndex] = indexOf == basicIndexOf && (value && value.length) >= largeArraySize && createCache(value); } outer: while (++index < length) { - var seen = caches[0], - value = array[index]; + var cache = caches[0]; + value = array[index]; - if (indexOf(seen, value) < 0) { - var argsIndex = argsLength; + if ((cache ? cacheIndexOf : indexOf)(cache || seen, value) < 0) { + argsIndex = argsLength; seen.push(value); while (--argsIndex) { - seen = isLarge ? (caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex]))) : args[argsIndex]; - if (indexOf(seen, value) < 0) { + cache = caches[argsIndex]; + if ((cache ? cacheIndexOf : indexOf)(cache || args[argsIndex], value) < 0) { continue outer; } } result.push(value); } } - seen = isLarge ? caches[0].array : caches[0]; - if (isLarge) { - while (argsLength--) { - releaseObject(caches[argsLength]); + while (argsLength--) { + cache = caches[argsLength]; + if (cache) { + releaseObject(cache); } } - releaseArray(seen); releaseArray(caches); + releaseArray(seen); return result; } @@ -5139,7 +5147,7 @@ } /** - * This function returns the first argument passed to it. + * This method returns the first argument passed to it. * * @static * @memberOf _ From a5d459749ffa69fc889fa53942be8e5c87001387 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 6 Jun 2013 08:44:20 -0700 Subject: [PATCH 101/117] Update dependency maps and remove properties in pre-compile.js that no longer exist. Former-commit-id: d24f0ac4575ab1c2d12f3e8b4bc5f089424407ca --- build.js | 72 +++++++++++++++++++++++++++----------------- build/pre-compile.js | 7 +---- 2 files changed, 46 insertions(+), 33 deletions(-) diff --git a/build.js b/build.js index a7d8726348..10e7aa384a 100755 --- a/build.js +++ b/build.js @@ -96,7 +96,7 @@ 'defaults': ['createIterator', 'isArguments', 'keys'], 'defer': ['bind'], 'delay': [], - 'difference': ['createCache'], + 'difference': ['cacheIndexOf', 'createCache', 'getIndexOf', 'releaseObject'], 'escape': ['escapeHtmlChar'], 'every': ['basicEach', 'createCallback', 'isArray'], 'filter': ['basicEach', 'createCallback', 'isArray'], @@ -114,7 +114,7 @@ 'identity': [], 'indexOf': ['basicIndexOf', 'sortedIndex'], 'initial': ['slice'], - 'intersection': ['createCache', 'getArray', 'releaseArray'], + 'intersection': ['cacheIndexOf', 'createCache', 'getArray', 'getIndexOf', 'releaseArray', 'releaseObject'], 'invert': ['keys'], 'invoke': ['forEach'], 'isArguments': [], @@ -173,7 +173,7 @@ 'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'], 'unescape': ['unescapeHtmlChar'], 'union': ['isArray', 'uniq'], - 'uniq': ['createCache', 'getArray', 'getIndexOf', 'overloadWrapper', 'releaseArray'], + 'uniq': ['cacheIndexOf', 'createCache', 'getArray', 'getIndexOf', 'overloadWrapper', 'releaseArray', 'releaseObject'], 'uniqueId': [], 'unzip': ['max', 'pluck'], 'value': ['basicEach', 'forOwn', 'isArray', 'lodashWrapper'], @@ -187,10 +187,12 @@ // private methods 'basicEach': ['createIterator', 'isArguments', 'isArray', 'isString', 'keys'], 'basicIndexOf': [], + 'cacheIndexOf': ['basicIndexOf'], + 'cachePush': [], 'charAtCallback': [], 'compareAscending': [], 'createBound': ['createObject', 'isFunction', 'isObject'], - 'createCache': ['basicIndexOf', 'getArray', 'getIndexOf', 'getObject', 'releaseObject'], + 'createCache': ['cachePush', 'getObject', 'releaseObject'], 'createIterator': ['getObject', 'iteratorTemplate', 'releaseObject'], 'createObject': [ 'isObject', 'noop'], 'escapeHtmlChar': [], @@ -218,7 +220,7 @@ /** Used to inline `iteratorTemplate` */ var iteratorOptions = [ 'args', - 'arrays', + 'array', 'bottom', 'firstArg', 'init', @@ -334,6 +336,8 @@ var privateMethods = [ 'basicEach', 'basicIndex', + 'cacheIndexOf', + 'cachePush', 'charAtCallback', 'compareAscending', 'createBound', @@ -1077,31 +1081,41 @@ .replace(/,(?=\s*\))/, ''); }); - return removeFromObjectPoolFunctions(source, identifier); + return removeFromGetObject(source, identifier); } /** - * Removes all references to `identifier` from the `objectPool` functions in `source`. + * Removes all references to `identifier` from `getObject` in `source`. * * @private * @param {String} source The source to process. * @param {String} identifier The name of the property to remove. * @returns {String} Returns the modified source. */ - function removeFromObjectPoolFunctions(source, identifier) { - _.each(['getObject', 'releaseObject'], function(methodName) { - source = source.replace(matchFunction(source, methodName), function(match) { - // remove object property assignments - return match - .replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '') - .replace(/,(?=\s*})/, '') - .replace(RegExp("^(?: *\\/\\/.*\\n)* *(\\w+)\\." + identifier + " *= *(.+\\n+)", 'm'), function(match, object, postlude) { - return RegExp('\\b' + object + '\\.').test(postlude) ? postlude : ''; - }); - }); + function removeFromGetObject(source, identifier) { + return source.replace(matchFunction(source, 'getObject'), function(match) { + // remove object property assignments + return match + .replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '') + .replace(/,(?=\s*})/, ''); }); + } - return source; + /** + * Removes all references to `identifier` from `releaseObject` in `source`. + * + * @private + * @param {String} source The source to process. + * @param {String} identifier The name of the property to remove. + * @returns {String} Returns the modified source. + */ + function removeFromReleaseObject(source, identifier) { + return source.replace(matchFunction(source, 'releaseObject'), function(match) { + // remove object property assignments + return match.replace(RegExp("(?:(^ *)| *)(\\w+)\\." + identifier + " *= *(.+\\n+)", 'm'), function(match, indent, object, postlude) { + return (indent || '') + RegExp('\\b' + object + '\\.').test(postlude) ? postlude : ''; + }); + }); } /** @@ -1481,7 +1495,7 @@ // remove `support.unindexedChars` from `iteratorTemplate` source = source.replace(getIteratorTemplate(source), function(match) { return match - .replace(/'if *\(<%= *arrays *%>[^']*/, '$&\\n') + .replace(/'if *\(<%= *array *%>[^']*/, '$&\\n') .replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.unindexedChars[\s\S]+?["']\1<% *} *%>.+/, ''); }); @@ -1999,7 +2013,7 @@ _.each(['difference', 'intersection', 'uniq'], function(methodName) { if (!useLodashMethod(methodName)) { - dependencyMap[methodName] = ['getIndexOf'].concat(_.without(dependencyMap[methodName], 'createCache')); + dependencyMap[methodName] = ['getIndexOf'].concat(_.without(dependencyMap[methodName], 'cacheIndexOf', 'createCache')); } }); @@ -2291,9 +2305,9 @@ }); }); - // replace `arrays` property value of `eachIteratorOptions` with `false` + // replace `array` property value of `eachIteratorOptions` with `false` source = source.replace(/^( *)var eachIteratorOptions *= *[\s\S]+?\n\1};\n/m, function(match) { - return match.replace(/(^ *'arrays':)[^,]+/m, '$1 false'); + return match.replace(/(^ *'array':)[^,]+/m, '$1 false'); }); } } @@ -3033,7 +3047,9 @@ source = removeFunction(source, 'createIterator'); iteratorOptions.forEach(function(prop) { - source = removeFromObjectPoolFunctions(source, prop); + if (prop != 'array') { + source = removeFromGetObject(source, prop); + } }); // inline all functions defined with `createIterator` @@ -3309,9 +3325,11 @@ source = removeVar(source, 'whitespace'); } if (isRemoved(source, 'sortBy')) { - source = removeFromObjectPoolFunctions(source, 'criteria'); - source = removeFromObjectPoolFunctions(source, 'index'); - source = removeFromObjectPoolFunctions(source, 'value'); + _.each([removeFromGetObject, removeFromReleaseObject], function(func) { + source = func(source, 'criteria'); + source = func(source, 'index'); + source = func(source, 'value'); + }); } if (isRemoved(source, 'template')) { // remove `templateSettings` assignment diff --git a/build/pre-compile.js b/build/pre-compile.js index e4bc7e5215..d5ce3c71cf 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -48,7 +48,7 @@ /** Used to minify `iteratorTemplate` data properties */ var iteratorOptions = [ 'args', - 'arrays', + 'array', 'bottom', 'firstArg', 'init', @@ -326,14 +326,9 @@ ]; var props = [ - 'array', 'cache', - 'contains', 'criteria', 'index', - 'indexOf', - 'initedArray', - 'release', 'value' ]; From a46ef8d1a6b78c1fdaef978434c25c5c51489883 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 6 Jun 2013 09:07:14 -0700 Subject: [PATCH 102/117] When chaining, _.max and _.min should resolve the correct value when passed an array containing only one value. [closes #292] Former-commit-id: 79c71c1851a73c23919a28aadd56490ded91166c --- lodash.js | 10 +++++----- test/test.js | 11 +++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lodash.js b/lodash.js index bf345287b3..dd05e0e4cf 100644 --- a/lodash.js +++ b/lodash.js @@ -217,7 +217,7 @@ typeCache = cache[type] || (cache[type] = {}); if (type == 'object') { - if ((typeCache[key] || (typeCache[key] = [])).push(value) === this.array.length) { + if ((typeCache[key] || (typeCache[key] = [])).push(value) == this.array.length) { cache[type] = false; } } else { @@ -3661,7 +3661,7 @@ seen = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), result = []; - var isLarge = length >= largeArraySize && indexOf == basicIndexOf; + var isLarge = length >= largeArraySize && indexOf === basicIndexOf; if (isLarge) { var cache = createCache(seen); @@ -3994,7 +3994,7 @@ while (++argsIndex < argsLength) { var value = argsIndex ? args[argsIndex] : seen; - caches[argsIndex] = indexOf == basicIndexOf && (value && value.length) >= largeArraySize && createCache(value); + caches[argsIndex] = indexOf === basicIndexOf && (value && value.length) >= largeArraySize && createCache(value); } outer: while (++index < length) { @@ -4394,7 +4394,7 @@ length = array ? array.length : 0, result = []; - var isLarge = !isSorted && length >= largeArraySize && indexOf == basicIndexOf, + var isLarge = !isSorted && length >= largeArraySize && indexOf === basicIndexOf, seen = (callback || isLarge) ? getArray() : result; if (isLarge) { @@ -5196,7 +5196,7 @@ push.apply(args, arguments); var result = func.apply(lodash, args); - return (value && typeof value == 'object' && value == result) + return (value && typeof value == 'object' && value === result) ? this : new lodashWrapper(result); }; diff --git a/test/test.js b/test/test.js index f61a5fea04..2dc8116ec8 100644 --- a/test/test.js +++ b/test/test.js @@ -2004,6 +2004,17 @@ /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.max and lodash.min chaining'); + + _.each(['max', 'min'], function(methodName) { + test('lodash.' + methodName + ' should resolve the correct value when passed an array containing only one value', function() { + var actual = _([40])[methodName]().value(); + strictEqual(actual, 40); + }); + }); + + /*--------------------------------------------------------------------------*/ + QUnit.module('lodash.memoize'); (function() { From b928abb95648eea179d347140b5f1e856266f2c4 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 7 Jun 2013 08:24:30 -0700 Subject: [PATCH 103/117] Tweak `_.intersection` to still hit fast paths in engines. Former-commit-id: e8cb944bd6223bb30d58da343c4b5a3f296a4956 --- lodash.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lodash.js b/lodash.js index dd05e0e4cf..a11c7d3a5b 100644 --- a/lodash.js +++ b/lodash.js @@ -3993,20 +3993,22 @@ seen = getArray(); while (++argsIndex < argsLength) { - var value = argsIndex ? args[argsIndex] : seen; - caches[argsIndex] = indexOf === basicIndexOf && (value && value.length) >= largeArraySize && createCache(value); + var value = args[argsIndex]; + caches[argsIndex] = indexOf === basicIndexOf && + (value ? value.length : 0) >= largeArraySize && + createCache(argsIndex ? args[argsIndex] : seen); } outer: while (++index < length) { var cache = caches[0]; value = array[index]; - if ((cache ? cacheIndexOf : indexOf)(cache || seen, value) < 0) { + if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { argsIndex = argsLength; - seen.push(value); + (cache || seen).push(value); while (--argsIndex) { cache = caches[argsIndex]; - if ((cache ? cacheIndexOf : indexOf)(cache || args[argsIndex], value) < 0) { + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { continue outer; } } From d77e4ed581191eb512512ecece5b4d649a6b31af Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 7 Jun 2013 08:39:08 -0700 Subject: [PATCH 104/117] Rebuild files and docs. Former-commit-id: 1e3b1e236e15e4248247a4b20288ab2e153ce753 --- dist/lodash.compat.js | 572 +++++++++++++++++----------------- dist/lodash.compat.min.js | 89 +++--- dist/lodash.js | 531 ++++++++++++++++--------------- dist/lodash.min.js | 80 ++--- dist/lodash.underscore.js | 174 ++++++----- dist/lodash.underscore.min.js | 52 ++-- doc/README.md | 254 +++++++-------- 7 files changed, 894 insertions(+), 858 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 3f39222de1..5dbb115d76 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -147,6 +147,166 @@ '\u2029': 'u2029' }; + /*--------------------------------------------------------------------------*/ + + /** + * A basic implementation of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. + * + * @private + * @param {Array} array The array to search. + * @param {Mixed} value The value to search for. + * @param {Number} [fromIndex=0] The index to search from. + * @returns {Number} Returns the index of the matched value or `-1`. + */ + function basicIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * An implementation of `_.contains` for cache objects that mimics the return + * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. + * + * @private + * @param {Object} cache The cache object to inspect. + * @param {Mixed} value The value to search for. + * @returns {Number} Returns `0` if `value` is found, else `-1`. + */ + function cacheIndexOf(cache, value) { + var type = typeof value; + cache = cache.cache; + + if (type == 'boolean' || value == null) { + return cache[value]; + } + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); + + return type == 'object' + ? (cache[key] && basicIndexOf(cache[key], value) > -1 ? 0 : -1) + : (cache[key] ? 0 : -1); + } + + /** + * Adds a given `value` to the corresponding cache object. + * + * @private + * @param {Mixed} value The value to add to the cache. + */ + function cachePush(value) { + var cache = this.cache, + type = typeof value; + + if (type == 'boolean' || value == null) { + cache[value] = true; + } else { + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value, + typeCache = cache[type] || (cache[type] = {}); + + if (type == 'object') { + if ((typeCache[key] || (typeCache[key] = [])).push(value) == this.array.length) { + cache[type] = false; + } + } else { + typeCache[key] = true; + } + } + } + + /** + * Used by `_.max` and `_.min` as the default `callback` when a given + * `collection` is a string value. + * + * @private + * @param {String} value The character to inspect. + * @returns {Number} Returns the code unit of given character. + */ + function charAtCallback(value) { + return value.charCodeAt(0); + } + + /** + * Used by `sortBy` to compare transformed `collection` values, stable sorting + * them in ascending order. + * + * @private + * @param {Object} a The object to compare to `b`. + * @param {Object} b The object to compare to `a`. + * @returns {Number} Returns the sort order indicator of `1` or `-1`. + */ + function compareAscending(a, b) { + var ai = a.index, + bi = b.index; + + a = a.criteria; + b = b.criteria; + + // ensure a stable sort in V8 and other engines + // http://code.google.com/p/v8/issues/detail?id=90 + if (a !== b) { + if (a > b || typeof a == 'undefined') { + return 1; + } + if (a < b || typeof b == 'undefined') { + return -1; + } + } + return ai < bi ? -1 : 1; + } + + /** + * Creates a cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [array=[]] The array to search. + * @returns {Null|Object} Returns the cache object or `null` if caching should not be used. + */ + function createCache(array) { + var index = -1, + length = array.length; + + var cache = getObject(); + cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; + + var result = getObject(); + result.array = array; + result.cache = cache; + result.push = cachePush; + + while (++index < length) { + result.push(array[index]); + } + return cache.object === false + ? (releaseObject(result), null) + : result; + } + + /** + * Used by `template` to escape characters for inclusion in compiled + * string literals. + * + * @private + * @param {String} match The matched character to escape. + * @returns {String} Returns the escaped character. + */ + function escapeStringChar(match) { + return '\\' + stringEscapes[match]; + } + /** * Gets an array from the array pool or creates a new one if the pool is empty. * @@ -167,23 +327,17 @@ return objectPool.pop() || { 'args': null, 'array': null, - 'arrays': null, 'bottom': null, - 'contains': null, 'criteria': null, 'false': null, 'firstArg': null, - 'function': null, 'index': null, - 'indexOf': null, 'init': null, - 'initedArray': null, 'loop': null, 'null': null, 'number': null, 'object': null, 'push': null, - 'release': null, 'shadowedProps': null, 'string': null, 'top': null, @@ -195,6 +349,28 @@ }; } + /** + * Checks if `value` is a DOM node in IE < 9. + * + * @private + * @param {Mixed} value The value to check. + * @returns {Boolean} Returns `true` if the `value` is a DOM node, else `false`. + */ + function isNode(value) { + // IE < 9 presents DOM nodes as `Object` objects except they have `toString` + // methods that are `typeof` "string" and still can coerce nodes to strings + return typeof value.toString != 'function' && typeof (value + '') == 'string'; + } + + /** + * A no-operation function. + * + * @private + */ + function noop() { + // no operation performed + } + /** * Releases the given `array` back to the array pool. * @@ -216,6 +392,10 @@ * @param {Object} [object] The object to release. */ function releaseObject(object) { + var cache = object.cache; + if (cache) { + releaseObject(cache); + } if (objectPool.length == maxPoolSize) { objectPool.length = maxPoolSize - 1; } @@ -223,6 +403,34 @@ objectPool.push(object); } + /** + * Slices the `collection` from the `start` index up to, but not including, + * the `end` index. + * + * Note: This function is used, instead of `Array#slice`, to support node lists + * in IE < 9 and to ensure dense arrays are returned. + * + * @private + * @param {Array|Object|String} collection The collection to slice. + * @param {Number} start The start index. + * @param {Number} end The end index. + * @returns {Array} Returns the new array. + */ + function slice(array, start, end) { + start || (start = 0); + if (typeof end == 'undefined') { + end = array ? array.length : 0; + } + var index = -1, + length = end - start || 0, + result = Array(length < 0 ? 0 : length); + + while (++index < length) { + result[index] = array[start + index]; + } + return result; + } + /*--------------------------------------------------------------------------*/ /** @@ -401,6 +609,19 @@ : new lodashWrapper(value); } + /** + * A fast path for creating `lodash` wrapper objects. + * + * @private + * @param {Mixed} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns a `lodash` instance. + */ + function lodashWrapper(value) { + this.__wrapped__ = value; + } + // ensure `new lodashWrapper` is an instance of `lodash` + lodashWrapper.prototype = lodash.prototype; + /** * An object used to flag environments features. * @@ -612,9 +833,9 @@ ';\nif (!iterable) return result;\n' + (obj.top) + ';'; - if (obj.arrays) { + if (obj.array) { __p += '\nvar length = iterable.length; index = -1;\nif (' + - (obj.arrays) + + (obj.array) + ') { '; if (support.unindexedChars) { __p += '\n if (isString(iterable)) {\n iterable = iterable.split(\'\')\n } '; @@ -684,7 +905,7 @@ } - if (obj.arrays || support.nonEnumArgs) { + if (obj.array || support.nonEnumArgs) { __p += '\n}'; } __p += @@ -712,81 +933,18 @@ var eachIteratorOptions = { 'args': 'collection, callback, thisArg', 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : lodash.createCallback(callback, thisArg)", - 'arrays': "typeof length == 'number'", + 'array': "typeof length == 'number'", 'loop': 'if (callback(iterable[index], index, collection) === false) return result' }; /** Reusable iterator options for `forIn` and `forOwn` */ var forOwnIteratorOptions = { 'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top, - 'arrays': false + 'array': false }; /*--------------------------------------------------------------------------*/ - /** - * A basic version of `_.indexOf` without support for binary searches - * or `fromIndex` constraints. - * - * @private - * @param {Array} array The array to search. - * @param {Mixed} value The value to search for. - * @param {Number} [fromIndex=0] The index to search from. - * @returns {Number} Returns the index of the matched value or `-1`. - */ - function basicIndexOf(array, value, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Used by `_.max` and `_.min` as the default `callback` when a given - * `collection` is a string value. - * - * @private - * @param {String} value The character to inspect. - * @returns {Number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - - /** - * Used by `sortBy` to compare transformed `collection` values, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {Number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ai = a.index, - bi = b.index; - - a = a.criteria; - b = b.criteria; - - // ensure a stable sort in V8 and other engines - // http://code.google.com/p/v8/issues/detail?id=90 - if (a !== b) { - if (a > b || typeof a == 'undefined') { - return 1; - } - if (a < b || typeof b == 'undefined') { - return -1; - } - } - return ai < bi ? -1 : 1; - } - /** * Creates a function that, when called, invokes `func` with the `this` binding * of `thisArg` and prepends any `partialArgs` to the arguments passed to the @@ -845,115 +1003,12 @@ return bound; } - /** - * Creates a function optimized to search large arrays for a given `value`, - * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. - * - * @private - * @param {Array} [array=[]] The array to search. - * @param {Mixed} value The value to search for. - * @returns {Boolean} Returns `true`, if `value` is found, else `false`. - */ - var createCache = (function() { - - function basicContains(value) { - return this.indexOf(this.array, value) > -1; - } - - function basicPush(value) { - this.array.push(value); - } - - function cacheContains(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - return cache[value]; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = cache[type] || (cache[type] = {}); - - return type == 'object' - ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) - : !!cache[key]; - } - - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - bailout = (cache[key] || (cache[key] = [])).push(value) == length; - } else { - cache[key] = true; - } - } - } - - function release() { - var cache = this.cache; - if (cache.initedArray) { - releaseArray(this.array); - } - releaseObject(cache); - } - - return function(array) { - var bailout, - index = -1, - indexOf = getIndexOf(), - initedArray = !array && (array = getArray()), - length = array.length, - isLarge = length >= largeArraySize && lodash.indexOf !== indexOf; - - var cache = getObject(); - cache.initedArray = initedArray; - cache['false'] = cache['function'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.contains = cacheContains; - result.indexOf = indexOf; - result.push = cachePush; - result.release = release; - - if (isLarge) { - while (++index < length) { - result.push(array[index]); - } - if (bailout) { - isLarge = false; - result.release(); - } - } - if (!isLarge) { - result.contains = basicContains; - result.push = basicPush; - } - return result; - }; - }()); - /** * Creates compiled iteration functions. * * @private * @param {Object} [options1, options2, ...] The compile options object(s). - * arrays - A string of code to determine if the iterable is an array or array-like. + * array - A string of code to determine if the iterable is an array or array-like. * useHas - A boolean to specify using `hasOwnProperty` checks in the object loop. * useKeys - A boolean to specify using `_.keys` for own property iteration. * args - A string of comma separated arguments the iteration function will accept. @@ -968,7 +1023,7 @@ // data properties data.shadowedProps = shadowedProps; // iterator options - data.arrays = data.bottom = data.loop = data.top = ''; + data.array = data.bottom = data.loop = data.top = ''; data.init = 'iterable'; data.useHas = true; data.useKeys = !!keys; @@ -1033,18 +1088,6 @@ return htmlEscapes[match]; } - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {String} match The matched character to escape. - * @returns {String} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized, this method returns the custom method, otherwise it returns @@ -1058,41 +1101,6 @@ return result; } - /** - * Checks if `value` is a DOM node in IE < 9. - * - * @private - * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true` if the `value` is a DOM node, else `false`. - */ - function isNode(value) { - // IE < 9 presents DOM nodes as `Object` objects except they have `toString` - // methods that are `typeof` "string" and still can coerce nodes to strings - return typeof value.toString != 'function' && typeof (value + '') == 'string'; - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {Mixed} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value) { - this.__wrapped__ = value; - } - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - /** - * A no-operation function. - * - * @private - */ - function noop() { - // no operation performed - } - /** * Creates a function that juggles arguments, allowing argument overloading * for `_.flatten` and `_.uniq`, before passing them to the given `func`. @@ -1156,34 +1164,6 @@ return result === undefined || hasOwnProperty.call(value, result); } - /** - * Slices the `collection` from the `start` index up to, but not including, - * the `end` index. - * - * Note: This function is used, instead of `Array#slice`, to support node lists - * in IE < 9 and to ensure dense arrays are returned. - * - * @private - * @param {Array|Object|String} collection The collection to slice. - * @param {Number} start The start index. - * @param {Number} end The end index. - * @returns {Array} Returns the new array. - */ - function slice(array, start, end) { - start || (start = 0); - if (typeof end == 'undefined') { - end = array ? array.length : 0; - } - var index = -1, - length = end - start || 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = array[start + index]; - } - return result; - } - /** * Used by `unescape` to convert HTML entities to characters. * @@ -1500,7 +1480,7 @@ * `undefined`, cloning will be handled by the method instead. The `callback` * is bound to `thisArg` and invoked with one argument; (value). * - * Note: This function is loosely based on the structured clone algorithm. Functions + * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and * objects created by constructors other than `Object` are cloned to plain `Object` objects. * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. @@ -3657,18 +3637,31 @@ */ function difference(array) { var index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, - flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - cache = createCache(flattened), + seen = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), result = []; + var isLarge = length >= largeArraySize && indexOf === basicIndexOf; + + if (isLarge) { + var cache = createCache(seen); + if (cache) { + indexOf = cacheIndexOf; + seen = cache; + } else { + isLarge = false; + } + } while (++index < length) { var value = array[index]; - if (!cache.contains(value)) { + if (indexOf(seen, value) < 0) { result.push(value); } } - cache.release(); + if (isLarge) { + releaseObject(seen); + } return result; } @@ -3972,24 +3965,31 @@ function intersection(array) { var args = arguments, argsLength = args.length, + argsIndex = -1, + caches = getArray(), index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, - result = []; - - var caches = getArray(); - caches[0] = createCache(); + result = [], + seen = getArray(); + while (++argsIndex < argsLength) { + var value = args[argsIndex]; + caches[argsIndex] = indexOf === basicIndexOf && + (value ? value.length : 0) >= largeArraySize && + createCache(argsIndex ? args[argsIndex] : seen); + } outer: while (++index < length) { - var cache = caches[0], - value = array[index]; + var cache = caches[0]; + value = array[index]; - if (!cache.contains(value)) { - var argsIndex = argsLength; - cache.push(value); + if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { + argsIndex = argsLength; + (cache || seen).push(value); while (--argsIndex) { - cache = caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex])); - if (!cache.contains(value)) { + cache = caches[argsIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { continue outer; } } @@ -3997,9 +3997,13 @@ } } while (argsLength--) { - caches[argsLength].release(); + cache = caches[argsLength]; + if (cache) { + releaseObject(cache); + } } releaseArray(caches); + releaseArray(seen); return result; } @@ -4371,17 +4375,28 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = !isSorted && length >= largeArraySize && lodash.indexOf !== indexOf, - result = [], - seen = isLarge ? createCache() : (callback ? getArray() : result); + result = []; + var isLarge = !isSorted && length >= largeArraySize && indexOf === basicIndexOf, + seen = (callback || isLarge) ? getArray() : result; + + if (isLarge) { + var cache = createCache(seen); + if (cache) { + indexOf = cacheIndexOf; + seen = cache; + } else { + isLarge = false; + seen = callback ? seen : (releaseArray(seen), result); + } + } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) + : indexOf(seen, computed) < 0 ) { if (callback || isLarge) { seen.push(computed); @@ -4390,7 +4405,8 @@ } } if (isLarge) { - seen.release(); + releaseArray(seen.array); + releaseObject(seen); } else if (callback) { releaseArray(seen); } @@ -5114,7 +5130,7 @@ } /** - * This function returns the first argument passed to it. + * This method returns the first argument passed to it. * * @static * @memberOf _ @@ -5163,7 +5179,7 @@ push.apply(args, arguments); var result = func.apply(lodash, args); - return (value && typeof value == 'object' && value == result) + return (value && typeof value == 'object' && value === result) ? this : new lodashWrapper(result); }; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index c6a7d5f263..895eb593f1 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,47 +4,48 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(){return g.pop()||[]}function r(){return h.pop()||{a:l,k:l,b:l,c:l,m:l,n:l,"false":l,d:l,"function":l,o:l,p:l,e:l,q:l,f:l,"null":l,number:l,object:l,push:l,r:l,g:l,string:l,h:l,"true":l,undefined:l,i:l,j:l,s:l}}function e(n){g.length==b&&(g.length=b-1),n.length=0,g.push(n)}function u(n){h.length==b&&(h.length=b-1),n.k=n.l=n.n=n.object=n.t=n.u=n.s=l,h.push(n)}function o(f){function s(n){return n&&typeof n=="object"&&!Fr(n)&&fr.call(n,"__wrapped__")?n:new et(n)}function g(n,t,r){r=(r||0)-1; -for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nk;k++)o+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(o+="||(!v[m]&&r[m]!==y[m])"),o+="){"+n.f+"}"; -o+="}"}return(n.b||Br.nonEnumArgs)&&(o+="}"),o+=n.c+";return C",t=t("i,j,l,n,o,q,t,u,y,z,w,G,H,J",e+o+"}"),u(n),t(T,Zt,fr,ct,Fr,yt,Dr,s,nr,U,Ir,K,tr,vr)}function Y(n){return vt(n)?yr(n):{}}function Z(n){return Tr[n]}function nt(n){return"\\"+V[n]}function tt(){var n=(n=s.indexOf)===Nt?g:n;return n}function rt(n){return typeof n.toString!="function"&&typeof(n+"")=="string"}function et(n){this.__wrapped__=n}function ut(){}function ot(n){return function(t,r,e,u){return typeof r!="boolean"&&r!=l&&(u=e,e=u&&u[r]===t?a:r,r=c),e!=l&&(e=s.createCallback(e,u)),n(t,r,e,u) -}}function at(n){var t,r;return!n||vr.call(n)!=H||(t=n.constructor,ht(t)&&!(t instanceof t))||!Br.argsClass&&ct(n)||!Br.nodeClass&&rt(n)?c:Br.ownLast?(Jr(n,function(n,t,e){return r=fr.call(e,t),c}),r!==false):(Jr(n,function(n,t){r=t}),r===a||fr.call(n,r))}function it(n,t,r){t||(t=0),typeof r=="undefined"&&(r=n?n.length:0);var e=-1;r=r-t||0;for(var u=Gt(0>r?0:r);++er?jr(0,o+r):r)||0,o&&typeof o=="number"?a=-1<(yt(n)?n.indexOf(t,r):u(n,t,r)):Rr(n,function(n){return++eu&&(u=a)}}else t=!t&&yt(n)?h:s.createCallback(t,r),Rr(n,function(n,r,o){r=t(n,r,o),r>e&&(e=r,u=n)});return u}function Et(n,t,r,e){var u=3>arguments.length;if(t=s.createCallback(t,e,4),Fr(n)){var o=-1,a=n.length;for(u&&(r=n[++o]);++oarguments.length;if(typeof o!="number")var i=Dr(n),o=i.length;else Br.unindexedChars&&yt(n)&&(u=n.split(""));return t=s.createCallback(t,e,4),wt(n,function(n,e,l){e=i?i[--o]:--o,r=a?(a=c,u[e]):t(r,u[e],e,l)}),r}function At(n,t,r){var e;if(t=s.createCallback(t,r),Fr(n)){r=-1;for(var u=n.length;++rr?jr(0,e+r):r||0}else if(r)return r=qt(n,t),n[r]===t?r:-1;return n?g(n,t,r):-1}function Pt(n,t,r){if(typeof t!="number"&&t!=l){var e=0,u=-1,o=n?n.length:0;for(t=s.createCallback(t,r);++u>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:E,variable:"",imports:{_:s}}; -var Nr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b=d&&s.p!==i,v=r();if(v.q=l,v["false"]=v["function"]=v["null"]=v["true"]=v.undefined=c,l=r(),l.k=e,l.l=v,l.m=a,l.p=i,l.push=f,l.r=p,h)for(;++u":">",'"':""","'":"'"},Lr=st(Tr),Gr=X(Nr,{h:Nr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Hr=X(Nr),Jr=X(Pr,qr,{i:c}),Kr=X(Pr,qr); -ht(/x/)&&(ht=function(n){return typeof n=="function"&&vr.call(n)==L});var Mr=cr?function(n){if(!n||vr.call(n)!=H||!Br.argsClass&&ct(n))return c;var t=n.valueOf,r=typeof t=="function"&&(r=cr(t))&&cr(r);return r?n==r||cr(n)==r:at(n)}:at,Ur=xt,Vr=ot(function Xr(n,t,r){for(var e=-1,u=n?n.length:0,o=[];++e=d&&s.p!==a,c=[],f=l?zr():u?t():c;++on?t():function(){return 1>--n?t.apply(this,arguments):void 0}},s.assign=Gr,s.at=function(n){var t=-1,r=ar.apply(Yt,Or.call(arguments,1)),e=r.length,u=Gt(e);for(Br.unindexedChars&&yt(n)&&(n=n.split(""));++t++f&&(o=n.apply(a,u)),p=hr(e,t),o}},s.defaults=Hr,s.defer=Dt,s.delay=function(n,t){var r=Or.call(arguments,2);return hr(function(){n.apply(a,r)},t)},s.difference=It,s.filter=jt,s.flatten=Vr,s.forEach=wt,s.forIn=Jr,s.forOwn=Kr,s.functions=pt,s.groupBy=function(n,t,r){var e={};return t=s.createCallback(t,r),wt(n,function(n,r,u){r=Qt(t(n,r,u)),(fr.call(e,r)?e[r]:e[r]=[]).push(n)}),e},s.initial=function(n,t,r){if(!n)return[]; -var e=0,u=n.length;if(typeof t!="number"&&t!=l){var o=u;for(t=s.createCallback(t,r);o--&&t(n[o],o,n);)e++}else e=t==l||r?1:t||e;return it(n,0,kr(jr(0,u-e),u))},s.intersection=function(n){var r=arguments,u=r.length,o=-1,a=n?n.length:0,i=[],l=t();l[0]=zr();n:for(;++oe(a,r))&&(o[r]=n)}),o},s.once=function(n){var t,r;return function(){return t?r:(t=i,r=n.apply(this,arguments),n=l,r)}},s.pairs=function(n){for(var t=-1,r=Dr(n),e=r.length,u=Gt(e);++tr?jr(0,e+r):kr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},s.mixin=Tt,s.noConflict=function(){return f._=rr,this},s.parseInt=Qr,s.random=function(n,t){n==l&&t==l&&(t=1),n=+n||0,t==l?(t=n,n=0):t=+t||0;var r=xr();return n%1||t%1?n+kr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+ir(r*(t-n+1))},s.reduce=Et,s.reduceRight=St,s.result=function(n,t){var r=n?n[t]:a;return ht(r)?n[t]():r},s.runInContext=o,s.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Dr(n).length -},s.some=At,s.sortedIndex=qt,s.template=function(n,t,r){var e=s.templateSettings;n||(n=""),r=Hr({},r,e);var u,o=Hr({},r.imports,e.imports),e=Dr(o),o=bt(o),l=0,c=r.interpolate||B,f="__p+='",c=Wt((r.escape||B).source+"|"+c.source+"|"+(c===E?x:B).source+"|"+(r.evaluate||B).source+"|$","g");n.replace(c,function(t,r,e,o,a,c){return e||(e=o),f+=n.slice(l,c).replace(P,nt),r&&(f+="'+__e("+r+")+'"),a&&(u=i,f+="';"+a+";__p+='"),e&&(f+="'+((__t=("+e+"))==null?'':__t)+'"),l=c+t.length,t}),f+="';\n",c=r=r.variable,c||(r="obj",f="with("+r+"){"+f+"}"),f=(u?f.replace(_,""):f).replace(C,"$1").replace(j,"$1;"),f="function("+r+"){"+(c?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+f+"return __p}"; -try{var p=Kt(e,"return "+f).apply(a,o)}catch(g){throw g.source=f,g}return t?p(t):(p.source=f,p)},s.unescape=function(n){return n==l?"":Qt(n).replace(w,lt)},s.uniqueId=function(n){var t=++v;return Qt(n==l?"":n)+t},s.all=Ct,s.any=At,s.detect=kt,s.findWhere=kt,s.foldl=Et,s.foldr=St,s.include=_t,s.inject=Et,Kr(s,function(n,t){s.prototype[t]||(s.prototype[t]=function(){var t=[this.__wrapped__];return pr.apply(t,arguments),n.apply(s,t)})}),s.first=Bt,s.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=l){var o=u; -for(t=s.createCallback(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==l||r)return n[u-1];return it(n,jr(0,u-e))}},s.take=Bt,s.head=Bt,Kr(s,function(n,t){s.prototype[t]||(s.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==l||r&&typeof t!="function"?e:new et(e)})}),s.VERSION="1.2.1",s.prototype.toString=function(){return Qt(this.__wrapped__)},s.prototype.value=Lt,s.prototype.valueOf=Lt,Rr(["join","pop","shift"],function(n){var t=Yt[n];s.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),Rr(["push","reverse","sort","unshift"],function(n){var t=Yt[n];s.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Rr(["concat","slice","splice"],function(n){var t=Yt[n];s.prototype[n]=function(){return new et(t.apply(this.__wrapped__,arguments))}}),Br.spliceObjects||Rr(["pop","shift","splice"],function(n){var t=Yt[n],r="splice"==n;s.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new et(e):e}}),s}var a,i=!0,l=null,c=!1,f=typeof exports=="object"&&exports,p=typeof module=="object"&&module&&module.exports==f&&module,s=typeof global=="object"&&global; -(s.global===s||s.window===s)&&(n=s);var g=[],h=[],v=0,m={},y=+new Date+"",d=75,b=10,_=/\b__p\+='';/g,C=/\b(__p\+=)''\+/g,j=/(__e\(.*?\)|\b__t\))\+'';/g,w=/&(?:amp|lt|gt|quot|#39);/g,x=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,O=/\w*$/,E=/<%=([\s\S]+?)%>/g,S=(S=/\bthis\b/)&&S.test(o)&&S,A=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",I=RegExp("^["+A+"]*0+(?=.$)"),B=/($^)/,N=/[&<>"']/g,P=/['\n\r\t\u2028\u2029\\]/g,q="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),z="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),F="[object Arguments]",$="[object Array]",D="[object Boolean]",R="[object Date]",T="[object Error]",L="[object Function]",G="[object Number]",H="[object Object]",J="[object RegExp]",K="[object String]",M={}; -M[L]=c,M[F]=M[$]=M[D]=M[R]=M[G]=M[H]=M[J]=M[K]=i;var U={"boolean":c,"function":i,object:i,number:c,string:c,undefined:c},V={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},W=o();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=W, define(function(){return W})):f&&!f.nodeType?p?(p.exports=W)._=W:f._=W:n._=W}(this); \ No newline at end of file +;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nr?0:r);++ek;k++)e+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+n.f+"}"; +e+="}"}return(n.b||Nr.nonEnumArgs)&&(e+="}"),e+=n.c+";return C",t=t("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}"),g(n),t(Q,nr,pr,ft,$r,dt,Dr,_,tr,et,Br,tt,rr,yr)}function I(n){return yt(n)?dr(n):{}}function ut(n){return Tr[n]}function ot(){var n=(n=_.indexOf)===Pt?t:n;return n}function it(n){return function(t,r,e,u){return typeof r!="boolean"&&r!=d&&(u=e,e=u&&u[r]===t?y:r,r=b),e!=d&&(e=_.createCallback(e,u)),n(t,r,e,u)}}function lt(n){var t,r;return!n||yr.call(n)!=Z||(t=n.constructor,ht(t)&&!(t instanceof t))||!Nr.argsClass&&ft(n)||!Nr.nodeClass&&f(n)?b:Nr.ownLast?(Jr(n,function(n,t,e){return r=pr.call(e,t),b +}),r!==false):(Jr(n,function(n,t){r=t}),r===y||pr.call(n,r))}function ct(n){return Lr[n]}function ft(n){return yr.call(n)==M}function pt(n,t,r,e,u,a){var o=n;if(typeof t!="boolean"&&t!=d&&(e=r,r=t,t=b),typeof r=="function"){if(r=typeof e=="undefined"?r:_.createCallback(r,e,1),o=r(o),typeof o!="undefined")return o;o=n}if(e=yt(o)){var i=yr.call(o);if(!rt[i]||!Nr.nodeClass&&f(o))return o;var c=$r(o)}if(!e||!t)return e?c?v(o):Gr({},o):o;switch(e=Ir[i],i){case V:case W:return new e(+o);case Y:case tt:return new e(o); +case nt:return e(o.source,$.exec(o))}i=!u,u||(u=l()),a||(a=l());for(var p=u.length;p--;)if(u[p]==n)return a[p];return o=c?e(o.length):{},c&&(pr.call(n,"index")&&(o.index=n.index),pr.call(n,"input")&&(o.input=n.input)),u.push(n),a.push(o),(c?Rr:Kr)(n,function(n,e){o[e]=pt(n,t,r,y,u,a)}),i&&(s(u),s(a)),o}function st(n){var t=[];return Jr(n,function(n,r){ht(n)&&t.push(r)}),t.sort()}function gt(n){for(var t=-1,r=Dr(n),e=r.length,u={};++tr?wr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(dt(n)?n.indexOf(t,r):u(n,t,r)):Rr(n,function(n){return++ea&&(a=i)}}else t=!t&&dt(n)?u:_.createCallback(t,r),Rr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function St(n,t,r,e){var u=3>arguments.length;if(t=_.createCallback(t,e,4),$r(n)){var a=-1,o=n.length;for(u&&(r=n[++a]);++aarguments.length;if(typeof a!="number")var i=Dr(n),a=i.length;else Nr.unindexedChars&&dt(n)&&(u=n.split(""));return t=_.createCallback(t,e,4),xt(n,function(n,e,l){e=i?i[--a]:--a,r=o?(o=b,u[e]):t(r,u[e],e,l) +}),r}function It(n,t,r){var e;if(t=_.createCallback(t,r),$r(n)){r=-1;for(var u=n.length;++r=A&&u===t;if(c){var f=o(i);f?(u=r,i=f):c=b}for(;++eu(i,f)&&l.push(f);return c&&g(i),l}function Nt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=-1;for(t=_.createCallback(t,r);++ae?wr(0,u+e):e||0}else if(e)return e=Ft(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function zt(n,t,r){if(typeof t!="number"&&t!=d){var e=0,u=-1,a=n?n.length:0;for(t=_.createCallback(t,r);++u>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:q,variable:"",imports:{_:_}};var Pr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Lr=gt(Tr),Gr=x(Pr,{h:Pr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Hr=x(Pr),Jr=x(zr,Fr,{i:b}),Kr=x(zr,Fr); +ht(/x/)&&(ht=function(n){return typeof n=="function"&&yr.call(n)==X});var Mr=fr?function(n){if(!n||yr.call(n)!=Z||!Nr.argsClass&&ft(n))return b;var t=n.valueOf,r=typeof t=="function"&&(r=fr(t))&&fr(r);return r?n==r||fr(n)==r:lt(n)}:lt,Ur=Ot,Vr=it(function Xr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e=A&&i===t,v=u||p?l():f;if(p){var h=o(v);h?(i=r,v=h):(p=b,v=u?v:(s(v),f)) +}for(;++ai(v,y))&&((u||p)&&v.push(y),f.push(h))}return p?(s(v.o),g(v)):u&&s(v),f});Ar&&C&&typeof vr=="function"&&(Rt=Dt(vr,e));var Qr=8==xr(R+"08")?xr:function(n,t){return xr(dt(n)?n.replace(T,""):n,t||0)};return _.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},_.assign=Gr,_.at=function(n){var t=-1,r=ir.apply(Zt,Er.call(arguments,1)),e=r.length,u=Ht(e);for(Nr.unindexedChars&&dt(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),l=hr(e,t),a}},_.defaults=Hr,_.defer=Rt,_.delay=function(n,t){var r=Er.call(arguments,2);return hr(function(){n.apply(y,r)},t)},_.difference=Bt,_.filter=wt,_.flatten=Vr,_.forEach=xt,_.forIn=Jr,_.forOwn=Kr,_.functions=st,_.groupBy=function(n,t,r){var e={};return t=_.createCallback(t,r),xt(n,function(n,r,u){r=Xt(t(n,r,u)),(pr.call(e,r)?e[r]:e[r]=[]).push(n) +}),e},_.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++}else e=t==d||r?1:t||e;return v(n,0,kr(wr(0,u-e),u))},_.intersection=function(n){for(var e=arguments,u=e.length,a=-1,i=l(),c=-1,f=ot(),p=n?n.length:0,v=[],h=l();++a=A&&o(a?e[a]:h)}n:for(;++c(m?r(m,y):f(h,y))){for(a=u,(m||h).push(y);--a;)if(m=i[a],0>(m?r(m,y):f(e[a],y)))continue n; +v.push(y)}}for(;u--;)(m=i[u])&&g(m);return s(i),s(h),v},_.invert=gt,_.invoke=function(n,t){var r=Er.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Ht(typeof a=="number"?a:0);return xt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},_.keys=Dr,_.map=Ot,_.max=Et,_.memoize=function(n,t){function r(){var e=r.cache,u=S+(t?t.apply(this,arguments):arguments[0]);return pr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},_.merge=bt,_.min=function(n,t,r){var e=1/0,a=e;if(!t&&$r(n)){r=-1; +for(var o=n.length;++re(o,r))&&(a[r]=n)}),a},_.once=function(n){var t,r;return function(){return t?r:(t=m,r=n.apply(this,arguments),n=d,r)}},_.pairs=function(n){for(var t=-1,r=Dr(n),e=r.length,u=Ht(e);++tr?wr(0,e+r):kr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},_.mixin=Lt,_.noConflict=function(){return e._=er,this},_.parseInt=Qr,_.random=function(n,t){n==d&&t==d&&(t=1),n=+n||0,t==d?(t=n,n=0):t=+t||0; +var r=Or();return n%1||t%1?n+kr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+lr(r*(t-n+1))},_.reduce=St,_.reduceRight=At,_.result=function(n,t){var r=n?n[t]:y;return ht(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Dr(n).length},_.some=It,_.sortedIndex=Ft,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Hr({},r,e);var u,a=Hr({},r.imports,e.imports),e=Dr(a),a=_t(a),o=0,l=r.interpolate||L,c="__p+='",l=Qt((r.escape||L).source+"|"+l.source+"|"+(l===q?F:L).source+"|"+(r.evaluate||L).source+"|$","g"); +n.replace(l,function(t,r,e,a,l,f){return e||(e=a),c+=n.slice(o,f).replace(H,i),r&&(c+="'+__e("+r+")+'"),l&&(u=m,c+="';"+l+";__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),c+="';\n",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(u?c.replace(B,""):c).replace(N,"$1").replace(P,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var f=Mt(e,"return "+c).apply(y,a) +}catch(p){throw p.source=c,p}return t?f(t):(f.source=c,f)},_.unescape=function(n){return n==d?"":Xt(n).replace(z,ct)},_.uniqueId=function(n){var t=++O;return Xt(n==d?"":n)+t},_.all=jt,_.any=It,_.detect=kt,_.findWhere=kt,_.foldl=St,_.foldr=At,_.include=Ct,_.inject=St,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return sr.apply(t,arguments),n.apply(_,t)})}),_.first=Nt,_.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++ +}else if(e=t,e==d||r)return n[u-1];return v(n,wr(0,u-e))}},_.take=Nt,_.head=Nt,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==d||r&&typeof t!="function"?e:new j(e)})}),_.VERSION="1.2.1",_.prototype.toString=function(){return Xt(this.__wrapped__)},_.prototype.value=Gt,_.prototype.valueOf=Gt,Rr(["join","pop","shift"],function(n){var t=Zt[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Rr(["push","reverse","sort","unshift"],function(n){var t=Zt[n]; +_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Rr(["concat","slice","splice"],function(n){var t=Zt[n];_.prototype[n]=function(){return new j(t.apply(this.__wrapped__,arguments))}}),Nr.spliceObjects||Rr(["pop","shift","splice"],function(n){var t=Zt[n],r="splice"==n;_.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new j(e):e}}),_}var y,m=!0,d=null,b=!1,_=typeof exports=="object"&&exports,C=typeof module=="object"&&module&&module.exports==_&&module,j=typeof global=="object"&&global; +(j.global===j||j.window===j)&&(n=j);var w=[],x=[],O=0,E={},S=+new Date+"",A=75,I=10,B=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,P=/(__e\(.*?\)|\b__t\))\+'';/g,z=/&(?:amp|lt|gt|quot|#39);/g,F=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$=/\w*$/,q=/<%=([\s\S]+?)%>/g,D=(D=/\bthis\b/)&&D.test(h)&&D,R=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",T=RegExp("^["+R+"]*0+(?=.$)"),L=/($^)/,G=/[&<>"']/g,H=/['\n\r\t\u2028\u2029\\]/g,J="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),K="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),M="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",Q="[object Error]",X="[object Function]",Y="[object Number]",Z="[object Object]",nt="[object RegExp]",tt="[object String]",rt={}; +rt[X]=b,rt[M]=rt[U]=rt[V]=rt[W]=rt[Y]=rt[Z]=rt[nt]=rt[tt]=m;var et={"boolean":b,"function":m,object:m,number:b,string:b,undefined:b},ut={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},at=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=at, define(function(){return at})):_&&!_.nodeType?C?(C.exports=at)._=at:_._=at:n._=at}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index aa2670aaeb..756aeb8be5 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -141,6 +141,166 @@ '\u2029': 'u2029' }; + /*--------------------------------------------------------------------------*/ + + /** + * A basic implementation of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. + * + * @private + * @param {Array} array The array to search. + * @param {Mixed} value The value to search for. + * @param {Number} [fromIndex=0] The index to search from. + * @returns {Number} Returns the index of the matched value or `-1`. + */ + function basicIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * An implementation of `_.contains` for cache objects that mimics the return + * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. + * + * @private + * @param {Object} cache The cache object to inspect. + * @param {Mixed} value The value to search for. + * @returns {Number} Returns `0` if `value` is found, else `-1`. + */ + function cacheIndexOf(cache, value) { + var type = typeof value; + cache = cache.cache; + + if (type == 'boolean' || value == null) { + return cache[value]; + } + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = cache[type] || (cache[type] = {}); + + return type == 'object' + ? (cache[key] && basicIndexOf(cache[key], value) > -1 ? 0 : -1) + : (cache[key] ? 0 : -1); + } + + /** + * Adds a given `value` to the corresponding cache object. + * + * @private + * @param {Mixed} value The value to add to the cache. + */ + function cachePush(value) { + var cache = this.cache, + type = typeof value; + + if (type == 'boolean' || value == null) { + cache[value] = true; + } else { + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value, + typeCache = cache[type] || (cache[type] = {}); + + if (type == 'object') { + if ((typeCache[key] || (typeCache[key] = [])).push(value) == this.array.length) { + cache[type] = false; + } + } else { + typeCache[key] = true; + } + } + } + + /** + * Used by `_.max` and `_.min` as the default `callback` when a given + * `collection` is a string value. + * + * @private + * @param {String} value The character to inspect. + * @returns {Number} Returns the code unit of given character. + */ + function charAtCallback(value) { + return value.charCodeAt(0); + } + + /** + * Used by `sortBy` to compare transformed `collection` values, stable sorting + * them in ascending order. + * + * @private + * @param {Object} a The object to compare to `b`. + * @param {Object} b The object to compare to `a`. + * @returns {Number} Returns the sort order indicator of `1` or `-1`. + */ + function compareAscending(a, b) { + var ai = a.index, + bi = b.index; + + a = a.criteria; + b = b.criteria; + + // ensure a stable sort in V8 and other engines + // http://code.google.com/p/v8/issues/detail?id=90 + if (a !== b) { + if (a > b || typeof a == 'undefined') { + return 1; + } + if (a < b || typeof b == 'undefined') { + return -1; + } + } + return ai < bi ? -1 : 1; + } + + /** + * Creates a cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [array=[]] The array to search. + * @returns {Null|Object} Returns the cache object or `null` if caching should not be used. + */ + function createCache(array) { + var index = -1, + length = array.length; + + var cache = getObject(); + cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; + + var result = getObject(); + result.array = array; + result.cache = cache; + result.push = cachePush; + + while (++index < length) { + result.push(array[index]); + } + return cache.object === false + ? (releaseObject(result), null) + : result; + } + + /** + * Used by `template` to escape characters for inclusion in compiled + * string literals. + * + * @private + * @param {String} match The matched character to escape. + * @returns {String} Returns the escaped character. + */ + function escapeStringChar(match) { + return '\\' + stringEscapes[match]; + } + /** * Gets an array from the array pool or creates a new one if the pool is empty. * @@ -160,18 +320,13 @@ function getObject() { return objectPool.pop() || { 'array': null, - 'contains': null, 'criteria': null, 'false': null, - 'function': null, 'index': null, - 'indexOf': null, - 'initedArray': null, 'null': null, 'number': null, 'object': null, 'push': null, - 'release': null, 'string': null, 'true': null, 'undefined': null, @@ -179,6 +334,15 @@ }; } + /** + * A no-operation function. + * + * @private + */ + function noop() { + // no operation performed + } + /** * Releases the given `array` back to the array pool. * @@ -200,6 +364,10 @@ * @param {Object} [object] The object to release. */ function releaseObject(object) { + var cache = object.cache; + if (cache) { + releaseObject(cache); + } if (objectPool.length == maxPoolSize) { objectPool.length = maxPoolSize - 1; } @@ -207,6 +375,34 @@ objectPool.push(object); } + /** + * Slices the `collection` from the `start` index up to, but not including, + * the `end` index. + * + * Note: This function is used, instead of `Array#slice`, to support node lists + * in IE < 9 and to ensure dense arrays are returned. + * + * @private + * @param {Array|Object|String} collection The collection to slice. + * @param {Number} start The start index. + * @param {Number} end The end index. + * @returns {Array} Returns the new array. + */ + function slice(array, start, end) { + start || (start = 0); + if (typeof end == 'undefined') { + end = array ? array.length : 0; + } + var index = -1, + length = end - start || 0, + result = Array(length < 0 ? 0 : length); + + while (++index < length) { + result[index] = array[start + index]; + } + return result; + } + /*--------------------------------------------------------------------------*/ /** @@ -364,6 +560,19 @@ : new lodashWrapper(value); } + /** + * A fast path for creating `lodash` wrapper objects. + * + * @private + * @param {Mixed} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns a `lodash` instance. + */ + function lodashWrapper(value) { + this.__wrapped__ = value; + } + // ensure `new lodashWrapper` is an instance of `lodash` + lodashWrapper.prototype = lodash.prototype; + /** * An object used to flag environments features. * @@ -444,69 +653,6 @@ /*--------------------------------------------------------------------------*/ - /** - * A basic version of `_.indexOf` without support for binary searches - * or `fromIndex` constraints. - * - * @private - * @param {Array} array The array to search. - * @param {Mixed} value The value to search for. - * @param {Number} [fromIndex=0] The index to search from. - * @returns {Number} Returns the index of the matched value or `-1`. - */ - function basicIndexOf(array, value, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Used by `_.max` and `_.min` as the default `callback` when a given - * `collection` is a string value. - * - * @private - * @param {String} value The character to inspect. - * @returns {Number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - - /** - * Used by `sortBy` to compare transformed `collection` values, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {Number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ai = a.index, - bi = b.index; - - a = a.criteria; - b = b.criteria; - - // ensure a stable sort in V8 and other engines - // http://code.google.com/p/v8/issues/detail?id=90 - if (a !== b) { - if (a > b || typeof a == 'undefined') { - return 1; - } - if (a < b || typeof b == 'undefined') { - return -1; - } - } - return ai < bi ? -1 : 1; - } - /** * Creates a function that, when called, invokes `func` with the `this` binding * of `thisArg` and prepends any `partialArgs` to the arguments passed to the @@ -565,109 +711,6 @@ return bound; } - /** - * Creates a function optimized to search large arrays for a given `value`, - * starting at `fromIndex`, using strict equality for comparisons, i.e. `===`. - * - * @private - * @param {Array} [array=[]] The array to search. - * @param {Mixed} value The value to search for. - * @returns {Boolean} Returns `true`, if `value` is found, else `false`. - */ - var createCache = (function() { - - function basicContains(value) { - return this.indexOf(this.array, value) > -1; - } - - function basicPush(value) { - this.array.push(value); - } - - function cacheContains(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - return cache[value]; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = cache[type] || (cache[type] = {}); - - return type == 'object' - ? (cache[key] ? basicIndexOf(cache[key], value) > -1 : false) - : !!cache[key]; - } - - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - bailout = (cache[key] || (cache[key] = [])).push(value) == length; - } else { - cache[key] = true; - } - } - } - - function release() { - var cache = this.cache; - if (cache.initedArray) { - releaseArray(this.array); - } - releaseObject(cache); - } - - return function(array) { - var bailout, - index = -1, - indexOf = getIndexOf(), - initedArray = !array && (array = getArray()), - length = array.length, - isLarge = length >= largeArraySize && lodash.indexOf !== indexOf; - - var cache = getObject(); - cache.initedArray = initedArray; - cache['false'] = cache['function'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.contains = cacheContains; - result.indexOf = indexOf; - result.push = cachePush; - result.release = release; - - if (isLarge) { - while (++index < length) { - result.push(array[index]); - } - if (bailout) { - isLarge = false; - result.release(); - } - } - if (!isLarge) { - result.contains = basicContains; - result.push = basicPush; - } - return result; - }; - }()); - /** * Creates a new object with the specified `prototype`. * @@ -690,18 +733,6 @@ return htmlEscapes[match]; } - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {String} match The matched character to escape. - * @returns {String} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized, this method returns the custom method, otherwise it returns @@ -715,28 +746,6 @@ return result; } - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {Mixed} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value) { - this.__wrapped__ = value; - } - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - /** - * A no-operation function. - * - * @private - */ - function noop() { - // no operation performed - } - /** * Creates a function that juggles arguments, allowing argument overloading * for `_.flatten` and `_.uniq`, before passing them to the given `func`. @@ -788,34 +797,6 @@ return result === undefined || hasOwnProperty.call(value, result); } - /** - * Slices the `collection` from the `start` index up to, but not including, - * the `end` index. - * - * Note: This function is used, instead of `Array#slice`, to support node lists - * in IE < 9 and to ensure dense arrays are returned. - * - * @private - * @param {Array|Object|String} collection The collection to slice. - * @param {Number} start The start index. - * @param {Number} end The end index. - * @returns {Array} Returns the new array. - */ - function slice(array, start, end) { - start || (start = 0); - if (typeof end == 'undefined') { - end = array ? array.length : 0; - } - var index = -1, - length = end - start || 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = array[start + index]; - } - return result; - } - /** * Used by `unescape` to convert HTML entities to characters. * @@ -1123,7 +1104,7 @@ * `undefined`, cloning will be handled by the method instead. The `callback` * is bound to `thisArg` and invoked with one argument; (value). * - * Note: This function is loosely based on the structured clone algorithm. Functions + * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and * objects created by constructors other than `Object` are cloned to plain `Object` objects. * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. @@ -3321,18 +3302,31 @@ */ function difference(array) { var index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, - flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), - cache = createCache(flattened), + seen = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), result = []; + var isLarge = length >= largeArraySize && indexOf === basicIndexOf; + + if (isLarge) { + var cache = createCache(seen); + if (cache) { + indexOf = cacheIndexOf; + seen = cache; + } else { + isLarge = false; + } + } while (++index < length) { var value = array[index]; - if (!cache.contains(value)) { + if (indexOf(seen, value) < 0) { result.push(value); } } - cache.release(); + if (isLarge) { + releaseObject(seen); + } return result; } @@ -3636,24 +3630,31 @@ function intersection(array) { var args = arguments, argsLength = args.length, + argsIndex = -1, + caches = getArray(), index = -1, + indexOf = getIndexOf(), length = array ? array.length : 0, - result = []; - - var caches = getArray(); - caches[0] = createCache(); + result = [], + seen = getArray(); + while (++argsIndex < argsLength) { + var value = args[argsIndex]; + caches[argsIndex] = indexOf === basicIndexOf && + (value ? value.length : 0) >= largeArraySize && + createCache(argsIndex ? args[argsIndex] : seen); + } outer: while (++index < length) { - var cache = caches[0], - value = array[index]; + var cache = caches[0]; + value = array[index]; - if (!cache.contains(value)) { - var argsIndex = argsLength; - cache.push(value); + if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { + argsIndex = argsLength; + (cache || seen).push(value); while (--argsIndex) { - cache = caches[argsIndex] || (caches[argsIndex] = createCache(args[argsIndex])); - if (!cache.contains(value)) { + cache = caches[argsIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { continue outer; } } @@ -3661,9 +3662,13 @@ } } while (argsLength--) { - caches[argsLength].release(); + cache = caches[argsLength]; + if (cache) { + releaseObject(cache); + } } releaseArray(caches); + releaseArray(seen); return result; } @@ -4035,17 +4040,28 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - isLarge = !isSorted && length >= largeArraySize && lodash.indexOf !== indexOf, - result = [], - seen = isLarge ? createCache() : (callback ? getArray() : result); + result = []; + var isLarge = !isSorted && length >= largeArraySize && indexOf === basicIndexOf, + seen = (callback || isLarge) ? getArray() : result; + + if (isLarge) { + var cache = createCache(seen); + if (cache) { + indexOf = cacheIndexOf; + seen = cache; + } else { + isLarge = false; + seen = callback ? seen : (releaseArray(seen), result); + } + } while (++index < length) { var value = array[index], computed = callback ? callback(value, index, array) : value; if (isSorted ? !index || seen[seen.length - 1] !== computed - : (isLarge ? !seen.contains(computed) : indexOf(seen, computed) < 0) + : indexOf(seen, computed) < 0 ) { if (callback || isLarge) { seen.push(computed); @@ -4054,7 +4070,8 @@ } } if (isLarge) { - seen.release(); + releaseArray(seen.array); + releaseObject(seen); } else if (callback) { releaseArray(seen); } @@ -4778,7 +4795,7 @@ } /** - * This function returns the first argument passed to it. + * This method returns the first argument passed to it. * * @static * @memberOf _ @@ -4827,7 +4844,7 @@ push.apply(args, arguments); var result = func.apply(lodash, args); - return (value && typeof value == 'object' && value == result) + return (value && typeof value == 'object' && value === result) ? this : new lodashWrapper(result); }; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 6938cdfdf1..7c71843784 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,43 +4,43 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(){return v.pop()||[]}function e(){return g.pop()||{k:f,m:f,n:f,"false":f,"function":f,o:f,p:f,q:f,"null":f,number:f,object:f,push:f,r:f,string:f,"true":f,undefined:f,s:f}}function r(n){v.length==d&&(v.length=d-1),n.length=0,v.push(n)}function u(n){g.length==d&&(g.length=d-1),n.k=n.l=n.n=n.object=n.a=n.b=n.s=f,g.push(n)}function a(c){function s(n){if(!n||pe.call(n)!=P)return l;var t=n.valueOf,e=typeof t=="function"&&(e=oe(t))&&oe(e);return e?n==e||oe(n)==e:at(n)}function v(n,t,e){if(!n||!V[typeof n])return n; -t=t&&typeof e=="undefined"?t:L.createCallback(t,e);for(var r=-1,u=V[typeof n]&&Ie(n),a=u?u.length:0;++rt||typeof n=="undefined")return 1;if(ne?0:e);++re?be(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(ht(n)?n.indexOf(t,e):u(n,t,e)):v(n,function(n){return++ru&&(u=o) -}}else t=!t&&ht(n)?X:L.createCallback(t,e),jt(n,function(n,e,a){e=t(n,e,a),e>r&&(r=e,u=n)});return u}function xt(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Kt(r);++earguments.length;t=L.createCallback(t,r,4);var a=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++a]);++aarguments.length; -if(typeof u!="number")var o=Ie(n),u=o.length;return t=L.createCallback(t,r,4),jt(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=l,n[i]):t(e,n[i],i,f)}),e}function St(n,t,e){var r;t=L.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++ee?be(0,r+e):e||0}else if(e)return e=qt(n,t),n[e]===t?e:-1;return n?Q(n,t,e):-1}function $t(n,t,e){if(typeof t!="number"&&t!=f){var r=0,u=-1,a=n?n.length:0;for(t=L.createCallback(t,e);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:O,variable:"",imports:{_:L}};var Ee=function(){function n(n){return-1=b&&L.p!==i,g=e();if(g.q=f,g["false"]=g["function"]=g["null"]=g["true"]=g.undefined=l,f=e(),f.k=r,f.l=g,f.m=o,f.p=i,f.push=c,f.r=p,v)for(;++u":">",'"':""","'":"'"},Ae=ct(Ne),$e=ut(function Fe(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=b&&L.p!==o,l=[],c=f?Ee():u?t():l;++an?t():function(){return 1>--n?t.apply(this,arguments):void 0}},L.assign=H,L.at=function(n){for(var t=-1,e=re.apply(Xt,je.call(arguments,1)),r=e.length,u=Kt(r);++t++c&&(a=n.apply(o,u)),p=ce(r,t),a}},L.defaults=d,L.defer=Tt,L.delay=function(n,t){var e=je.call(arguments,2);return ce(function(){n.apply(o,e)},t)},L.difference=It,L.filter=_t,L.flatten=$e,L.forEach=jt,L.forIn=g,L.forOwn=v,L.functions=lt,L.groupBy=function(n,t,e){var r={};return t=L.createCallback(t,e),jt(n,function(n,e,u){e=Lt(t(n,e,u)),(ie.call(r,e)?r[e]:r[e]=[]).push(n)}),r},L.initial=function(n,t,e){if(!n)return[]; -var r=0,u=n.length;if(typeof t!="number"&&t!=f){var a=u;for(t=L.createCallback(t,e);a--&&t(n[a],a,n);)r++}else r=t==f||e?1:t||r;return ot(n,0,de(be(0,u-r),u))},L.intersection=function(n){var e=arguments,u=e.length,a=-1,o=n?n.length:0,i=[],f=t();f[0]=Ee();n:for(;++ar(o,e))&&(a[e]=n)}),a},L.once=function(n){var t,e;return function(){return t?e:(t=i,e=n.apply(this,arguments),n=f,e)}},L.pairs=function(n){for(var t=-1,e=Ie(n),r=e.length,u=Kt(r);++te?be(0,r+e):de(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},L.mixin=zt,L.noConflict=function(){return c._=Zt,this},L.parseInt=Be,L.random=function(n,t){n==f&&t==f&&(t=1),n=+n||0,t==f?(t=n,n=0):t=+t||0;var e=ke();return n%1||t%1?n+de(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ue(e*(t-n+1))},L.reduce=Ot,L.reduceRight=Et,L.result=function(n,t){var e=n?n[t]:o;return st(e)?n[t]():e},L.runInContext=a,L.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ie(n).length -},L.some=St,L.sortedIndex=qt,L.template=function(n,t,e){var r=L.templateSettings;n||(n=""),e=d({},e,r);var u,a=d({},e.imports,r.imports),r=Ie(a),a=mt(a),f=0,l=e.interpolate||N,c="__p+='",l=Jt((e.escape||N).source+"|"+l.source+"|"+(l===O?C:N).source+"|"+(e.evaluate||N).source+"|$","g");n.replace(l,function(t,e,r,a,o,l){return r||(r=a),c+=n.slice(f,l).replace($,tt),e&&(c+="'+__e("+e+")+'"),o&&(u=i,c+="';"+o+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),f=l+t.length,t}),c+="';\n",l=e=e.variable,l||(e="obj",c="with("+e+"){"+c+"}"),c=(u?c.replace(_,""):c).replace(k,"$1").replace(j,"$1;"),c="function("+e+"){"+(l?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}"; -try{var p=Vt(r,"return "+c).apply(o,a)}catch(s){throw s.source=c,s}return t?p(t):(p.source=c,p)},L.unescape=function(n){return n==f?"":Lt(n).replace(w,it)},L.uniqueId=function(n){var t=++h;return Lt(n==f?"":n)+t},L.all=dt,L.any=St,L.detect=kt,L.findWhere=kt,L.foldl=Ot,L.foldr=Et,L.include=bt,L.inject=Ot,v(L,function(n,t){L.prototype[t]||(L.prototype[t]=function(){var t=[this.__wrapped__];return fe.apply(t,arguments),n.apply(L,t)})}),L.first=Nt,L.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=f){var a=u; -for(t=L.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==f||e)return n[u-1];return ot(n,be(0,u-r))}},L.take=Nt,L.head=Nt,v(L,function(n,t){L.prototype[t]||(L.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==f||e&&typeof t!="function"?r:new rt(r)})}),L.VERSION="1.2.1",L.prototype.toString=function(){return Lt(this.__wrapped__)},L.prototype.value=Pt,L.prototype.valueOf=Pt,jt(["join","pop","shift"],function(n){var t=Xt[n];L.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),jt(["push","reverse","sort","unshift"],function(n){var t=Xt[n];L.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),jt(["concat","slice","splice"],function(n){var t=Xt[n];L.prototype[n]=function(){return new rt(t.apply(this.__wrapped__,arguments))}}),L}var o,i=!0,f=null,l=!1,c=typeof exports=="object"&&exports,p=typeof module=="object"&&module&&module.exports==c&&module,s=typeof global=="object"&&global;(s.global===s||s.window===s)&&(n=s);var v=[],g=[],h=0,y={},m=+new Date+"",b=75,d=10,_=/\b__p\+='';/g,k=/\b(__p\+=)''\+/g,j=/(__e\(.*?\)|\b__t\))\+'';/g,w=/&(?:amp|lt|gt|quot|#39);/g,C=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,x=/\w*$/,O=/<%=([\s\S]+?)%>/g,E=(E=/\bthis\b/)&&E.test(a)&&E,S=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",I=RegExp("^["+S+"]*0+(?=.$)"),N=/($^)/,A=/[&<>"']/g,$=/['\n\r\t\u2028\u2029\\]/g,q="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),B="[object Arguments]",F="[object Array]",R="[object Boolean]",T="[object Date]",D="[object Function]",z="[object Number]",P="[object Object]",K="[object RegExp]",M="[object String]",U={}; -U[D]=l,U[B]=U[F]=U[R]=U[T]=U[z]=U[P]=U[K]=U[M]=i;var V={"boolean":l,"function":i,object:i,number:l,string:l,undefined:l},W={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},G=a();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=G, define(function(){return G})):c&&!c.nodeType?p?(p.exports=G)._=G:c._=G:n._=G}(this); \ No newline at end of file +;!function(n){function t(n,t,e){e=(e||0)-1;for(var r=n.length;++et||typeof n=="undefined")return 1;if(ne?0:e);++re?de(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(yt(n)?n.indexOf(t,e):u(n,t,e)):_(n,function(n){return++ra&&(a=i) +}}else t=!t&&yt(n)?u:tt.createCallback(t,e),wt(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,a=n)});return a}function Ot(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Mt(r);++earguments.length;t=tt.createCallback(t,r,4);var a=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++a]);++aarguments.length; +if(typeof u!="number")var o=Ee(n),u=o.length;return t=tt.createCallback(t,r,4),wt(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=b,n[i]):t(e,n[i],i,f)}),e}function It(n,t,e){var r;t=tt.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=O&&u===t;if(c){var l=o(i);l?(u=e,i=l):c=b}for(;++ru(i,l)&&f.push(l); +return c&&p(i),f}function Nt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=y){var a=-1;for(t=tt.createCallback(t,e);++ar?de(0,u+r):r||0}else if(r)return r=Ft(n,e),n[r]===e?r:-1;return n?t(n,e,r):-1}function Bt(n,t,e){if(typeof t!="number"&&t!=y){var r=0,u=-1,a=n?n.length:0;for(t=tt.createCallback(t,e);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:F,variable:"",imports:{_:tt}};var Oe=he,Ee=me?function(n){return gt(n)?me(n):[]}:Z,Se={"&":"&","<":"<",">":">",'"':""","'":"'"},Ie=pt(Se),Ut=ot(function Ne(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=O&&i===t,g=u||v?f():s;if(v){var h=o(g);h?(i=e,g=h):(v=b,g=u?g:(l(g),s))}for(;++ai(g,y))&&((u||v)&&g.push(y),s.push(h))}return v?(l(g.a),p(g)):u&&l(g),s});return Gt&&d&&typeof le=="function"&&(Dt=qt(le,r)),le=8==ke(T+"08")?ke:function(n,t){return ke(yt(n)?n.replace(q,""):n,t||0)},tt.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},tt.assign=E,tt.at=function(n){for(var t=-1,e=ue.apply(Yt,we.call(arguments,1)),r=e.length,u=Mt(r);++t++i&&(a=n.apply(o,u)),f=pe(r,t),a}},tt.defaults=j,tt.defer=Dt,tt.delay=function(n,t){var e=we.call(arguments,2);return pe(function(){n.apply(g,e)},t)},tt.difference=At,tt.filter=kt,tt.flatten=Ut,tt.forEach=wt,tt.forIn=k,tt.forOwn=_,tt.functions=lt,tt.groupBy=function(n,t,e){var r={}; +return t=tt.createCallback(t,e),wt(n,function(n,e,u){e=Qt(t(n,e,u)),(fe.call(r,e)?r[e]:r[e]=[]).push(n)}),r},tt.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&t!=y){var a=u;for(t=tt.createCallback(t,e);a--&&t(n[a],a,n);)r++}else r=t==y||e?1:t||r;return s(n,0,_e(de(0,u-r),u))},tt.intersection=function(n){for(var r=arguments,u=r.length,a=-1,i=f(),c=-1,s=at(),v=n?n.length:0,g=[],h=f();++a=O&&o(a?r[a]:h)}n:for(;++c(b?e(b,y):s(h,y))){for(a=u,(b||h).push(y);--a;)if(b=i[a],0>(b?e(b,y):s(r[a],y)))continue n;g.push(y)}}for(;u--;)(b=i[u])&&p(b);return l(i),l(h),g},tt.invert=pt,tt.invoke=function(n,t){var e=we.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Mt(typeof a=="number"?a:0);return wt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},tt.keys=Ee,tt.map=Ct,tt.max=xt,tt.memoize=function(n,t){function e(){var r=e.cache,u=x+(t?t.apply(this,arguments):arguments[0]);return fe.call(r,u)?r[u]:r[u]=n.apply(this,arguments) +}return e.cache={},e},tt.merge=bt,tt.min=function(n,t,e){var r=1/0,a=r;if(!t&&Oe(n)){e=-1;for(var o=n.length;++er(o,e))&&(a[e]=n)}),a},tt.once=function(n){var t,e;return function(){return t?e:(t=h,e=n.apply(this,arguments),n=y,e) +}},tt.pairs=function(n){for(var t=-1,e=Ee(n),r=e.length,u=Mt(r);++te?de(0,r+e):_e(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},tt.mixin=Pt,tt.noConflict=function(){return r._=ne,this},tt.parseInt=le,tt.random=function(n,t){n==y&&t==y&&(t=1),n=+n||0,t==y?(t=n,n=0):t=+t||0;var e=je();return n%1||t%1?n+_e(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ae(e*(t-n+1))},tt.reduce=Et,tt.reduceRight=St,tt.result=function(n,t){var e=n?n[t]:g;return vt(e)?n[t]():e},tt.runInContext=v,tt.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ee(n).length +},tt.some=It,tt.sortedIndex=Ft,tt.template=function(n,t,e){var r=tt.templateSettings;n||(n=""),e=j({},e,r);var u,a=j({},e.imports,r.imports),r=Ee(a),a=mt(a),o=0,f=e.interpolate||D,c="__p+='",f=Lt((e.escape||D).source+"|"+f.source+"|"+(f===F?$:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(f,function(t,e,r,a,f,l){return r||(r=a),c+=n.slice(o,l).replace(P,i),e&&(c+="'+__e("+e+")+'"),f&&(u=h,c+="';"+f+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),o=l+t.length,t}),c+="';\n",f=e=e.variable,f||(e="obj",c="with("+e+"){"+c+"}"),c=(u?c.replace(S,""):c).replace(I,"$1").replace(A,"$1;"),c="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}"; +try{var l=Wt(r,"return "+c).apply(g,a)}catch(p){throw p.source=c,p}return t?l(t):(l.source=c,l)},tt.unescape=function(n){return n==y?"":Qt(n).replace(N,ft)},tt.uniqueId=function(n){var t=++w;return Qt(n==y?"":n)+t},tt.all=_t,tt.any=It,tt.detect=jt,tt.findWhere=jt,tt.foldl=Et,tt.foldr=St,tt.include=dt,tt.inject=Et,_(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(){var t=[this.__wrapped__];return ce.apply(t,arguments),n.apply(tt,t)})}),tt.first=Nt,tt.last=function(n,t,e){if(n){var r=0,u=n.length; +if(typeof t!="number"&&t!=y){var a=u;for(t=tt.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==y||e)return n[u-1];return s(n,de(0,u-r))}},tt.take=Nt,tt.head=Nt,_(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==y||e&&typeof t!="function"?r:new et(r)})}),tt.VERSION="1.2.1",tt.prototype.toString=function(){return Qt(this.__wrapped__)},tt.prototype.value=Kt,tt.prototype.valueOf=Kt,wt(["join","pop","shift"],function(n){var t=Yt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),wt(["push","reverse","sort","unshift"],function(n){var t=Yt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),wt(["concat","slice","splice"],function(n){var t=Yt[n];tt.prototype[n]=function(){return new et(t.apply(this.__wrapped__,arguments))}}),tt}var g,h=!0,y=null,b=!1,m=typeof exports=="object"&&exports,d=typeof module=="object"&&module&&module.exports==m&&module,_=typeof global=="object"&&global;(_.global===_||_.window===_)&&(n=_);var k=[],j=[],w=0,C={},x=+new Date+"",O=75,E=10,S=/\b__p\+='';/g,I=/\b(__p\+=)''\+/g,A=/(__e\(.*?\)|\b__t\))\+'';/g,N=/&(?:amp|lt|gt|quot|#39);/g,$=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,B=/\w*$/,F=/<%=([\s\S]+?)%>/g,R=(R=/\bthis\b/)&&R.test(v)&&R,T=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",q=RegExp("^["+T+"]*0+(?=.$)"),D=/($^)/,z=/[&<>"']/g,P=/['\n\r\t\u2028\u2029\\]/g,K="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),M="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",G="[object Function]",H="[object Number]",J="[object Object]",L="[object RegExp]",Q="[object String]",X={}; +X[G]=b,X[M]=X[U]=X[V]=X[W]=X[H]=X[J]=X[L]=X[Q]=h;var Y={"boolean":b,"function":h,object:h,number:b,string:b,undefined:b},Z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},nt=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=nt, define(function(){return nt})):m&&!m.nodeType?d?(d.exports=nt)._=nt:m._=nt:n._=nt}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 73d81c5824..2f19b82654 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -103,6 +103,80 @@ /*--------------------------------------------------------------------------*/ + /** + * A basic implementation of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. + * + * @private + * @param {Array} array The array to search. + * @param {Mixed} value The value to search for. + * @param {Number} [fromIndex=0] The index to search from. + * @returns {Number} Returns the index of the matched value or `-1`. + */ + function basicIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * Used by `sortBy` to compare transformed `collection` values, stable sorting + * them in ascending order. + * + * @private + * @param {Object} a The object to compare to `b`. + * @param {Object} b The object to compare to `a`. + * @returns {Number} Returns the sort order indicator of `1` or `-1`. + */ + function compareAscending(a, b) { + var ai = a.index, + bi = b.index; + + a = a.criteria; + b = b.criteria; + + // ensure a stable sort in V8 and other engines + // http://code.google.com/p/v8/issues/detail?id=90 + if (a !== b) { + if (a > b || typeof a == 'undefined') { + return 1; + } + if (a < b || typeof b == 'undefined') { + return -1; + } + } + return ai < bi ? -1 : 1; + } + + /** + * Used by `template` to escape characters for inclusion in compiled + * string literals. + * + * @private + * @param {String} match The matched character to escape. + * @returns {String} Returns the escaped character. + */ + function escapeStringChar(match) { + return '\\' + stringEscapes[match]; + } + + /** + * A no-operation function. + * + * @private + */ + function noop() { + // no operation performed + } + + /*--------------------------------------------------------------------------*/ + /** Used for `Array` and `Object` method references */ var arrayProto = Array.prototype, objectProto = Object.prototype, @@ -214,6 +288,19 @@ : new lodashWrapper(value); } + /** + * A fast path for creating `lodash` wrapper objects. + * + * @private + * @param {Mixed} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns a `lodash` instance. + */ + function lodashWrapper(value) { + this.__wrapped__ = value; + } + // ensure `new lodashWrapper` is an instance of `lodash` + lodashWrapper.prototype = lodash.prototype; + /** * An object used to flag environments features. * @@ -295,57 +382,6 @@ /*--------------------------------------------------------------------------*/ - /** - * A basic version of `_.indexOf` without support for binary searches - * or `fromIndex` constraints. - * - * @private - * @param {Array} array The array to search. - * @param {Mixed} value The value to search for. - * @param {Number} [fromIndex=0] The index to search from. - * @returns {Number} Returns the index of the matched value or `-1`. - */ - function basicIndexOf(array, value, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Used by `sortBy` to compare transformed `collection` values, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {Number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ai = a.index, - bi = b.index; - - a = a.criteria; - b = b.criteria; - - // ensure a stable sort in V8 and other engines - // http://code.google.com/p/v8/issues/detail?id=90 - if (a !== b) { - if (a > b || typeof a == 'undefined') { - return 1; - } - if (a < b || typeof b == 'undefined') { - return -1; - } - } - return ai < bi ? -1 : 1; - } - /** * Creates a function that, when called, invokes `func` with the `this` binding * of `thisArg` and prepends any `partialArgs` to the arguments passed to the @@ -437,18 +473,6 @@ return htmlEscapes[match]; } - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {String} match The matched character to escape. - * @returns {String} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - /** * Gets the appropriate "indexOf" function. If the `_.indexOf` method is * customized, this method returns the custom method, otherwise it returns @@ -462,28 +486,6 @@ return result; } - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {Mixed} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value) { - this.__wrapped__ = value; - } - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - /** - * A no-operation function. - * - * @private - */ - function noop() { - // no operation performed - } - /** * Used by `unescape` to convert HTML entities to characters. * @@ -3817,7 +3819,7 @@ } /** - * This function returns the first argument passed to it. + * This method returns the first argument passed to it. * * @static * @memberOf _ diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 6704703102..3482f9b92c 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,32 +4,32 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n){return n instanceof t?n:new l(n)}function r(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nt||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)}); else for(;++ou&&(u=r);return u}function k(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=W(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=$t(n),u=i.length;return t=W(t,e,4),N(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f) -}),r}function D(n,t,r){var e;t=W(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rr(u,i)&&o.push(i)}return o}function $(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=W(t,r);++oe?Ft(0,u+e):e||0}else if(e)return e=P(n,t),n[e]===t?e:-1;return n?r(n,t,e):-1}function C(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=W(t,r);++u>>1,r(n[e])o(l,c))&&(r&&l.push(c),a.push(e))}return a}function V(n,t){return Mt.fastBind||xt&&2"']/g,rt=/['\n\r\t\u2028\u2029\\]/g,et="[object Arguments]",ut="[object Array]",ot="[object Boolean]",it="[object Date]",at="[object Number]",ft="[object Object]",lt="[object RegExp]",ct="[object String]",pt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},vt=Array.prototype,L=Object.prototype,gt=n._,ht=RegExp("^"+(L.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),yt=Math.ceil,mt=n.clearTimeout,_t=vt.concat,dt=Math.floor,bt=L.hasOwnProperty,jt=vt.push,wt=n.setTimeout,At=L.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Nt=n.isNaN,Bt=ht.test(Bt=Object.keys)&&Bt,Ft=Math.max,kt=Math.min,qt=Math.random,Rt=vt.slice,L=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+L),Mt={}; -!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(vt.splice.call(n,0,1),!n[0])}(1),t.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(o=function(n){if(b(n)){c.prototype=n;var t=new c;c.prototype=null}return t||{}}),l.prototype=t.prototype,s(arguments)||(s=function(n){return n?bt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==ut:!1},Et=function(n){var t,r=[];if(!n||!pt[typeof n])return r; -for(t in n)bt.call(n,t)&&r.push(t);return r},$t=Bt?function(n){return b(n)?Bt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=y(It),Ct=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(t(n[r],r,n)===X)break;return n},Pt=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(bt.call(n,r)&&t(n[r],r,n)===X)break;return n};d(/x/)&&(d=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),t.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},t.bind=V,t.bindAll=function(n){for(var t=1u(i,a)){for(var l=r;--l;)if(0>u(t[l],a))continue n;i.push(a)}}return i},t.invert=y,t.invoke=function(n,t){var r=Rt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},t.keys=$t,t.map=B,t.max=F,t.memoize=function(n,t){var r={};return function(){var e=Y+(t?t.apply(this,arguments):arguments[0]);return bt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},t.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=W(t,r),N(n,function(n,r,o){r=t(n,r,o),rt(r,u)&&(e[u]=n) -}),e},t.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},t.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},t.mixin=H,t.noConflict=function(){return n._=gt,this},t.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+dt(r*(t-n+1))},t.reduce=q,t.reduceRight=R,t.result=function(n,t){var r=n?n[t]:null; -return d(r)?n[t]():r},t.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},t.some=D,t.sortedIndex=P,t.template=function(n,r,e){var u=t.templateSettings;n||(n=""),e=g({},e,u);var o=0,i="__p+='",u=e.variable;n.replace(RegExp((e.escape||nt).source+"|"+(e.interpolate||nt).source+"|"+(e.evaluate||nt).source+"|$","g"),function(t,r,e,u,f){return i+=n.slice(o,f).replace(rt,a),r&&(i+="'+_['escape']("+r+")+'"),u&&(i+="';"+u+";__p+='"),e&&(i+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t -}),i+="';\n",u||(u="obj",i="with("+u+"||{}){"+i+"}"),i="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+i+"return __p}";try{var f=Function("_","return "+i)(t)}catch(l){throw l.source=i,l}return r?f(r):(f.source=i,f)},t.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},t.uniqueId=function(n){var t=++Q+"";return n?n+t:t},t.all=O,t.any=D,t.detect=S,t.findWhere=function(n,t){return M(n,t,!0)},t.foldl=q,t.foldr=R,t.include=x,t.inject=q,t.first=$,t.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t!="number"&&null!=t){var o=u;for(t=W(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Ft(0,u-e))}},t.take=$,t.head=$,t.VERSION="1.2.1",H(t),t.prototype.chain=function(){return this.__chain__=!0,this},t.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var r=vt[n];t.prototype[n]=function(){var n=this.__wrapped__;return r.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this -}}),N(["concat","join","slice"],function(n){var r=vt[n];t.prototype[n]=function(){var n=r.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new l(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=t, define(function(){return t})):J&&!J.nodeType?K?(K.exports=t)._=t:J._=t:n._=t}(this); \ No newline at end of file +}),r}function D(n,t,r){var e;t=W(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rr(u,i)&&o.push(i)}return o}function $(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=W(t,r);++oe?Ft(0,u+e):e||0}else if(e)return e=P(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function C(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=W(t,r);++u>>1,r(n[e])o(f,l))&&(r&&f.push(l),a.push(e))}return a}function V(n,t){return Mt.fastBind||xt&&2"']/g,rt=/['\n\r\t\u2028\u2029\\]/g,et="[object Arguments]",ut="[object Array]",ot="[object Boolean]",it="[object Date]",at="[object Number]",ft="[object Object]",lt="[object RegExp]",ct="[object String]",pt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},vt=Array.prototype,L=Object.prototype,gt=n._,ht=RegExp("^"+(L.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),yt=Math.ceil,mt=n.clearTimeout,_t=vt.concat,dt=Math.floor,bt=L.hasOwnProperty,jt=vt.push,wt=n.setTimeout,At=L.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Nt=n.isNaN,Bt=ht.test(Bt=Object.keys)&&Bt,Ft=Math.max,kt=Math.min,qt=Math.random,Rt=vt.slice,L=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+L); +i.prototype=o.prototype;var Mt={};!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(vt.splice.call(n,0,1),!n[0])}(1),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(f=function(n){if(b(n)){u.prototype=n;var t=new u;u.prototype=null}return t||{}}),s(arguments)||(s=function(n){return n?bt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==ut:!1},Et=function(n){var t,r=[]; +if(!n||!pt[typeof n])return r;for(t in n)bt.call(n,t)&&r.push(t);return r},$t=Bt?function(n){return b(n)?Bt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=y(It),Ct=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(t(n[r],r,n)===X)break;return n},Pt=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(bt.call(n,r)&&t(n[r],r,n)===X)break;return n};d(/x/)&&(d=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),o.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},o.bind=V,o.bindAll=function(n){for(var t=1u(i,a)){for(var f=r;--f;)if(0>u(t[f],a))continue n;i.push(a)}}return i},o.invert=y,o.invoke=function(n,t){var r=Rt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); +return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},o.keys=$t,o.map=B,o.max=F,o.memoize=function(n,t){var r={};return function(){var e=Y+(t?t.apply(this,arguments):arguments[0]);return bt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},o.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=W(t,r),N(n,function(n,r,o){r=t(n,r,o),rt(r,u)&&(e[u]=n) +}),e},o.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},o.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=H,o.noConflict=function(){return n._=gt,this},o.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+dt(r*(t-n+1))},o.reduce=q,o.reduceRight=R,o.result=function(n,t){var r=n?n[t]:null; +return d(r)?n[t]():r},o.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},o.some=D,o.sortedIndex=P,o.template=function(n,t,r){var u=o.templateSettings;n||(n=""),r=g({},r,u);var i=0,a="__p+='",u=r.variable;n.replace(RegExp((r.escape||nt).source+"|"+(r.interpolate||nt).source+"|"+(r.evaluate||nt).source+"|$","g"),function(t,r,u,o,f){return a+=n.slice(i,f).replace(rt,e),r&&(a+="'+_['escape']("+r+")+'"),o&&(a+="';"+o+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),i=f+t.length,t +}),a+="';\n",u||(u="obj",a="with("+u+"||{}){"+a+"}"),a="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var f=Function("_","return "+a)(o)}catch(l){throw l.source=a,l}return t?f(t):(f.source=a,f)},o.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},o.uniqueId=function(n){var t=++Q+"";return n?n+t:t},o.all=O,o.any=D,o.detect=S,o.findWhere=function(n,t){return M(n,t,!0)},o.foldl=q,o.foldr=R,o.include=x,o.inject=q,o.first=$,o.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&null!=t){var o=u;for(t=W(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Ft(0,u-e))}},o.take=$,o.head=$,o.VERSION="1.2.1",H(o),o.prototype.chain=function(){return this.__chain__=!0,this},o.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var t=vt[n];o.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this +}}),N(["concat","join","slice"],function(n){var t=vt[n];o.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=o, define(function(){return o})):J&&!J.nodeType?K?(K.exports=o)._=o:J._=o:n._=o}(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 2ebf266460..209fcc365e 100644 --- a/doc/README.md +++ b/doc/README.md @@ -218,7 +218,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3647 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3627 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -242,7 +242,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3677 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3657 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -267,7 +267,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3714 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3707 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -295,7 +295,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3784 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3777 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -355,7 +355,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3846 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3839 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -398,7 +398,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3890 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3883 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -430,7 +430,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3957 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3950 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -487,7 +487,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3991 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3984 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -511,7 +511,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4082 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4086 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -568,7 +568,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4123 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4127 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -597,7 +597,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4164 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -635,7 +635,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4243 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4247 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -695,7 +695,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4307 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4311 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -744,7 +744,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4339 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4343 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -768,7 +768,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4389 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4393 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -815,7 +815,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4433 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4449 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -839,7 +839,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4459 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4475 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -864,7 +864,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4479 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4495 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -888,7 +888,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4501 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4517 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -923,7 +923,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L397 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L605 "View in source") [Ⓣ][1] Creates a `lodash` object, which wraps the given `value`, to enable method chaining. @@ -979,7 +979,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5579 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5595 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1009,7 +1009,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5596 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5612 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1030,7 +1030,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5613 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5629 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1061,7 +1061,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2634 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2614 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1089,7 +1089,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2676 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2656 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1127,7 +1127,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2731 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2711 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1163,7 +1163,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2783 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2763 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1209,7 +1209,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2844 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2824 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1255,7 +1255,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2911 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2891 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1304,7 +1304,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2958 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2938 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1336,7 +1336,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3008 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2988 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1373,7 +1373,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3041 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3021 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1402,7 +1402,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3093 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3073 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1447,7 +1447,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3150 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3130 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1489,7 +1489,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3219 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3199 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1531,7 +1531,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3269 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3249 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1561,7 +1561,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3301 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3281 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1599,7 +1599,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3344 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3324 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1630,7 +1630,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3404 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3384 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1673,7 +1673,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3425 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3405 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1697,7 +1697,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3458 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3438 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1727,7 +1727,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3505 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3485 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1773,7 +1773,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3561 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3541 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1810,7 +1810,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3597 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3577 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1834,7 +1834,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3629 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3609 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1871,7 +1871,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4541 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4557 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1899,7 +1899,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4574 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4590 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1930,7 +1930,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4605 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4621 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1961,7 +1961,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4651 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4667 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2002,7 +2002,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4674 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4690 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2029,7 +2029,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4733 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4749 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2083,7 +2083,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4809 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4825 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2116,7 +2116,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4862 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4878 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2141,7 +2141,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4888 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4904 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2168,7 +2168,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4913 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4929 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2194,7 +2194,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4943 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4959 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2220,7 +2220,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4978 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4994 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2247,7 +2247,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5009 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5025 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2284,7 +2284,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5042 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5058 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2316,7 +2316,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5107 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5123 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2352,7 +2352,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1372 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1352 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2390,7 +2390,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1427 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1407 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2437,11 +2437,11 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1557 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1537 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. -Note: This function is loosely based on the structured clone algorithm. Functions and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and objects created by constructors other than `Object` are cloned to plain `Object` objects. See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. +Note: This method is loosely based on the structured clone algorithm. Functions and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and objects created by constructors other than `Object` are cloned to plain `Object` objects. See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. #### Arguments 1. `value` *(Mixed)*: The value to deep clone. @@ -2483,7 +2483,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1581 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1561 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2509,7 +2509,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1603 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1583 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2537,7 +2537,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1644 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1624 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2573,7 +2573,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1669 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1649 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2601,7 +2601,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1686 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1666 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2628,7 +2628,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1711 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1691 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2653,7 +2653,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1728 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1708 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2677,7 +2677,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1235 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1215 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2704,7 +2704,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1261 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1241 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2731,7 +2731,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1754 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1734 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2755,7 +2755,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1771 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1751 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2779,7 +2779,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1788 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1768 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2803,7 +2803,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1813 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1793 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2833,7 +2833,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1872 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1852 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2878,7 +2878,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2058 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2038 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2916,7 +2916,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2075 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2055 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2940,7 +2940,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2138 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2118 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2975,7 +2975,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2160 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2140 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3002,7 +3002,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2177 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2157 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3026,7 +3026,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2105 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2085 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3056,7 +3056,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2205 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2185 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3091,7 +3091,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2230 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2210 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3115,7 +3115,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2247 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2227 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3139,7 +3139,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2264 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2244 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3163,7 +3163,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1294 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1274 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3187,7 +3187,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2323 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2303 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3243,7 +3243,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2438 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2418 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3274,7 +3274,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2473 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2453 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3298,7 +3298,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2511 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2491 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3329,7 +3329,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2566 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2546 "View in source") [Ⓣ][1] An alternative to `_.reduce`, this method transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3366,7 +3366,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2599 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2579 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3397,7 +3397,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5131 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5147 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3421,9 +3421,9 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5149 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5165 "View in source") [Ⓣ][1] -This function returns the first argument passed to it. +This method returns the first argument passed to it. #### Arguments 1. `value` *(Mixed)*: Any value. @@ -3446,7 +3446,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5175 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5191 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3476,7 +3476,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5204 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5220 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3496,7 +3496,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5228 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5244 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3523,7 +3523,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5251 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5267 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3551,7 +3551,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5295 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5311 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3586,7 +3586,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L237 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L445 "View in source") [Ⓣ][1] Create a new `lodash` function using the given `context` object. @@ -3604,7 +3604,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5379 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5395 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3686,7 +3686,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5504 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5520 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3718,7 +3718,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5531 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5547 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3742,7 +3742,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5551 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5567 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3776,7 +3776,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L593 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L814 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3795,7 +3795,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5794 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5810 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3807,7 +3807,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L411 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L632 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3819,7 +3819,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L436 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L657 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3831,7 +3831,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L428 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L649 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3843,7 +3843,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L445 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L666 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -3855,7 +3855,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L458 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L679 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3869,7 +3869,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L466 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L687 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3881,7 +3881,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L483 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L704 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3893,7 +3893,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L494 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L715 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3907,7 +3907,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L474 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L695 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3919,7 +3919,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L508 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L729 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3933,7 +3933,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L519 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L740 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3947,7 +3947,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L545 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L766 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3959,7 +3959,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L553 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L774 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3971,7 +3971,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L561 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L782 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3983,7 +3983,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L569 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L790 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3995,7 +3995,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L577 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L798 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -4007,7 +4007,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L585 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L806 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. From a3acbca24b73481420b8b44a8bed0c76820eb29e Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 7 Jun 2013 13:33:12 -0700 Subject: [PATCH 105/117] Rename typod test/run-test.sh. Former-commit-id: bb982a51c5ceb123e83d98c3201e969607f990b8 --- test/{run-rest.sh => run-test.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{run-rest.sh => run-test.sh} (100%) diff --git a/test/run-rest.sh b/test/run-test.sh similarity index 100% rename from test/run-rest.sh rename to test/run-test.sh From 244ee08d7d55e8007c185555d88dd68c87712520 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Fri, 7 Jun 2013 18:44:15 -0700 Subject: [PATCH 106/117] Remove `./` path prefix to avoid issues with Component's build. [closes #294] Former-commit-id: 93ba9214538b0f30fde75bff96b75c83f3b96f1f --- component.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/component.json b/component.json index 74238c99d4..cc39f96629 100644 --- a/component.json +++ b/component.json @@ -5,8 +5,8 @@ "description": "A low-level utility library delivering consistency, customization, performance, and extra features.", "license": "MIT", "scripts": [ - "./index.js", - "./dist/lodash.compat.js" + "index.js", + "dist/lodash.compat.js" ], "keywords": [ "browser", From 0c1a26170cdbdb18bc3a54e9b6688ad4c2a54134 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 8 Jun 2013 09:23:20 -0700 Subject: [PATCH 107/117] Remove build source `./lodash.js` from components. Former-commit-id: 4d7f56385b288b396182020aed07eec285c37815 --- .jamignore | 1 + .npmignore | 1 + package.json | 1 + 3 files changed, 3 insertions(+) diff --git a/.jamignore b/.jamignore index c5e2518937..dfb9ed2d4a 100644 --- a/.jamignore +++ b/.jamignore @@ -6,6 +6,7 @@ *.md *.txt build.js +lodash.js index.js bower.json component.json diff --git a/.npmignore b/.npmignore index c9ec59ceff..5877da9ab8 100644 --- a/.npmignore +++ b/.npmignore @@ -4,6 +4,7 @@ *.d.ts *.map *.md +lodash.js bower.json component.json doc diff --git a/package.json b/package.json index 45f33a1e8a..36e29b3ffd 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "*.md", "*.txt", "build.js", + "lodash.js", "index.js", "bower.json", "component.json", From 6b46dc7e892705f1b99584e0e8ef5731b463f2a0 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 9 Jun 2013 16:33:18 -0700 Subject: [PATCH 108/117] Ensure more private properties are minified correctly. Former-commit-id: dbebbb088768f04a8252029ad709bad9f01c88bb --- build/pre-compile.js | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index d5ce3c71cf..d86079827d 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -87,6 +87,7 @@ 'any', 'argsClass', 'argsObject', + 'array', 'assign', 'at', 'attachEvent', @@ -133,6 +134,7 @@ 'forEach', 'forIn', 'forOwn', + 'function', 'functions', 'global', 'groupBy', @@ -183,6 +185,8 @@ 'nodeClass', 'nonEnumArgs', 'nonEnumShadows', + 'null', + 'number', 'object', 'omit', 'once', @@ -211,6 +215,7 @@ 'sortedIndex', 'source', 'spliceObjects', + 'string', 'support', 'tail', 'take', @@ -222,6 +227,7 @@ 'toArray', 'trailing', 'transform', + 'undefined', 'unescape', 'unindexedChars', 'union', @@ -315,11 +321,11 @@ // minify internal properties (function() { var methods = [ + 'cacheIndexOf', + 'cachePush', 'compareAscending', 'createCache', - 'difference', 'getObject', - 'intersection', 'releaseObject', 'sortBy', 'uniq' @@ -332,7 +338,7 @@ 'value' ]; - var snippets = source.match(RegExp('^( +)(?:var|function) +(?:' + methods.join('|') + ')\\b[\\s\\S]+?\\n\\1}', 'gm')); + var snippets = source.match(RegExp('^( *)(?:var|function) +(?:' + methods.join('|') + ')\\b[\\s\\S]+?\\n\\1}', 'gm')); if (!snippets) { return; } @@ -364,14 +370,14 @@ var snippets = source.match( RegExp([ // match the `iteratorTemplate` - '( +)var iteratorTemplate\\b[\\s\\S]+?\\n\\1}', + '^( *)var iteratorTemplate\\b[\\s\\S]+?\\n\\1}', // match methods created by `createIterator` calls 'createIterator\\((?:{|[a-zA-Z]+)[\\s\\S]*?\\);\\n', // match variables storing `createIterator` options - '( +)var [a-zA-Z]+IteratorOptions\\b[\\s\\S]+?\\n\\2}', - // match the `createIterator`, `getObject`, and `releaseObject` functions - '( +)function (?:createIterator|getObject|releaseObject)\\b[\\s\\S]+?\\n\\3}' - ].join('|'), 'g') + '^( *)var [a-zA-Z]+IteratorOptions\\b[\\s\\S]+?\\n\\2}', + // match `cachePush`, `createCache`, `createIterator`, `getObject`, `releaseObject`, and `uniq` functions + '^( *)(?:var|function) +(?:cachePush|createCache|createIterator|getObject|releaseObject|uniq)\\b[\\s\\S]+?\\n\\3}' + ].join('|'), 'gm') ); // exit early if no compilable snippets @@ -380,7 +386,7 @@ } snippets.forEach(function(snippet, index) { - var isFunc = /^ *function +/m.test(snippet), + var isFunc = /\bfunction *[ \w]*\(/.test(snippet), isIteratorTemplate = /var iteratorTemplate\b/.test(snippet), modified = snippet; @@ -409,16 +415,24 @@ var minName = minNames[index]; // minify variable names present in strings - if (isFunc) { - modified = modified.replace(RegExp('(([\'"])[^\\n\\2]*?)\\b' + varName + '\\b(?=[^\\n\\2]*\\2[ ,+;]+$)', 'gm'), '$1' + minName); + if (isFunc && !isIteratorTemplate) { + modified = modified.replace(RegExp('((["\'])[^\\n\\2]*?)\\b' + varName + '\\b(?=[^\\n\\2]*\\2[ ,+;]+$)', 'gm'), function(match, prelude) { + return prelude + minName; + }); } // ensure properties in compiled strings aren't minified else { - modified = modified.replace(RegExp('([^.])\\b' + varName + '\\b(?!\' *[\\]:])', 'g'), '$1' + minName); + modified = modified.replace(RegExp('([^.])\\b' + varName + '\\b(?!\' *[\\]:])', 'g'), function(match, prelude) { + return prelude + minName; + }); } - // correct `typeof` values + // correct `typeof` string values if (/^(?:boolean|function|object|number|string|undefined)$/.test(varName)) { - modified = modified.replace(RegExp("(typeof [^']+')" + minName + "'", 'g'), '$1' + varName + "'"); + modified = modified.replace(RegExp('(= *)(["\'])' + minName + '\\2|(["\'])' + minName + '\\3( *=)', 'g'), function(match, prelude, preQuote, postQuote, postlude) { + return prelude + ? prelude + preQuote + varName + preQuote + : postQuote + varName + postQuote + postlude; + }); } }); From c20d7f97549714b3de0c0084583a72042378c88d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 10 Jun 2013 09:24:29 -0700 Subject: [PATCH 109/117] Tweak free variable `module` detection so it will work with Component's polyfill. [closes #296] Former-commit-id: bda6c962dc5e8299689e4c5cf003f6a6c9a4369d --- build.js | 15 +++++++++++---- lodash.js | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/build.js b/build.js index 10e7aa384a..0e99c29faf 100755 --- a/build.js +++ b/build.js @@ -584,12 +584,19 @@ var source = [ ';(function(window) {', - " var freeExports = typeof exports == 'object' && typeof require == 'function' && exports;", + ' var undefined;', '', - " var freeModule = typeof module == 'object' && module && module.exports == freeExports && module;", + ' var objectTypes = {', + " 'function': true,", + " 'object': true", + ' };', '', - " var freeGlobal = typeof global == 'object' && global;", - ' if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) {', + " var freeExports = objectTypes[typeof exports] && typeof require == 'function' && exports;", + '', + " var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module;", + '', + " var freeGlobal = objectTypes[typeof global] && global;", + ' if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {', ' window = freeGlobal;', ' }', '', diff --git a/lodash.js b/lodash.js index a11c7d3a5b..c74a96f1d4 100644 --- a/lodash.js +++ b/lodash.js @@ -11,18 +11,6 @@ /** Used as a safe reference for `undefined` in pre ES5 environments */ var undefined; - /** Detect free variable `exports` */ - var freeExports = typeof exports == 'object' && exports; - - /** Detect free variable `module` */ - var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; - - /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - window = freeGlobal; - } - /** Used to pool arrays and objects used internally */ var arrayPool = [], objectPool = []; @@ -146,6 +134,18 @@ '\u2029': 'u2029' }; + /** Detect free variable `exports` */ + var freeExports = objectTypes[typeof exports] && exports; + + /** Detect free variable `module` */ + var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module; + + /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + window = freeGlobal; + } + /*--------------------------------------------------------------------------*/ /** From 1933a766310997518ab09f591cf364bd71d30607 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 10 Jun 2013 11:16:14 -0700 Subject: [PATCH 110/117] Add `maxWait` option to `_.debounce` and implement `_.throttle` by way of `_.debounce`. [closes #285] Former-commit-id: 63b41aac298e5fa89f7922e84b2ed0d5c6545bd3 --- build.js | 7 ++- build/pre-compile.js | 1 + lodash.js | 112 ++++++++++++++++++++++++------------------- test/test.js | 28 +++++++++++ 4 files changed, 97 insertions(+), 51 deletions(-) diff --git a/build.js b/build.js index 0e99c29faf..3909ebcacf 100755 --- a/build.js +++ b/build.js @@ -167,7 +167,7 @@ 'sortedIndex': ['createCallback', 'identity'], 'tap': ['value'], 'template': ['defaults', 'escape', 'escapeStringChar', 'keys', 'values'], - 'throttle': ['isObject'], + 'throttle': ['debounce'], 'times': ['createCallback'], 'toArray': ['isString', 'slice', 'values'], 'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'], @@ -3342,6 +3342,11 @@ // remove `templateSettings` assignment source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, ''); } + if (isRemoved(source, 'throttle')) { + _.each(['leading', 'maxWait', 'trailing'], function(prop) { + source = removeFromGetObject(source, prop); + }); + } if (isRemoved(source, 'value')) { source = removeFunction(source, 'chain'); source = removeFunction(source, 'wrapperToString'); diff --git a/build/pre-compile.js b/build/pre-compile.js index d86079827d..f7c1ef4ed1 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -176,6 +176,7 @@ 'leading', 'map', 'max', + 'maxWait', 'memoize', 'merge', 'methods', diff --git a/lodash.js b/lodash.js index c74a96f1d4..be0e8f7c7d 100644 --- a/lodash.js +++ b/lodash.js @@ -324,27 +324,30 @@ */ function getObject() { return objectPool.pop() || { - 'args': null, + 'args': '', 'array': null, - 'bottom': null, + 'bottom': '', 'criteria': null, - 'false': null, - 'firstArg': null, - 'index': null, - 'init': null, - 'loop': null, - 'null': null, + 'false': false, + 'firstArg': '', + 'index': 0, + 'init': '', + 'leading': false, + 'loop': '', + 'maxWait': 0, + 'null': false, 'number': null, 'object': null, 'push': null, 'shadowedProps': null, 'string': null, 'support': null, - 'top': null, - 'true': null, - 'undefined': null, - 'useHas': null, - 'useKeys': null, + 'top': '', + 'trailing': false, + 'true': false, + 'undefined': false, + 'useHas': false, + 'useKeys': false, 'value': null }; } @@ -4810,6 +4813,7 @@ * @param {Number} wait The number of milliseconds to delay. * @param {Object} options The options object. * [leading=false] A boolean to specify execution on the leading edge of the timeout. + * [maxWait] The maximum time `func` is allowed to be delayed before it's called. * [trailing=true] A boolean to specify execution on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example @@ -4827,35 +4831,67 @@ result, thisArg, callCount = 0, + lastCalled = 0, + maxWait = false, + maxTimeoutId = null, timeoutId = null, trailing = true; - function delayed() { + function trailingCall() { var isCalled = trailing && (!leading || callCount > 1); - callCount = timeoutId = 0; + callCount = 0; + + clearTimeout(maxTimeoutId); + clearTimeout(timeoutId); + maxTimeoutId = timeoutId = null; + if (isCalled) { + lastCalled = new Date; result = func.apply(thisArg, args); } } + wait = nativeMax(0, wait || 0); if (options === true) { var leading = true; trailing = false; } else if (isObject(options)) { + maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); leading = options.leading; trailing = 'trailing' in options ? options.trailing : trailing; } return function() { + var now = new Date; + if (!timeoutId && !leading) { + lastCalled = now; + } + var remaining = (maxWait || wait) - (now - lastCalled); args = arguments; thisArg = this; + callCount++; // avoid issues with Titanium and `undefined` timeout ids // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); + timeoutId = null; - if (leading && ++callCount < 2) { - result = func.apply(thisArg, args); + if (maxWait === false) { + if (leading && callCount < 2) { + result = func.apply(thisArg, args); + } + } else { + if (remaining <= 0) { + clearTimeout(maxTimeoutId); + maxTimeoutId = null; + lastCalled = now; + result = func.apply(thisArg, args); + } + else if (!maxTimeoutId) { + maxTimeoutId = setTimeout(trailingCall, remaining); + } + } + if (wait !== maxWait) { + timeoutId = setTimeout(trailingCall, wait); } - timeoutId = setTimeout(delayed, wait); return result; }; } @@ -5056,47 +5092,23 @@ * })); */ function throttle(func, wait, options) { - var args, - result, - thisArg, - lastCalled = 0, - leading = true, - timeoutId = null, + var leading = true, trailing = true; - function trailingCall() { - timeoutId = null; - if (trailing) { - lastCalled = new Date; - result = func.apply(thisArg, args); - } - } if (options === false) { leading = false; } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } - return function() { - var now = new Date; - if (!timeoutId && !leading) { - lastCalled = now; - } - var remaining = wait - (now - lastCalled); - args = arguments; - thisArg = this; + options = getObject(); + options.leading = leading; + options.maxWait = wait; + options.trailing = trailing; - if (remaining <= 0) { - clearTimeout(timeoutId); - timeoutId = null; - lastCalled = now; - result = func.apply(thisArg, args); - } - else if (!timeoutId) { - timeoutId = setTimeout(trailingCall, remaining); - } - return result; - }; + var result = debounce(func, wait, options); + releaseObject(options); + return result; } /** diff --git a/test/test.js b/test/test.js index 2dc8116ec8..c21766b79c 100644 --- a/test/test.js +++ b/test/test.js @@ -634,6 +634,34 @@ QUnit.start(); }, 64); }); + + asyncTest('should work with `maxWait` option', function() { + var limit = 96, + withCount = 0, + withoutCount = 0; + + var withMaxWait = _.debounce(function() { + withCount++; + }, 32, { 'maxWait': 64 }); + + var withoutMaxWait = _.debounce(function() { + withoutCount++; + }, 32); + + var start = new Date; + while ((new Date - start) < limit) { + withMaxWait(); + withoutMaxWait(); + } + strictEqual(withCount, 1); + strictEqual(withoutCount, 0); + + setTimeout(function() { + strictEqual(withCount, 2); + strictEqual(withoutCount, 1); + QUnit.start(); + }, 64); + }); }()); /*--------------------------------------------------------------------------*/ From 7f5c97d0becf6e4802fa3307c38898d8227f8307 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 10 Jun 2013 11:54:09 -0700 Subject: [PATCH 111/117] Avoid `Array.prototype` issues in Narwhal. Former-commit-id: 47627a187d59fb83f4a5b84b03158432d5216395 --- build.js | 16 ++++++++-------- lodash.js | 43 +++++++++++++++++++++++++------------------ 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/build.js b/build.js index 3909ebcacf..c9dc07335d 100755 --- a/build.js +++ b/build.js @@ -18,10 +18,10 @@ var cwd = process.cwd(); /** Used for array method references */ - var arrayProto = Array.prototype; + var arrayRef = Array.prototype; /** Shortcut used to push arrays of values to an array */ - var push = arrayProto.push; + var push = arrayRef.push; /** Used to create regexes that may detect multi-line comment blocks */ var multilineComment = '(?:\\n +/\\*[^*]*\\*+(?:[^/][^*]*\\*+)*/)?\\n'; @@ -30,7 +30,7 @@ var reNode = RegExp('(?:^|' + path.sepEscaped + ')node(?:\\.exe)?$'); /** Shortcut used to convert array-like objects to arrays */ - var slice = arrayProto.slice; + var slice = arrayRef.slice; /** Shortcut to the `stdout` object */ var stdout = process.stdout; @@ -470,7 +470,7 @@ return indent + [ '// add `Array` mutator functions to the wrapper', funcName + "(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) {", - ' var func = arrayProto[methodName];', + ' var func = arrayRef[methodName];', ' lodash.prototype[methodName] = function() {', ' var value = this.__wrapped__;', ' func.apply(value, arguments);', @@ -486,7 +486,7 @@ '', '// add `Array` accessor functions to the wrapper', funcName + "(['concat', 'join', 'slice'], function(methodName) {", - ' var func = arrayProto[methodName];', + ' var func = arrayRef[methodName];', ' lodash.prototype[methodName] = function() {', ' var value = this.__wrapped__,', ' result = func.apply(value, arguments);', @@ -2434,7 +2434,7 @@ ' var index = -1,', ' indexOf = getIndexOf(),', ' length = array.length,', - ' flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', + ' flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', ' result = [];', '', ' while (++index < length) {', @@ -2676,7 +2676,7 @@ source = replaceFunction(source, 'omit', [ 'function omit(object) {', ' var indexOf = getIndexOf(),', - ' props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', + ' props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', ' result = {};', '', ' forIn(object, function(value, key) {', @@ -2693,7 +2693,7 @@ source = replaceFunction(source, 'pick', [ 'function pick(object) {', ' var index = -1,', - ' props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)),', + ' props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)),', ' length = props.length,', ' result = {};', '', diff --git a/lodash.js b/lodash.js index be0e8f7c7d..e84a60674d 100644 --- a/lodash.js +++ b/lodash.js @@ -465,9 +465,16 @@ String = context.String, TypeError = context.TypeError; - /** Used for `Array` and `Object` method references */ - var arrayProto = Array.prototype, - errorProto = Error.prototype, + /** + * Used for `Array` method references. + * + * Normally `Array.prototype` would suffice, however, using an array literal + * avoids issues in Narwhal. + */ + var arrayRef = []; + + /** Used for native method references */ + var errorProto = Error.prototype, objectProto = Object.prototype, stringProto = String.prototype; @@ -484,12 +491,12 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, - concat = arrayProto.concat, + concat = arrayRef.concat, floor = Math.floor, fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, - push = arrayProto.push, + push = arrayRef.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, setImmediate = context.setImmediate, setTimeout = context.setTimeout, @@ -506,7 +513,7 @@ nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, - nativeSlice = arrayProto.slice; + nativeSlice = arrayRef.slice; /** Detect various environments */ var isIeOpera = reNative.test(context.attachEvent), @@ -729,7 +736,7 @@ * @memberOf _.support * @type Boolean */ - support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]); + support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); /** * Detect lack of support for accessing string characters by index. @@ -2426,7 +2433,7 @@ if (isFunc) { callback = lodash.createCallback(callback, thisArg); } else { - var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)); + var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)); } forIn(object, function(value, key, object) { if (isFunc @@ -2495,7 +2502,7 @@ var result = {}; if (typeof callback != 'function') { var index = -1, - props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), length = isObject(object) ? props.length : 0; while (++index < length) { @@ -2616,7 +2623,7 @@ */ function at(collection) { var index = -1, - props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), length = props.length, result = Array(length); @@ -3661,7 +3668,7 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - seen = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + seen = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), result = []; var isLarge = length >= largeArraySize && indexOf === basicIndexOf; @@ -4345,9 +4352,9 @@ */ function union(array) { if (!isArray(array)) { - arguments[0] = array ? nativeSlice.call(array) : arrayProto; + arguments[0] = array ? nativeSlice.call(array) : arrayRef; } - return uniq(concat.apply(arrayProto, arguments)); + return uniq(concat.apply(arrayRef, arguments)); } /** @@ -4622,7 +4629,7 @@ * // => alerts 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object), + var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; @@ -5828,7 +5835,7 @@ // add `Array` functions that return unwrapped values basicEach(['join', 'pop', 'shift'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { return func.apply(this.__wrapped__, arguments); }; @@ -5836,7 +5843,7 @@ // add `Array` functions that return the wrapped value basicEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; @@ -5845,7 +5852,7 @@ // add `Array` functions that return new wrapped values basicEach(['concat', 'slice', 'splice'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments)); }; @@ -5855,7 +5862,7 @@ // in Firefox < 10 and IE < 9 if (!support.spliceObjects) { basicEach(['pop', 'shift', 'splice'], function(methodName) { - var func = arrayProto[methodName], + var func = arrayRef[methodName], isSplice = methodName == 'splice'; lodash.prototype[methodName] = function() { From 9747d5057d62b9517581992d5b4528d8f68bda1f Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 10 Jun 2013 11:55:51 -0700 Subject: [PATCH 112/117] Update builds and docs. Former-commit-id: 413e8a906dee3407baf848c4607d9887f57fac85 --- dist/lodash.compat.js | 179 +++++++++++++----------- dist/lodash.compat.min.js | 90 ++++++------ dist/lodash.js | 159 +++++++++++---------- dist/lodash.min.js | 82 +++++------ dist/lodash.underscore.js | 62 +++++---- dist/lodash.underscore.min.js | 58 ++++---- doc/README.md | 252 +++++++++++++++++----------------- 7 files changed, 465 insertions(+), 417 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 5dbb115d76..ea4efaeb63 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -12,18 +12,6 @@ /** Used as a safe reference for `undefined` in pre ES5 environments */ var undefined; - /** Detect free variable `exports` */ - var freeExports = typeof exports == 'object' && exports; - - /** Detect free variable `module` */ - var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; - - /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - window = freeGlobal; - } - /** Used to pool arrays and objects used internally */ var arrayPool = [], objectPool = []; @@ -147,6 +135,18 @@ '\u2029': 'u2029' }; + /** Detect free variable `exports` */ + var freeExports = objectTypes[typeof exports] && exports; + + /** Detect free variable `module` */ + var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module; + + /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + window = freeGlobal; + } + /*--------------------------------------------------------------------------*/ /** @@ -325,26 +325,29 @@ */ function getObject() { return objectPool.pop() || { - 'args': null, + 'args': '', 'array': null, - 'bottom': null, + 'bottom': '', 'criteria': null, - 'false': null, - 'firstArg': null, - 'index': null, - 'init': null, - 'loop': null, - 'null': null, + 'false': false, + 'firstArg': '', + 'index': 0, + 'init': '', + 'leading': false, + 'loop': '', + 'maxWait': 0, + 'null': false, 'number': null, 'object': null, 'push': null, 'shadowedProps': null, 'string': null, - 'top': null, - 'true': null, - 'undefined': null, - 'useHas': null, - 'useKeys': null, + 'top': '', + 'trailing': false, + 'true': false, + 'undefined': false, + 'useHas': false, + 'useKeys': false, 'value': null }; } @@ -462,9 +465,16 @@ String = context.String, TypeError = context.TypeError; - /** Used for `Array` and `Object` method references */ - var arrayProto = Array.prototype, - errorProto = Error.prototype, + /** + * Used for `Array` method references. + * + * Normally `Array.prototype` would suffice, however, using an array literal + * avoids issues in Narwhal. + */ + var arrayRef = []; + + /** Used for native method references */ + var errorProto = Error.prototype, objectProto = Object.prototype, stringProto = String.prototype; @@ -481,12 +491,12 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, - concat = arrayProto.concat, + concat = arrayRef.concat, floor = Math.floor, fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, - push = arrayProto.push, + push = arrayRef.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, setImmediate = context.setImmediate, setTimeout = context.setTimeout, @@ -503,7 +513,7 @@ nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, - nativeSlice = arrayProto.slice; + nativeSlice = arrayRef.slice; /** Detect various environments */ var isIeOpera = reNative.test(context.attachEvent), @@ -726,7 +736,7 @@ * @memberOf _.support * @type Boolean */ - support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]); + support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); /** * Detect lack of support for accessing string characters by index. @@ -2404,7 +2414,7 @@ if (isFunc) { callback = lodash.createCallback(callback, thisArg); } else { - var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)); + var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)); } forIn(object, function(value, key, object) { if (isFunc @@ -2473,7 +2483,7 @@ var result = {}; if (typeof callback != 'function') { var index = -1, - props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), length = isObject(object) ? props.length : 0; while (++index < length) { @@ -2594,7 +2604,7 @@ */ function at(collection) { var index = -1, - props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), length = props.length, result = Array(length); @@ -3639,7 +3649,7 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - seen = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + seen = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), result = []; var isLarge = length >= largeArraySize && indexOf === basicIndexOf; @@ -4323,9 +4333,9 @@ */ function union(array) { if (!isArray(array)) { - arguments[0] = array ? nativeSlice.call(array) : arrayProto; + arguments[0] = array ? nativeSlice.call(array) : arrayRef; } - return uniq(concat.apply(arrayProto, arguments)); + return uniq(concat.apply(arrayRef, arguments)); } /** @@ -4600,7 +4610,7 @@ * // => alerts 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object), + var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; @@ -4791,6 +4801,7 @@ * @param {Number} wait The number of milliseconds to delay. * @param {Object} options The options object. * [leading=false] A boolean to specify execution on the leading edge of the timeout. + * [maxWait] The maximum time `func` is allowed to be delayed before it's called. * [trailing=true] A boolean to specify execution on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example @@ -4808,35 +4819,67 @@ result, thisArg, callCount = 0, + lastCalled = 0, + maxWait = false, + maxTimeoutId = null, timeoutId = null, trailing = true; - function delayed() { + function trailingCall() { var isCalled = trailing && (!leading || callCount > 1); - callCount = timeoutId = 0; + callCount = 0; + + clearTimeout(maxTimeoutId); + clearTimeout(timeoutId); + maxTimeoutId = timeoutId = null; + if (isCalled) { + lastCalled = new Date; result = func.apply(thisArg, args); } } + wait = nativeMax(0, wait || 0); if (options === true) { var leading = true; trailing = false; } else if (isObject(options)) { + maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); leading = options.leading; trailing = 'trailing' in options ? options.trailing : trailing; } return function() { + var now = new Date; + if (!timeoutId && !leading) { + lastCalled = now; + } + var remaining = (maxWait || wait) - (now - lastCalled); args = arguments; thisArg = this; + callCount++; // avoid issues with Titanium and `undefined` timeout ids // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); + timeoutId = null; - if (leading && ++callCount < 2) { - result = func.apply(thisArg, args); + if (maxWait === false) { + if (leading && callCount < 2) { + result = func.apply(thisArg, args); + } + } else { + if (remaining <= 0) { + clearTimeout(maxTimeoutId); + maxTimeoutId = null; + lastCalled = now; + result = func.apply(thisArg, args); + } + else if (!maxTimeoutId) { + maxTimeoutId = setTimeout(trailingCall, remaining); + } + } + if (wait !== maxWait) { + timeoutId = setTimeout(trailingCall, wait); } - timeoutId = setTimeout(delayed, wait); return result; }; } @@ -5037,47 +5080,23 @@ * })); */ function throttle(func, wait, options) { - var args, - result, - thisArg, - lastCalled = 0, - leading = true, - timeoutId = null, + var leading = true, trailing = true; - function trailingCall() { - timeoutId = null; - if (trailing) { - lastCalled = new Date; - result = func.apply(thisArg, args); - } - } if (options === false) { leading = false; } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } - return function() { - var now = new Date; - if (!timeoutId && !leading) { - lastCalled = now; - } - var remaining = wait - (now - lastCalled); - args = arguments; - thisArg = this; + options = getObject(); + options.leading = leading; + options.maxWait = wait; + options.trailing = trailing; - if (remaining <= 0) { - clearTimeout(timeoutId); - timeoutId = null; - lastCalled = now; - result = func.apply(thisArg, args); - } - else if (!timeoutId) { - timeoutId = setTimeout(trailingCall, remaining); - } - return result; - }; + var result = debounce(func, wait, options); + releaseObject(options); + return result; } /** @@ -5797,7 +5816,7 @@ // add `Array` functions that return unwrapped values basicEach(['join', 'pop', 'shift'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { return func.apply(this.__wrapped__, arguments); }; @@ -5805,7 +5824,7 @@ // add `Array` functions that return the wrapped value basicEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; @@ -5814,7 +5833,7 @@ // add `Array` functions that return new wrapped values basicEach(['concat', 'slice', 'splice'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments)); }; @@ -5824,7 +5843,7 @@ // in Firefox < 10 and IE < 9 if (!support.spliceObjects) { basicEach(['pop', 'shift', 'splice'], function(methodName) { - var func = arrayProto[methodName], + var func = arrayRef[methodName], isSplice = methodName == 'splice'; lodash.prototype[methodName] = function() { diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 895eb593f1..d7133dc728 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -4,48 +4,48 @@ * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nr?0:r);++ek;k++)e+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+n.f+"}"; -e+="}"}return(n.b||Nr.nonEnumArgs)&&(e+="}"),e+=n.c+";return C",t=t("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}"),g(n),t(Q,nr,pr,ft,$r,dt,Dr,_,tr,et,Br,tt,rr,yr)}function I(n){return yt(n)?dr(n):{}}function ut(n){return Tr[n]}function ot(){var n=(n=_.indexOf)===Pt?t:n;return n}function it(n){return function(t,r,e,u){return typeof r!="boolean"&&r!=d&&(u=e,e=u&&u[r]===t?y:r,r=b),e!=d&&(e=_.createCallback(e,u)),n(t,r,e,u)}}function lt(n){var t,r;return!n||yr.call(n)!=Z||(t=n.constructor,ht(t)&&!(t instanceof t))||!Nr.argsClass&&ft(n)||!Nr.nodeClass&&f(n)?b:Nr.ownLast?(Jr(n,function(n,t,e){return r=pr.call(e,t),b -}),r!==false):(Jr(n,function(n,t){r=t}),r===y||pr.call(n,r))}function ct(n){return Lr[n]}function ft(n){return yr.call(n)==M}function pt(n,t,r,e,u,a){var o=n;if(typeof t!="boolean"&&t!=d&&(e=r,r=t,t=b),typeof r=="function"){if(r=typeof e=="undefined"?r:_.createCallback(r,e,1),o=r(o),typeof o!="undefined")return o;o=n}if(e=yt(o)){var i=yr.call(o);if(!rt[i]||!Nr.nodeClass&&f(o))return o;var c=$r(o)}if(!e||!t)return e?c?v(o):Gr({},o):o;switch(e=Ir[i],i){case V:case W:return new e(+o);case Y:case tt:return new e(o); -case nt:return e(o.source,$.exec(o))}i=!u,u||(u=l()),a||(a=l());for(var p=u.length;p--;)if(u[p]==n)return a[p];return o=c?e(o.length):{},c&&(pr.call(n,"index")&&(o.index=n.index),pr.call(n,"input")&&(o.input=n.input)),u.push(n),a.push(o),(c?Rr:Kr)(n,function(n,e){o[e]=pt(n,t,r,y,u,a)}),i&&(s(u),s(a)),o}function st(n){var t=[];return Jr(n,function(n,r){ht(n)&&t.push(r)}),t.sort()}function gt(n){for(var t=-1,r=Dr(n),e=r.length,u={};++tr?wr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(dt(n)?n.indexOf(t,r):u(n,t,r)):Rr(n,function(n){return++ea&&(a=i)}}else t=!t&&dt(n)?u:_.createCallback(t,r),Rr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function St(n,t,r,e){var u=3>arguments.length;if(t=_.createCallback(t,e,4),$r(n)){var a=-1,o=n.length;for(u&&(r=n[++a]);++aarguments.length;if(typeof a!="number")var i=Dr(n),a=i.length;else Nr.unindexedChars&&dt(n)&&(u=n.split(""));return t=_.createCallback(t,e,4),xt(n,function(n,e,l){e=i?i[--a]:--a,r=o?(o=b,u[e]):t(r,u[e],e,l) -}),r}function It(n,t,r){var e;if(t=_.createCallback(t,r),$r(n)){r=-1;for(var u=n.length;++r=A&&u===t;if(c){var f=o(i);f?(u=r,i=f):c=b}for(;++eu(i,f)&&l.push(f);return c&&g(i),l}function Nt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=-1;for(t=_.createCallback(t,r);++ae?wr(0,u+e):e||0}else if(e)return e=Ft(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function zt(n,t,r){if(typeof t!="number"&&t!=d){var e=0,u=-1,a=n?n.length:0;for(t=_.createCallback(t,r);++u>>1,r(n[e])r?0:r);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:q,variable:"",imports:{_:_}};var Pr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Lr=gt(Tr),Gr=x(Pr,{h:Pr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Hr=x(Pr),Jr=x(zr,Fr,{i:b}),Kr=x(zr,Fr); -ht(/x/)&&(ht=function(n){return typeof n=="function"&&yr.call(n)==X});var Mr=fr?function(n){if(!n||yr.call(n)!=Z||!Nr.argsClass&&ft(n))return b;var t=n.valueOf,r=typeof t=="function"&&(r=fr(t))&&fr(r);return r?n==r||fr(n)==r:lt(n)}:lt,Ur=Ot,Vr=it(function Xr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e=A&&i===t,v=u||p?l():f;if(p){var h=o(v);h?(i=r,v=h):(p=b,v=u?v:(s(v),f)) -}for(;++ai(v,y))&&((u||p)&&v.push(y),f.push(h))}return p?(s(v.o),g(v)):u&&s(v),f});Ar&&C&&typeof vr=="function"&&(Rt=Dt(vr,e));var Qr=8==xr(R+"08")?xr:function(n,t){return xr(dt(n)?n.replace(T,""):n,t||0)};return _.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},_.assign=Gr,_.at=function(n){var t=-1,r=ir.apply(Zt,Er.call(arguments,1)),e=r.length,u=Ht(e);for(Nr.unindexedChars&&dt(n)&&(n=n.split(""));++t++i&&(a=n.apply(o,u)),l=hr(e,t),a}},_.defaults=Hr,_.defer=Rt,_.delay=function(n,t){var r=Er.call(arguments,2);return hr(function(){n.apply(y,r)},t)},_.difference=Bt,_.filter=wt,_.flatten=Vr,_.forEach=xt,_.forIn=Jr,_.forOwn=Kr,_.functions=st,_.groupBy=function(n,t,r){var e={};return t=_.createCallback(t,r),xt(n,function(n,r,u){r=Xt(t(n,r,u)),(pr.call(e,r)?e[r]:e[r]=[]).push(n) -}),e},_.initial=function(n,t,r){if(!n)return[];var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++}else e=t==d||r?1:t||e;return v(n,0,kr(wr(0,u-e),u))},_.intersection=function(n){for(var e=arguments,u=e.length,a=-1,i=l(),c=-1,f=ot(),p=n?n.length:0,v=[],h=l();++a=A&&o(a?e[a]:h)}n:for(;++c(m?r(m,y):f(h,y))){for(a=u,(m||h).push(y);--a;)if(m=i[a],0>(m?r(m,y):f(e[a],y)))continue n; -v.push(y)}}for(;u--;)(m=i[u])&&g(m);return s(i),s(h),v},_.invert=gt,_.invoke=function(n,t){var r=Er.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Ht(typeof a=="number"?a:0);return xt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},_.keys=Dr,_.map=Ot,_.max=Et,_.memoize=function(n,t){function r(){var e=r.cache,u=S+(t?t.apply(this,arguments):arguments[0]);return pr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},_.merge=bt,_.min=function(n,t,r){var e=1/0,a=e;if(!t&&$r(n)){r=-1; -for(var o=n.length;++re(o,r))&&(a[r]=n)}),a},_.once=function(n){var t,r;return function(){return t?r:(t=m,r=n.apply(this,arguments),n=d,r)}},_.pairs=function(n){for(var t=-1,r=Dr(n),e=r.length,u=Ht(e);++tr?wr(0,e+r):kr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},_.mixin=Lt,_.noConflict=function(){return e._=er,this},_.parseInt=Qr,_.random=function(n,t){n==d&&t==d&&(t=1),n=+n||0,t==d?(t=n,n=0):t=+t||0; -var r=Or();return n%1||t%1?n+kr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+lr(r*(t-n+1))},_.reduce=St,_.reduceRight=At,_.result=function(n,t){var r=n?n[t]:y;return ht(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Dr(n).length},_.some=It,_.sortedIndex=Ft,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Hr({},r,e);var u,a=Hr({},r.imports,e.imports),e=Dr(a),a=_t(a),o=0,l=r.interpolate||L,c="__p+='",l=Qt((r.escape||L).source+"|"+l.source+"|"+(l===q?F:L).source+"|"+(r.evaluate||L).source+"|$","g"); -n.replace(l,function(t,r,e,a,l,f){return e||(e=a),c+=n.slice(o,f).replace(H,i),r&&(c+="'+__e("+r+")+'"),l&&(u=m,c+="';"+l+";__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),c+="';\n",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(u?c.replace(B,""):c).replace(N,"$1").replace(P,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var f=Mt(e,"return "+c).apply(y,a) -}catch(p){throw p.source=c,p}return t?f(t):(f.source=c,f)},_.unescape=function(n){return n==d?"":Xt(n).replace(z,ct)},_.uniqueId=function(n){var t=++O;return Xt(n==d?"":n)+t},_.all=jt,_.any=It,_.detect=kt,_.findWhere=kt,_.foldl=St,_.foldr=At,_.include=Ct,_.inject=St,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return sr.apply(t,arguments),n.apply(_,t)})}),_.first=Nt,_.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++ -}else if(e=t,e==d||r)return n[u-1];return v(n,wr(0,u-e))}},_.take=Nt,_.head=Nt,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==d||r&&typeof t!="function"?e:new j(e)})}),_.VERSION="1.2.1",_.prototype.toString=function(){return Xt(this.__wrapped__)},_.prototype.value=Gt,_.prototype.valueOf=Gt,Rr(["join","pop","shift"],function(n){var t=Zt[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Rr(["push","reverse","sort","unshift"],function(n){var t=Zt[n]; -_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Rr(["concat","slice","splice"],function(n){var t=Zt[n];_.prototype[n]=function(){return new j(t.apply(this.__wrapped__,arguments))}}),Nr.spliceObjects||Rr(["pop","shift","splice"],function(n){var t=Zt[n],r="splice"==n;_.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new j(e):e}}),_}var y,m=!0,d=null,b=!1,_=typeof exports=="object"&&exports,C=typeof module=="object"&&module&&module.exports==_&&module,j=typeof global=="object"&&global; -(j.global===j||j.window===j)&&(n=j);var w=[],x=[],O=0,E={},S=+new Date+"",A=75,I=10,B=/\b__p\+='';/g,N=/\b(__p\+=)''\+/g,P=/(__e\(.*?\)|\b__t\))\+'';/g,z=/&(?:amp|lt|gt|quot|#39);/g,F=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,$=/\w*$/,q=/<%=([\s\S]+?)%>/g,D=(D=/\bthis\b/)&&D.test(h)&&D,R=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",T=RegExp("^["+R+"]*0+(?=.$)"),L=/($^)/,G=/[&<>"']/g,H=/['\n\r\t\u2028\u2029\\]/g,J="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),K="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),M="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",Q="[object Error]",X="[object Function]",Y="[object Number]",Z="[object Object]",nt="[object RegExp]",tt="[object String]",rt={}; -rt[X]=b,rt[M]=rt[U]=rt[V]=rt[W]=rt[Y]=rt[Z]=rt[nt]=rt[tt]=m;var et={"boolean":b,"function":m,object:m,number:b,string:b,undefined:b},ut={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},at=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=at, define(function(){return at})):_&&!_.nodeType?C?(C.exports=at)._=at:_._=at:n._=at}(this); \ No newline at end of file +;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(nr?0:r);++ek;k++)e+="m='"+n.g[k]+"';if((!(p&&v[m])&&l.call(r,m))",n.i||(e+="||(!v[m]&&r[m]!==y[m])"),e+="){"+n.f+"}"; +e+="}"}return(n.b||Pr.nonEnumArgs)&&(e+="}"),e+=n.c+";return C",t=t("i,j,l,n,o,q,t,u,y,z,w,G,H,J",r+e+"}"),g(n),t(M,tr,sr,ft,qr,dt,Rr,_,rr,nt,Nr,Y,er,yr)}function rt(n){return mt(n)?br(n):{}}function ut(n){return Wr[n]}function ot(){var n=(n=_.indexOf)===Pt?t:n;return n}function it(n){return function(t,r,e,u){return typeof r!="boolean"&&r!=d&&(u=e,e=u&&u[r]===t?m:r,r=b),e!=d&&(e=_.createCallback(e,u)),n(t,r,e,u)}}function lt(n){var t,r;return!n||yr.call(n)!=Q||(t=n.constructor,ht(t)&&!(t instanceof t))||!Pr.argsClass&&ft(n)||!Pr.nodeClass&&f(n)?b:Pr.ownLast?(Jr(n,function(n,t,e){return r=sr.call(e,t),b +}),r!==false):(Jr(n,function(n,t){r=t}),r===m||sr.call(n,r))}function ct(n){return Lr[n]}function ft(n){return yr.call(n)==G}function pt(n,t,r,e,u,a){var o=n;if(typeof t!="boolean"&&t!=d&&(e=r,r=t,t=b),typeof r=="function"){if(r=typeof e=="undefined"?r:_.createCallback(r,e,1),o=r(o),typeof o!="undefined")return o;o=n}if(e=mt(o)){var i=yr.call(o);if(!Z[i]||!Pr.nodeClass&&f(o))return o;var c=qr(o)}if(!e||!t)return e?c?v(o):Gr({},o):o;switch(e=Br[i],i){case J:case K:return new e(+o);case V:case Y:return new e(o); +case X:return e(o.source,P.exec(o))}i=!u,u||(u=l()),a||(a=l());for(var p=u.length;p--;)if(u[p]==n)return a[p];return o=c?e(o.length):{},c&&(sr.call(n,"index")&&(o.index=n.index),sr.call(n,"input")&&(o.input=n.input)),u.push(n),a.push(o),(c?Tr:Kr)(n,function(n,e){o[e]=pt(n,t,r,m,u,a)}),i&&(s(u),s(a)),o}function st(n){var t=[];return Jr(n,function(n,r){ht(n)&&t.push(r)}),t.sort()}function gt(n){for(var t=-1,r=Rr(n),e=r.length,u={};++tr?kr(0,a+r):r)||0,a&&typeof a=="number"?o=-1<(dt(n)?n.indexOf(t,r):u(n,t,r)):Tr(n,function(n){return++ea&&(a=i)}}else t=!t&&dt(n)?u:_.createCallback(t,r),Tr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function St(n,t,r,e){var u=3>arguments.length;if(t=_.createCallback(t,e,4),qr(n)){var a=-1,o=n.length;for(u&&(r=n[++a]);++aarguments.length;if(typeof a!="number")var i=Rr(n),a=i.length;else Pr.unindexedChars&&dt(n)&&(u=n.split(""));return t=_.createCallback(t,e,4),xt(n,function(n,e,l){e=i?i[--a]:--a,r=o?(o=b,u[e]):t(r,u[e],e,l) +}),r}function It(n,t,r){var e;if(t=_.createCallback(t,r),qr(n)){r=-1;for(var u=n.length;++r=O&&u===t;if(c){var f=o(i);f?(u=r,i=f):c=b}for(;++eu(i,f)&&l.push(f);return c&&g(i),l}function Nt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=-1;for(t=_.createCallback(t,r);++ae?kr(0,u+e):e||0}else if(e)return e=Ft(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function zt(n,t,r){if(typeof t!="number"&&t!=d){var e=0,u=-1,a=n?n.length:0;for(t=_.createCallback(t,r);++u>>1,r(n[e])r?0:r);++ti&&(a=n.apply(o,u)):0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:z,variable:"",imports:{_:_}};var zr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b":">",'"':""","'":"'"},Lr=gt(Wr),Gr=tt(zr,{h:zr.h.replace(";",";if(c>3&&typeof a[c-2]=='function'){var d=u.createCallback(a[--c-1],a[c--],2)}else if(c>2&&typeof a[c-1]=='function'){d=a[--c]}"),f:"C[m]=d?d(C[m],r[m]):r[m]"}),Hr=tt(zr),Jr=tt(Fr,$r,{i:b}),Kr=tt(Fr,$r); +ht(/x/)&&(ht=function(n){return typeof n=="function"&&yr.call(n)==U});var Mr=pr?function(n){if(!n||yr.call(n)!=Q||!Pr.argsClass&&ft(n))return b;var t=n.valueOf,r=typeof t=="function"&&(r=pr(t))&&pr(r);return r?n==r||pr(n)==r:lt(n)}:lt,Ur=Ot,Vr=it(function Yr(n,t,r){for(var e=-1,u=n?n.length:0,a=[];++e=O&&i===t,v=u||p?l():f;if(p){var h=o(v);h?(i=r,v=h):(p=b,v=u?v:(s(v),f)) +}for(;++ai(v,m))&&((u||p)&&v.push(m),f.push(h))}return p?(s(v.b),g(v)):u&&s(v),f});Ir&&et&&typeof hr=="function"&&(Tt=Dt(hr,e));var Xr=8==Or($+"08")?Or:function(n,t){return Or(dt(n)?n.replace(q,""):n,t||0)};return _.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},_.assign=Gr,_.at=function(n){var t=-1,r=lr.apply(nr,Sr.call(arguments,1)),e=r.length,u=Ht(e);for(Pr.unindexedChars&&dt(n)&&(n=n.split(""));++t=O&&o(a?e[a]:h)}n:for(;++c(y?r(y,m):f(h,m))){for(a=u,(y||h).push(m);--a;)if(y=i[a],0>(y?r(y,m):f(e[a],m)))continue n;v.push(m)}}for(;u--;)(y=i[u])&&g(y);return s(i),s(h),v},_.invert=gt,_.invoke=function(n,t){var r=Sr.call(arguments,2),e=-1,u=typeof t=="function",a=n?n.length:0,o=Ht(typeof a=="number"?a:0);return xt(n,function(n){o[++e]=(u?t:n[t]).apply(n,r)}),o},_.keys=Rr,_.map=Ot,_.max=Et,_.memoize=function(n,t){function r(){var e=r.cache,u=x+(t?t.apply(this,arguments):arguments[0]); +return sr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},_.merge=bt,_.min=function(n,t,r){var e=1/0,a=e;if(!t&&qr(n)){r=-1;for(var o=n.length;++re(o,r))&&(a[r]=n)}),a},_.once=function(n){var t,r; +return function(){return t?r:(t=y,r=n.apply(this,arguments),n=d,r)}},_.pairs=function(n){for(var t=-1,r=Rr(n),e=r.length,u=Ht(e);++tr?kr(0,e+r):xr(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},_.mixin=Lt,_.noConflict=function(){return e._=ur,this},_.parseInt=Xr,_.random=function(n,t){n==d&&t==d&&(t=1),n=+n||0,t==d?(t=n,n=0):t=+t||0; +var r=Er();return n%1||t%1?n+xr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+cr(r*(t-n+1))},_.reduce=St,_.reduceRight=At,_.result=function(n,t){var r=n?n[t]:m;return ht(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rr(n).length},_.some=It,_.sortedIndex=Ft,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Hr({},r,e);var u,a=Hr({},r.imports,e.imports),e=Rr(a),a=_t(a),o=0,l=r.interpolate||D,c="__p+='",l=Xt((r.escape||D).source+"|"+l.source+"|"+(l===z?N:D).source+"|"+(r.evaluate||D).source+"|$","g"); +n.replace(l,function(t,r,e,a,l,f){return e||(e=a),c+=n.slice(o,f).replace(T,i),r&&(c+="'+__e("+r+")+'"),l&&(u=y,c+="';"+l+";__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),c+="';\n",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(u?c.replace(S,""):c).replace(A,"$1").replace(I,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var f=Mt(e,"return "+c).apply(m,a) +}catch(p){throw p.source=c,p}return t?f(t):(f.source=c,f)},_.unescape=function(n){return n==d?"":Yt(n).replace(B,ct)},_.uniqueId=function(n){var t=++j;return Yt(n==d?"":n)+t},_.all=jt,_.any=It,_.detect=kt,_.findWhere=kt,_.foldl=St,_.foldr=At,_.include=Ct,_.inject=St,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return gr.apply(t,arguments),n.apply(_,t)})}),_.first=Nt,_.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++ +}else if(e=t,e==d||r)return n[u-1];return v(n,kr(0,u-e))}},_.take=Nt,_.head=Nt,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==d||r&&typeof t!="function"?e:new C(e)})}),_.VERSION="1.2.1",_.prototype.toString=function(){return Yt(this.__wrapped__)},_.prototype.value=Gt,_.prototype.valueOf=Gt,Tr(["join","pop","shift"],function(n){var t=nr[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Tr(["push","reverse","sort","unshift"],function(n){var t=nr[n]; +_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Tr(["concat","slice","splice"],function(n){var t=nr[n];_.prototype[n]=function(){return new C(t.apply(this.__wrapped__,arguments))}}),Pr.spliceObjects||Tr(["pop","shift","splice"],function(n){var t=nr[n],r="splice"==n;_.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new C(e):e}}),_}var m,y=!0,d=null,b=!1,_=[],C=[],j=0,w={},x=+new Date+"",O=75,E=10,S=/\b__p\+='';/g,A=/\b(__p\+=)''\+/g,I=/(__e\(.*?\)|\b__t\))\+'';/g,B=/&(?:amp|lt|gt|quot|#39);/g,N=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,P=/\w*$/,z=/<%=([\s\S]+?)%>/g,F=(F=/\bthis\b/)&&F.test(h)&&F,$=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",q=RegExp("^["+$+"]*0+(?=.$)"),D=/($^)/,R=/[&<>"']/g,T=/['\n\r\t\u2028\u2029\\]/g,W="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),G="[object Arguments]",H="[object Array]",J="[object Boolean]",K="[object Date]",M="[object Error]",U="[object Function]",V="[object Number]",Q="[object Object]",X="[object RegExp]",Y="[object String]",Z={}; +Z[U]=b,Z[G]=Z[H]=Z[J]=Z[K]=Z[V]=Z[Q]=Z[X]=Z[Y]=y;var nt={"boolean":b,"function":y,object:y,number:b,string:b,undefined:b},tt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},rt=nt[typeof exports]&&exports,et=nt[typeof module]&&module&&module.exports==rt&&module,ut=nt[typeof global]&&global;!ut||ut.global!==ut&&ut.window!==ut||(n=ut);var at=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=at, define(function(){return at})):rt&&!rt.nodeType?et?(et.exports=at)._=at:rt._=at:n._=at +}(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 756aeb8be5..9a7bec046d 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -12,18 +12,6 @@ /** Used as a safe reference for `undefined` in pre ES5 environments */ var undefined; - /** Detect free variable `exports` */ - var freeExports = typeof exports == 'object' && exports; - - /** Detect free variable `module` */ - var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; - - /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - window = freeGlobal; - } - /** Used to pool arrays and objects used internally */ var arrayPool = [], objectPool = []; @@ -141,6 +129,18 @@ '\u2029': 'u2029' }; + /** Detect free variable `exports` */ + var freeExports = objectTypes[typeof exports] && exports; + + /** Detect free variable `module` */ + var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module; + + /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + window = freeGlobal; + } + /*--------------------------------------------------------------------------*/ /** @@ -321,15 +321,18 @@ return objectPool.pop() || { 'array': null, 'criteria': null, - 'false': null, - 'index': null, - 'null': null, + 'false': false, + 'index': 0, + 'leading': false, + 'maxWait': 0, + 'null': false, 'number': null, 'object': null, 'push': null, 'string': null, - 'true': null, - 'undefined': null, + 'trailing': false, + 'true': false, + 'undefined': false, 'value': null }; } @@ -433,9 +436,16 @@ String = context.String, TypeError = context.TypeError; - /** Used for `Array` and `Object` method references */ - var arrayProto = Array.prototype, - objectProto = Object.prototype, + /** + * Used for `Array` method references. + * + * Normally `Array.prototype` would suffice, however, using an array literal + * avoids issues in Narwhal. + */ + var arrayRef = []; + + /** Used for native method references */ + var objectProto = Object.prototype, stringProto = String.prototype; /** Used to restore the original `_` reference in `noConflict` */ @@ -451,12 +461,12 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = context.clearTimeout, - concat = arrayProto.concat, + concat = arrayRef.concat, floor = Math.floor, fnToString = Function.prototype.toString, getPrototypeOf = reNative.test(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, hasOwnProperty = objectProto.hasOwnProperty, - push = arrayProto.push, + push = arrayRef.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, setImmediate = context.setImmediate, setTimeout = context.setTimeout, @@ -473,7 +483,7 @@ nativeMin = Math.min, nativeParseInt = context.parseInt, nativeRandom = Math.random, - nativeSlice = arrayProto.slice; + nativeSlice = arrayRef.slice; /** Detect various environments */ var isIeOpera = reNative.test(context.attachEvent), @@ -2062,7 +2072,7 @@ if (isFunc) { callback = lodash.createCallback(callback, thisArg); } else { - var props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)); + var props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)); } forIn(object, function(value, key, object) { if (isFunc @@ -2131,7 +2141,7 @@ var result = {}; if (typeof callback != 'function') { var index = -1, - props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), length = isObject(object) ? props.length : 0; while (++index < length) { @@ -2252,7 +2262,7 @@ */ function at(collection) { var index = -1, - props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), length = props.length, result = Array(length); @@ -3304,7 +3314,7 @@ var index = -1, indexOf = getIndexOf(), length = array ? array.length : 0, - seen = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + seen = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), result = []; var isLarge = length >= largeArraySize && indexOf === basicIndexOf; @@ -3988,9 +3998,9 @@ */ function union(array) { if (!isArray(array)) { - arguments[0] = array ? nativeSlice.call(array) : arrayProto; + arguments[0] = array ? nativeSlice.call(array) : arrayRef; } - return uniq(concat.apply(arrayProto, arguments)); + return uniq(concat.apply(arrayRef, arguments)); } /** @@ -4265,7 +4275,7 @@ * // => alerts 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object), + var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; @@ -4456,6 +4466,7 @@ * @param {Number} wait The number of milliseconds to delay. * @param {Object} options The options object. * [leading=false] A boolean to specify execution on the leading edge of the timeout. + * [maxWait] The maximum time `func` is allowed to be delayed before it's called. * [trailing=true] A boolean to specify execution on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example @@ -4473,35 +4484,67 @@ result, thisArg, callCount = 0, + lastCalled = 0, + maxWait = false, + maxTimeoutId = null, timeoutId = null, trailing = true; - function delayed() { + function trailingCall() { var isCalled = trailing && (!leading || callCount > 1); - callCount = timeoutId = 0; + callCount = 0; + + clearTimeout(maxTimeoutId); + clearTimeout(timeoutId); + maxTimeoutId = timeoutId = null; + if (isCalled) { + lastCalled = new Date; result = func.apply(thisArg, args); } } + wait = nativeMax(0, wait || 0); if (options === true) { var leading = true; trailing = false; } else if (isObject(options)) { + maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); leading = options.leading; trailing = 'trailing' in options ? options.trailing : trailing; } return function() { + var now = new Date; + if (!timeoutId && !leading) { + lastCalled = now; + } + var remaining = (maxWait || wait) - (now - lastCalled); args = arguments; thisArg = this; + callCount++; // avoid issues with Titanium and `undefined` timeout ids // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); + timeoutId = null; - if (leading && ++callCount < 2) { - result = func.apply(thisArg, args); + if (maxWait === false) { + if (leading && callCount < 2) { + result = func.apply(thisArg, args); + } + } else { + if (remaining <= 0) { + clearTimeout(maxTimeoutId); + maxTimeoutId = null; + lastCalled = now; + result = func.apply(thisArg, args); + } + else if (!maxTimeoutId) { + maxTimeoutId = setTimeout(trailingCall, remaining); + } + } + if (wait !== maxWait) { + timeoutId = setTimeout(trailingCall, wait); } - timeoutId = setTimeout(delayed, wait); return result; }; } @@ -4702,47 +4745,23 @@ * })); */ function throttle(func, wait, options) { - var args, - result, - thisArg, - lastCalled = 0, - leading = true, - timeoutId = null, + var leading = true, trailing = true; - function trailingCall() { - timeoutId = null; - if (trailing) { - lastCalled = new Date; - result = func.apply(thisArg, args); - } - } if (options === false) { leading = false; } else if (isObject(options)) { leading = 'leading' in options ? options.leading : leading; trailing = 'trailing' in options ? options.trailing : trailing; } - return function() { - var now = new Date; - if (!timeoutId && !leading) { - lastCalled = now; - } - var remaining = wait - (now - lastCalled); - args = arguments; - thisArg = this; + options = getObject(); + options.leading = leading; + options.maxWait = wait; + options.trailing = trailing; - if (remaining <= 0) { - clearTimeout(timeoutId); - timeoutId = null; - lastCalled = now; - result = func.apply(thisArg, args); - } - else if (!timeoutId) { - timeoutId = setTimeout(trailingCall, remaining); - } - return result; - }; + var result = debounce(func, wait, options); + releaseObject(options); + return result; } /** @@ -5462,7 +5481,7 @@ // add `Array` functions that return unwrapped values forEach(['join', 'pop', 'shift'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { return func.apply(this.__wrapped__, arguments); }; @@ -5470,7 +5489,7 @@ // add `Array` functions that return the wrapped value forEach(['push', 'reverse', 'sort', 'unshift'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { func.apply(this.__wrapped__, arguments); return this; @@ -5479,7 +5498,7 @@ // add `Array` functions that return new wrapped values forEach(['concat', 'slice', 'splice'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { return new lodashWrapper(func.apply(this.__wrapped__, arguments)); }; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 7c71843784..5183ed6396 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -4,43 +4,45 @@ * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n,t,e){e=(e||0)-1;for(var r=n.length;++et||typeof n=="undefined")return 1;if(ne?0:e);++re?de(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(yt(n)?n.indexOf(t,e):u(n,t,e)):_(n,function(n){return++ra&&(a=i) -}}else t=!t&&yt(n)?u:tt.createCallback(t,e),wt(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,a=n)});return a}function Ot(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Mt(r);++earguments.length;t=tt.createCallback(t,r,4);var a=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++a]);++aarguments.length; -if(typeof u!="number")var o=Ee(n),u=o.length;return t=tt.createCallback(t,r,4),wt(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=b,n[i]):t(e,n[i],i,f)}),e}function It(n,t,e){var r;t=tt.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=O&&u===t;if(c){var l=o(i);l?(u=e,i=l):c=b}for(;++ru(i,l)&&f.push(l); -return c&&p(i),f}function Nt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=y){var a=-1;for(t=tt.createCallback(t,e);++ar?de(0,u+r):r||0}else if(r)return r=Ft(n,e),n[r]===e?r:-1;return n?t(n,e,r):-1}function Bt(n,t,e){if(typeof t!="number"&&t!=y){var r=0,u=-1,a=n?n.length:0;for(t=tt.createCallback(t,e);++u>>1,e(n[r])e?0:e);++t/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:F,variable:"",imports:{_:tt}};var Oe=he,Ee=me?function(n){return gt(n)?me(n):[]}:Z,Se={"&":"&","<":"<",">":">",'"':""","'":"'"},Ie=pt(Se),Ut=ot(function Ne(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=O&&i===t,g=u||v?f():s;if(v){var h=o(g);h?(i=e,g=h):(v=b,g=u?g:(l(g),s))}for(;++ai(g,y))&&((u||v)&&g.push(y),s.push(h))}return v?(l(g.a),p(g)):u&&l(g),s});return Gt&&d&&typeof le=="function"&&(Dt=qt(le,r)),le=8==ke(T+"08")?ke:function(n,t){return ke(yt(n)?n.replace(q,""):n,t||0)},tt.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},tt.assign=E,tt.at=function(n){for(var t=-1,e=ue.apply(Yt,we.call(arguments,1)),r=e.length,u=Mt(r);++t++i&&(a=n.apply(o,u)),f=pe(r,t),a}},tt.defaults=j,tt.defer=Dt,tt.delay=function(n,t){var e=we.call(arguments,2);return pe(function(){n.apply(g,e)},t)},tt.difference=At,tt.filter=kt,tt.flatten=Ut,tt.forEach=wt,tt.forIn=k,tt.forOwn=_,tt.functions=lt,tt.groupBy=function(n,t,e){var r={}; -return t=tt.createCallback(t,e),wt(n,function(n,e,u){e=Qt(t(n,e,u)),(fe.call(r,e)?r[e]:r[e]=[]).push(n)}),r},tt.initial=function(n,t,e){if(!n)return[];var r=0,u=n.length;if(typeof t!="number"&&t!=y){var a=u;for(t=tt.createCallback(t,e);a--&&t(n[a],a,n);)r++}else r=t==y||e?1:t||r;return s(n,0,_e(de(0,u-r),u))},tt.intersection=function(n){for(var r=arguments,u=r.length,a=-1,i=f(),c=-1,s=at(),v=n?n.length:0,g=[],h=f();++a=O&&o(a?r[a]:h)}n:for(;++c(b?e(b,y):s(h,y))){for(a=u,(b||h).push(y);--a;)if(b=i[a],0>(b?e(b,y):s(r[a],y)))continue n;g.push(y)}}for(;u--;)(b=i[u])&&p(b);return l(i),l(h),g},tt.invert=pt,tt.invoke=function(n,t){var e=we.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Mt(typeof a=="number"?a:0);return wt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},tt.keys=Ee,tt.map=Ct,tt.max=xt,tt.memoize=function(n,t){function e(){var r=e.cache,u=x+(t?t.apply(this,arguments):arguments[0]);return fe.call(r,u)?r[u]:r[u]=n.apply(this,arguments) -}return e.cache={},e},tt.merge=bt,tt.min=function(n,t,e){var r=1/0,a=r;if(!t&&Oe(n)){e=-1;for(var o=n.length;++er(o,e))&&(a[e]=n)}),a},tt.once=function(n){var t,e;return function(){return t?e:(t=h,e=n.apply(this,arguments),n=y,e) -}},tt.pairs=function(n){for(var t=-1,e=Ee(n),r=e.length,u=Mt(r);++te?de(0,r+e):_e(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},tt.mixin=Pt,tt.noConflict=function(){return r._=ne,this},tt.parseInt=le,tt.random=function(n,t){n==y&&t==y&&(t=1),n=+n||0,t==y?(t=n,n=0):t=+t||0;var e=je();return n%1||t%1?n+_e(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+ae(e*(t-n+1))},tt.reduce=Et,tt.reduceRight=St,tt.result=function(n,t){var e=n?n[t]:g;return vt(e)?n[t]():e},tt.runInContext=v,tt.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Ee(n).length -},tt.some=It,tt.sortedIndex=Ft,tt.template=function(n,t,e){var r=tt.templateSettings;n||(n=""),e=j({},e,r);var u,a=j({},e.imports,r.imports),r=Ee(a),a=mt(a),o=0,f=e.interpolate||D,c="__p+='",f=Lt((e.escape||D).source+"|"+f.source+"|"+(f===F?$:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(f,function(t,e,r,a,f,l){return r||(r=a),c+=n.slice(o,l).replace(P,i),e&&(c+="'+__e("+e+")+'"),f&&(u=h,c+="';"+f+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),o=l+t.length,t}),c+="';\n",f=e=e.variable,f||(e="obj",c="with("+e+"){"+c+"}"),c=(u?c.replace(S,""):c).replace(I,"$1").replace(A,"$1;"),c="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}"; -try{var l=Wt(r,"return "+c).apply(g,a)}catch(p){throw p.source=c,p}return t?l(t):(l.source=c,l)},tt.unescape=function(n){return n==y?"":Qt(n).replace(N,ft)},tt.uniqueId=function(n){var t=++w;return Qt(n==y?"":n)+t},tt.all=_t,tt.any=It,tt.detect=jt,tt.findWhere=jt,tt.foldl=Et,tt.foldr=St,tt.include=dt,tt.inject=Et,_(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(){var t=[this.__wrapped__];return ce.apply(t,arguments),n.apply(tt,t)})}),tt.first=Nt,tt.last=function(n,t,e){if(n){var r=0,u=n.length; -if(typeof t!="number"&&t!=y){var a=u;for(t=tt.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==y||e)return n[u-1];return s(n,de(0,u-r))}},tt.take=Nt,tt.head=Nt,_(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==y||e&&typeof t!="function"?r:new et(r)})}),tt.VERSION="1.2.1",tt.prototype.toString=function(){return Qt(this.__wrapped__)},tt.prototype.value=Kt,tt.prototype.valueOf=Kt,wt(["join","pop","shift"],function(n){var t=Yt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) -}}),wt(["push","reverse","sort","unshift"],function(n){var t=Yt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),wt(["concat","slice","splice"],function(n){var t=Yt[n];tt.prototype[n]=function(){return new et(t.apply(this.__wrapped__,arguments))}}),tt}var g,h=!0,y=null,b=!1,m=typeof exports=="object"&&exports,d=typeof module=="object"&&module&&module.exports==m&&module,_=typeof global=="object"&&global;(_.global===_||_.window===_)&&(n=_);var k=[],j=[],w=0,C={},x=+new Date+"",O=75,E=10,S=/\b__p\+='';/g,I=/\b(__p\+=)''\+/g,A=/(__e\(.*?\)|\b__t\))\+'';/g,N=/&(?:amp|lt|gt|quot|#39);/g,$=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,B=/\w*$/,F=/<%=([\s\S]+?)%>/g,R=(R=/\bthis\b/)&&R.test(v)&&R,T=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",q=RegExp("^["+T+"]*0+(?=.$)"),D=/($^)/,z=/[&<>"']/g,P=/['\n\r\t\u2028\u2029\\]/g,K="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),M="[object Arguments]",U="[object Array]",V="[object Boolean]",W="[object Date]",G="[object Function]",H="[object Number]",J="[object Object]",L="[object RegExp]",Q="[object String]",X={}; -X[G]=b,X[M]=X[U]=X[V]=X[W]=X[H]=X[J]=X[L]=X[Q]=h;var Y={"boolean":b,"function":h,object:h,number:b,string:b,undefined:b},Z={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},nt=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=nt, define(function(){return nt})):m&&!m.nodeType?d?(d.exports=nt)._=nt:m._=nt:n._=nt}(this); \ No newline at end of file +;!function(n){function t(n,t,e){e=(e||0)-1;for(var r=n.length;++et||typeof n=="undefined")return 1;if(ne?0:e);++re?_e(0,a+e):e)||0,a&&typeof a=="number"?o=-1<(yt(n)?n.indexOf(t,e):u(n,t,e)):d(n,function(n){return++ra&&(a=i) +}}else t=!t&&yt(n)?u:tt.createCallback(t,e),wt(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,a=n)});return a}function Ot(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Mt(r);++earguments.length;t=tt.createCallback(t,r,4);var a=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++a]);++aarguments.length; +if(typeof u!="number")var o=Se(n),u=o.length;return t=tt.createCallback(t,r,4),wt(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=b,n[i]):t(e,n[i],i,f)}),e}function It(n,t,e){var r;t=tt.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=w&&u===t;if(l){var c=o(i);c?(u=e,i=c):l=b}for(;++ru(i,c)&&f.push(c); +return l&&p(i),f}function Nt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=y){var a=-1;for(t=tt.createCallback(t,e);++ar?_e(0,u+r):r||0}else if(r)return r=Ft(n,e),n[r]===e?r:-1;return n?t(n,e,r):-1}function Bt(n,t,e){if(typeof t!="number"&&t!=y){var r=0,u=-1,a=n?n.length:0;for(t=tt.createCallback(t,e);++u>>1,e(n[r])e?0:e);++ti&&(a=n.apply(o,u)):0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:tt}};var Ee=ye,Se=de?function(n){return gt(n)?de(n):[]}:Z,Ie={"&":"&","<":"<",">":">",'"':""","'":"'"},Ae=pt(Ie),Ut=ot(function $e(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=w&&i===t,g=u||v?f():s;if(v){var h=o(g);h?(i=e,g=h):(v=b,g=u?g:(c(g),s))}for(;++ai(g,y))&&((u||v)&&g.push(y),s.push(h))}return v?(c(g.b),p(g)):u&&c(g),s});return Ht&&Y&&typeof pe=="function"&&(zt=qt(pe,r)),pe=8==je(B+"08")?je:function(n,t){return je(yt(n)?n.replace(F,""):n,t||0)},tt.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 +}},tt.assign=X,tt.at=function(n){for(var t=-1,e=ae.apply(Zt,Ce.call(arguments,1)),r=e.length,u=Mt(r);++t=w&&o(a?r[a]:h)}n:for(;++l(b?e(b,y):s(h,y))){for(a=u,(b||h).push(y);--a;)if(b=i[a],0>(b?e(b,y):s(r[a],y)))continue n;g.push(y)}}for(;u--;)(b=i[u])&&p(b);return c(i),c(h),g +},tt.invert=pt,tt.invoke=function(n,t){var e=Ce.call(arguments,2),r=-1,u=typeof t=="function",a=n?n.length:0,o=Mt(typeof a=="number"?a:0);return wt(n,function(n){o[++r]=(u?t:n[t]).apply(n,e)}),o},tt.keys=Se,tt.map=Ct,tt.max=xt,tt.memoize=function(n,t){function e(){var r=e.cache,u=j+(t?t.apply(this,arguments):arguments[0]);return le.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},tt.merge=bt,tt.min=function(n,t,e){var r=1/0,a=r;if(!t&&Ee(n)){e=-1;for(var o=n.length;++er(o,e))&&(a[e]=n)}),a},tt.once=function(n){var t,e;return function(){return t?e:(t=h,e=n.apply(this,arguments),n=y,e)}},tt.pairs=function(n){for(var t=-1,e=Se(n),r=e.length,u=Mt(r);++te?_e(0,r+e):ke(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},tt.mixin=Pt,tt.noConflict=function(){return r._=te,this},tt.parseInt=pe,tt.random=function(n,t){n==y&&t==y&&(t=1),n=+n||0,t==y?(t=n,n=0):t=+t||0; +var e=we();return n%1||t%1?n+ke(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+oe(e*(t-n+1))},tt.reduce=Et,tt.reduceRight=St,tt.result=function(n,t){var e=n?n[t]:g;return vt(e)?n[t]():e},tt.runInContext=v,tt.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Se(n).length},tt.some=It,tt.sortedIndex=Ft,tt.template=function(n,t,e){var r=tt.templateSettings;n||(n=""),e=Q({},e,r);var u,a=Q({},e.imports,r.imports),r=Se(a),a=mt(a),o=0,f=e.interpolate||R,l="__p+='",f=Qt((e.escape||R).source+"|"+f.source+"|"+(f===N?I:R).source+"|"+(e.evaluate||R).source+"|$","g"); +n.replace(f,function(t,e,r,a,f,c){return r||(r=a),l+=n.slice(o,c).replace(q,i),e&&(l+="'+__e("+e+")+'"),f&&(u=h,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),o=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(x,""):l).replace(O,"$1").replace(E,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=Gt(r,"return "+l).apply(g,a) +}catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},tt.unescape=function(n){return n==y?"":Xt(n).replace(S,ft)},tt.uniqueId=function(n){var t=++_;return Xt(n==y?"":n)+t},tt.all=_t,tt.any=It,tt.detect=jt,tt.findWhere=jt,tt.foldl=Et,tt.foldr=St,tt.include=dt,tt.inject=Et,d(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(){var t=[this.__wrapped__];return ce.apply(t,arguments),n.apply(tt,t)})}),tt.first=Nt,tt.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=y){var a=u; +for(t=tt.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==y||e)return n[u-1];return s(n,_e(0,u-r))}},tt.take=Nt,tt.head=Nt,d(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==y||e&&typeof t!="function"?r:new et(r)})}),tt.VERSION="1.2.1",tt.prototype.toString=function(){return Xt(this.__wrapped__)},tt.prototype.value=Kt,tt.prototype.valueOf=Kt,wt(["join","pop","shift"],function(n){var t=Zt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +}}),wt(["push","reverse","sort","unshift"],function(n){var t=Zt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),wt(["concat","slice","splice"],function(n){var t=Zt[n];tt.prototype[n]=function(){return new et(t.apply(this.__wrapped__,arguments))}}),tt}var g,h=!0,y=null,b=!1,m=[],d=[],_=0,k={},j=+new Date+"",w=75,C=10,x=/\b__p\+='';/g,O=/\b(__p\+=)''\+/g,E=/(__e\(.*?\)|\b__t\))\+'';/g,S=/&(?:amp|lt|gt|quot|#39);/g,I=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,N=/<%=([\s\S]+?)%>/g,$=($=/\bthis\b/)&&$.test(v)&&$,B=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",F=RegExp("^["+B+"]*0+(?=.$)"),R=/($^)/,T=/[&<>"']/g,q=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),z="[object Arguments]",W="[object Array]",P="[object Boolean]",K="[object Date]",M="[object Function]",U="[object Number]",V="[object Object]",G="[object RegExp]",H="[object String]",J={}; +J[M]=b,J[z]=J[W]=J[P]=J[K]=J[U]=J[V]=J[G]=J[H]=h;var L={"boolean":b,"function":h,object:h,number:b,string:b,undefined:b},Q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},X=L[typeof exports]&&exports,Y=L[typeof module]&&module&&module.exports==X&&module,Z=L[typeof global]&&global;!Z||Z.global!==Z&&Z.window!==Z||(n=Z);var nt=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=nt, define(function(){return nt})):X&&!X.nodeType?Y?(Y.exports=nt)._=nt:X._=nt:n._=nt +}(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index 2f19b82654..becb0b48ef 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -12,18 +12,6 @@ /** Used as a safe reference for `undefined` in pre ES5 environments */ var undefined; - /** Detect free variable `exports` */ - var freeExports = typeof exports == 'object' && exports; - - /** Detect free variable `module` */ - var freeModule = typeof module == 'object' && module && module.exports == freeExports && module; - - /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ - var freeGlobal = typeof global == 'object' && global; - if (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal) { - window = freeGlobal; - } - /** Used to generate unique IDs */ var idCounter = 0; @@ -101,6 +89,18 @@ '\u2029': 'u2029' }; + /** Detect free variable `exports` */ + var freeExports = objectTypes[typeof exports] && exports; + + /** Detect free variable `module` */ + var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module; + + /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + window = freeGlobal; + } + /*--------------------------------------------------------------------------*/ /** @@ -177,9 +177,16 @@ /*--------------------------------------------------------------------------*/ - /** Used for `Array` and `Object` method references */ - var arrayProto = Array.prototype, - objectProto = Object.prototype, + /** + * Used for `Array` method references. + * + * Normally `Array.prototype` would suffice, however, using an array literal + * avoids issues in Narwhal. + */ + var arrayRef = []; + + /** Used for native method references */ + var objectProto = Object.prototype, stringProto = String.prototype; /** Used to restore the original `_` reference in `noConflict` */ @@ -195,10 +202,10 @@ /** Native method shortcuts */ var ceil = Math.ceil, clearTimeout = window.clearTimeout, - concat = arrayProto.concat, + concat = arrayRef.concat, floor = Math.floor, hasOwnProperty = objectProto.hasOwnProperty, - push = arrayProto.push, + push = arrayRef.push, propertyIsEnumerable = objectProto.propertyIsEnumerable, setTimeout = window.setTimeout, toString = objectProto.toString; @@ -213,7 +220,7 @@ nativeMax = Math.max, nativeMin = Math.min, nativeRandom = Math.random, - nativeSlice = arrayProto.slice; + nativeSlice = arrayRef.slice; /** Detect various environments */ var isIeOpera = reNative.test(window.attachEvent), @@ -333,7 +340,7 @@ * @memberOf _.support * @type Boolean */ - support.spliceObjects = (arrayProto.splice.call(object, 0, 1), !object[0]); + support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); }(1)); /** @@ -1334,7 +1341,7 @@ */ function omit(object) { var indexOf = getIndexOf(), - props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), result = {}; forIn(object, function(value, key) { @@ -1399,7 +1406,7 @@ */ function pick(object) { var index = -1, - props = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + props = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), length = props.length, result = {}; @@ -2501,7 +2508,7 @@ var index = -1, indexOf = getIndexOf(), length = array.length, - flattened = concat.apply(arrayProto, nativeSlice.call(arguments, 1)), + flattened = concat.apply(arrayRef, nativeSlice.call(arguments, 1)), result = []; while (++index < length) { @@ -3113,9 +3120,9 @@ */ function union(array) { if (!isArray(array)) { - arguments[0] = array ? nativeSlice.call(array) : arrayProto; + arguments[0] = array ? nativeSlice.call(array) : arrayRef; } - return uniq(concat.apply(arrayProto, arguments)); + return uniq(concat.apply(arrayRef, arguments)); } /** @@ -3388,7 +3395,7 @@ * // => alerts 'clicked docs', when the button is clicked */ function bindAll(object) { - var funcs = arguments.length > 1 ? concat.apply(arrayProto, nativeSlice.call(arguments, 1)) : functions(object), + var funcs = arguments.length > 1 ? concat.apply(arrayRef, nativeSlice.call(arguments, 1)) : functions(object), index = -1, length = funcs.length; @@ -3541,6 +3548,7 @@ * @param {Number} wait The number of milliseconds to delay. * @param {Object} options The options object. * [leading=false] A boolean to specify execution on the leading edge of the timeout. + * [maxWait] The maximum time `func` is allowed to be delayed before it's called. * [trailing=true] A boolean to specify execution on the trailing edge of the timeout. * @returns {Function} Returns the new debounced function. * @example @@ -4421,7 +4429,7 @@ // add `Array` mutator functions to the wrapper forEach(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { var value = this.__wrapped__; func.apply(value, arguments); @@ -4437,7 +4445,7 @@ // add `Array` accessor functions to the wrapper forEach(['concat', 'join', 'slice'], function(methodName) { - var func = arrayProto[methodName]; + var func = arrayRef[methodName]; lodash.prototype[methodName] = function() { var value = this.__wrapped__, result = func.apply(value, arguments); diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index 3482f9b92c..f46f284d94 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -4,32 +4,32 @@ * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ -;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)}); -else for(;++ou&&(u=r);return u}function k(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++rarguments.length;t=W(t,e,4);var o=-1,i=n.length;if(typeof i=="number")for(u&&(r=n[++o]);++oarguments.length;if(typeof u!="number")var i=$t(n),u=i.length;return t=W(t,e,4),N(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=!1,n[a]):t(r,n[a],a,f) -}),r}function D(n,t,r){var e;t=W(t,r),r=-1;var u=n?n.length:0;if(typeof u=="number")for(;++rr(u,i)&&o.push(i)}return o}function $(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&null!=t){var o=-1;for(t=W(t,r);++oe?Ft(0,u+e):e||0}else if(e)return e=P(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function C(n,t,r){if(typeof t!="number"&&null!=t){var e=0,u=-1,o=n?n.length:0;for(t=W(t,r);++u>>1,r(n[e])o(f,l))&&(r&&f.push(l),a.push(e))}return a}function V(n,t){return Mt.fastBind||xt&&2"']/g,rt=/['\n\r\t\u2028\u2029\\]/g,et="[object Arguments]",ut="[object Array]",ot="[object Boolean]",it="[object Date]",at="[object Number]",ft="[object Object]",lt="[object RegExp]",ct="[object String]",pt={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},st={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},vt=Array.prototype,L=Object.prototype,gt=n._,ht=RegExp("^"+(L.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),yt=Math.ceil,mt=n.clearTimeout,_t=vt.concat,dt=Math.floor,bt=L.hasOwnProperty,jt=vt.push,wt=n.setTimeout,At=L.toString,xt=ht.test(xt=At.bind)&&xt,Ot=ht.test(Ot=Object.create)&&Ot,Et=ht.test(Et=Array.isArray)&&Et,St=n.isFinite,Nt=n.isNaN,Bt=ht.test(Bt=Object.keys)&&Bt,Ft=Math.max,kt=Math.min,qt=Math.random,Rt=vt.slice,L=ht.test(n.attachEvent),Dt=xt&&!/\n|true/.test(xt+L); -i.prototype=o.prototype;var Mt={};!function(){var n={0:1,length:1};Mt.fastBind=xt&&!Dt,Mt.spliceObjects=(vt.splice.call(n,0,1),!n[0])}(1),o.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ot||(f=function(n){if(b(n)){u.prototype=n;var t=new u;u.prototype=null}return t||{}}),s(arguments)||(s=function(n){return n?bt.call(n,"callee"):!1});var Tt=Et||function(n){return n?typeof n=="object"&&At.call(n)==ut:!1},Et=function(n){var t,r=[]; -if(!n||!pt[typeof n])return r;for(t in n)bt.call(n,t)&&r.push(t);return r},$t=Bt?function(n){return b(n)?Bt(n):[]}:Et,It={"&":"&","<":"<",">":">",'"':""","'":"'"},zt=y(It),Ct=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(t(n[r],r,n)===X)break;return n},Pt=function(n,t){var r;if(!n||!pt[typeof n])return n;for(r in n)if(bt.call(n,r)&&t(n[r],r,n)===X)break;return n};d(/x/)&&(d=function(n){return typeof n=="function"&&"[object Function]"==At.call(n)}),o.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 -}},o.bind=V,o.bindAll=function(n){for(var t=1u(i,a)){for(var f=r;--f;)if(0>u(t[f],a))continue n;i.push(a)}}return i},o.invert=y,o.invoke=function(n,t){var r=Rt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0); -return N(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},o.keys=$t,o.map=B,o.max=F,o.memoize=function(n,t){var r={};return function(){var e=Y+(t?t.apply(this,arguments):arguments[0]);return bt.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},o.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0;if(t||typeof i!="number")t=W(t,r),N(n,function(n,r,o){r=t(n,r,o),rt(r,u)&&(e[u]=n) -}),e},o.once=function(n){var t,r;return function(){return t?r:(t=!0,r=n.apply(this,arguments),n=null,r)}},o.pairs=function(n){for(var t=-1,r=$t(n),e=r.length,u=Array(e);++tr?0:r);++tr?Ft(0,e+r):kt(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},o.mixin=H,o.noConflict=function(){return n._=gt,this},o.random=function(n,t){null==n&&null==t&&(t=1),n=+n||0,null==t?(t=n,n=0):t=+t||0;var r=qt();return n%1||t%1?n+kt(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+dt(r*(t-n+1))},o.reduce=q,o.reduceRight=R,o.result=function(n,t){var r=n?n[t]:null; -return d(r)?n[t]():r},o.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:$t(n).length},o.some=D,o.sortedIndex=P,o.template=function(n,t,r){var u=o.templateSettings;n||(n=""),r=g({},r,u);var i=0,a="__p+='",u=r.variable;n.replace(RegExp((r.escape||nt).source+"|"+(r.interpolate||nt).source+"|"+(r.evaluate||nt).source+"|$","g"),function(t,r,u,o,f){return a+=n.slice(i,f).replace(rt,e),r&&(a+="'+_['escape']("+r+")+'"),o&&(a+="';"+o+";__p+='"),u&&(a+="'+((__t=("+u+"))==null?'':__t)+'"),i=f+t.length,t -}),a+="';\n",u||(u="obj",a="with("+u+"||{}){"+a+"}"),a="function("+u+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}";try{var f=Function("_","return "+a)(o)}catch(l){throw l.source=a,l}return t?f(t):(f.source=a,f)},o.unescape=function(n){return null==n?"":(n+"").replace(Z,p)},o.uniqueId=function(n){var t=++Q+"";return n?n+t:t},o.all=O,o.any=D,o.detect=S,o.findWhere=function(n,t){return M(n,t,!0)},o.foldl=q,o.foldr=R,o.include=x,o.inject=q,o.first=$,o.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t!="number"&&null!=t){var o=u;for(t=W(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,null==e||r)return n[u-1];return Rt.call(n,Ft(0,u-e))}},o.take=$,o.head=$,o.VERSION="1.2.1",H(o),o.prototype.chain=function(){return this.__chain__=!0,this},o.prototype.value=function(){return this.__wrapped__},N("pop push reverse shift sort splice unshift".split(" "),function(n){var t=vt[n];o.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!Mt.spliceObjects&&0===n.length&&delete n[0],this -}}),N(["concat","join","slice"],function(n){var t=vt[n];o.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new i(n),n.__chain__=!0),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=o, define(function(){return o})):J&&!J.nodeType?K?(K.exports=o)._=o:J._=o:n._=o}(this); \ No newline at end of file +;!function(n){function t(n,t){var r;if(n&>[typeof n])for(r in n)if(Et.call(n,r)&&t(n[r],r,n)===nt)break}function r(n,t){var r;if(n&>[typeof n])for(r in n)if(t(n[r],r,n)===nt)break}function e(n){var t,r=[];if(!n||!gt[typeof n])return r;for(t in n)Et.call(n,t)&&r.push(t);return r}function u(n,t,r){r=(r||0)-1;for(var e=n.length;++rt||typeof n=="undefined")return 1;if(ne&&(e=r,u=n)});else for(;++ou&&(u=r);return u}function D(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Array(e);++rarguments.length;r=J(r,u,4);var i=-1,a=n.length;if(typeof a=="number")for(o&&(e=n[++i]);++iarguments.length;if(typeof u!="number")var i=Vt(n),u=i.length;return t=J(t,e,4),F(n,function(e,a,f){a=i?i[--u]:--u,r=o?(o=Y,n[a]):t(r,n[a],a,f)}),r}function $(n,r,e){var u;r=J(r,e),e=-1;var o=n?n.length:0;if(typeof o=="number")for(;++er(u,i)&&o.push(i)}return o}function C(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=X){var o=-1;for(t=J(t,r);++or?Tt(0,e+r):r||0}else if(r)return r=W(n,t),n[r]===t?r:-1;return n?u(n,t,r):-1}function V(n,t,r){if(typeof t!="number"&&t!=X){var e=0,u=-1,o=n?n.length:0;for(t=J(t,r);++u>>1,r(n[e])o(f,c))&&(r&&f.push(c),a.push(e))}return a}function H(n,t){return Pt.fastBind||Bt&&2"']/g,ot=/['\n\r\t\u2028\u2029\\]/g,it="[object Arguments]",at="[object Array]",ft="[object Boolean]",ct="[object Date]",lt="[object Number]",pt="[object Object]",st="[object RegExp]",vt="[object String]",gt={"boolean":Y,"function":Q,object:Q,number:Y,string:Y,undefined:Y},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},yt=gt[typeof exports]&&exports,mt=gt[typeof module]&&module&&module.exports==yt&&module,_t=gt[typeof global]&&global; +!_t||_t.global!==_t&&_t.window!==_t||(n=_t);var dt=[],_t=Object.prototype,bt=n._,jt=RegExp("^"+(_t.valueOf+"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),wt=Math.ceil,At=n.clearTimeout,xt=dt.concat,Ot=Math.floor,Et=_t.hasOwnProperty,St=dt.push,Nt=n.setTimeout,kt=_t.toString,Bt=jt.test(Bt=kt.bind)&&Bt,Ft=jt.test(Ft=Object.create)&&Ft,qt=jt.test(qt=Array.isArray)&&qt,Rt=n.isFinite,Dt=n.isNaN,Mt=jt.test(Mt=Object.keys)&&Mt,Tt=Math.max,$t=Math.min,It=Math.random,zt=dt.slice,_t=jt.test(n.attachEvent),Ct=Bt&&!/\n|true/.test(Bt+_t); +c.prototype=f.prototype;var Pt={};!function(){var n={0:1,length:1};Pt.fastBind=Bt&&!Ct,Pt.spliceObjects=(dt.splice.call(n,0,1),!n[0])}(1),f.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:""},Ft||(p=function(n){if(A(n)){a.prototype=n;var t=new a;a.prototype=X}return t||{}}),h(arguments)||(h=function(n){return n?Et.call(n,"callee"):Y});var Ut=qt||function(n){return n?typeof n=="object"&&kt.call(n)==at:Y},Vt=Mt?function(n){return A(n)?Mt(n):[] +}:e,Wt={"&":"&","<":"<",">":">",'"':""","'":"'"},Gt=d(Wt);w(/x/)&&(w=function(n){return typeof n=="function"&&"[object Function]"==kt.call(n)}),f.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0}},f.bind=H,f.bindAll=function(n){for(var t=1u(i,a)){for(var f=r;--f;)if(0>u(t[f],a))continue n;i.push(a)}}return i},f.invert=d,f.invoke=function(n,t){var r=zt.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,i=Array(typeof o=="number"?o:0);return F(n,function(n){i[++e]=(u?t:n[t]).apply(n,r)}),i},f.keys=Vt,f.map=q,f.max=R,f.memoize=function(n,t){var r={};return function(){var e=tt+(t?t.apply(this,arguments):arguments[0]);return Et.call(r,e)?r[e]:r[e]=n.apply(this,arguments)}},f.min=function(n,t,r){var e=1/0,u=e,o=-1,i=n?n.length:0; +if(t||typeof i!="number")t=J(t,r),F(n,function(n,r,o){r=t(n,r,o),rt(e,r)&&(u[r]=n)}),u},f.once=function(n){var t,r;return function(){return t?r:(t=Q,r=n.apply(this,arguments),n=X,r)}},f.pairs=function(n){for(var t=-1,r=Vt(n),e=r.length,u=Array(e);++tr?0:r);++tr?Tt(0,e+r):$t(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},f.mixin=L,f.noConflict=function(){return n._=bt,this +},f.random=function(n,t){n==X&&t==X&&(t=1),n=+n||0,t==X?(t=n,n=0):t=+t||0;var r=It();return n%1||t%1?n+$t(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+Ot(r*(t-n+1))},f.reduce=M,f.reduceRight=T,f.result=function(n,t){var r=n?n[t]:X;return w(r)?n[t]():r},f.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Vt(n).length},f.some=$,f.sortedIndex=W,f.template=function(n,t,r){var e=f.templateSettings;n||(n=""),r=m({},r,e);var u=0,o="__p+='",e=r.variable;n.replace(RegExp((r.escape||et).source+"|"+(r.interpolate||et).source+"|"+(r.evaluate||et).source+"|$","g"),function(t,r,e,a,f){return o+=n.slice(u,f).replace(ot,i),r&&(o+="'+_['escape']("+r+")+'"),a&&(o+="';"+a+";__p+='"),e&&(o+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t +}),o+="';\n",e||(e="obj",o="with("+e+"||{}){"+o+"}"),o="function("+e+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var a=Function("_","return "+o)(f)}catch(c){throw c.source=o,c}return t?a(t):(a.source=o,a)},f.unescape=function(n){return n==X?"":(n+"").replace(rt,g)},f.uniqueId=function(n){var t=++Z+"";return n?n+t:t},f.all=N,f.any=$,f.detect=B,f.findWhere=function(n,t){return I(n,t,Q)},f.foldl=M,f.foldr=T,f.include=S,f.inject=M,f.first=C,f.last=function(n,t,r){if(n){var e=0,u=n.length; +if(typeof t!="number"&&t!=X){var o=u;for(t=J(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==X||r)return n[u-1];return zt.call(n,Tt(0,u-e))}},f.take=C,f.head=C,f.VERSION="1.2.1",L(f),f.prototype.chain=function(){return this.__chain__=Q,this},f.prototype.value=function(){return this.__wrapped__},F("pop push reverse shift sort splice unshift".split(" "),function(n){var t=dt[n];f.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!Pt.spliceObjects&&0===n.length&&delete n[0],this}}),F(["concat","join","slice"],function(n){var t=dt[n]; +f.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new c(n),n.__chain__=Q),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=f, define(function(){return f})):yt&&!yt.nodeType?mt?(mt.exports=f)._=f:yt._=f:n._=f}(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index 209fcc365e..a88deb06f9 100644 --- a/doc/README.md +++ b/doc/README.md @@ -218,7 +218,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3627 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3637 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -242,7 +242,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3657 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3667 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -267,7 +267,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3707 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3717 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -295,7 +295,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3777 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3787 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -355,7 +355,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3839 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3849 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -398,7 +398,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3883 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3893 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -430,7 +430,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3950 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3960 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -487,7 +487,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3984 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3994 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -511,7 +511,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4086 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4096 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -568,7 +568,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4127 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4137 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -597,7 +597,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4178 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -635,7 +635,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4247 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4257 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -695,7 +695,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4311 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4321 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -744,7 +744,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4343 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4353 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -768,7 +768,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4393 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4403 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -815,7 +815,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4449 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4459 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -839,7 +839,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4475 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4485 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -864,7 +864,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4495 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4505 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -888,7 +888,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4517 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4527 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -923,7 +923,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L605 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L615 "View in source") [Ⓣ][1] Creates a `lodash` object, which wraps the given `value`, to enable method chaining. @@ -979,7 +979,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5595 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5614 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1009,7 +1009,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5612 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5631 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1030,7 +1030,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5629 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5648 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1061,7 +1061,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2614 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2624 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1089,7 +1089,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2656 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2666 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1127,7 +1127,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2711 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2721 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1163,7 +1163,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2763 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2773 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1209,7 +1209,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2824 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2834 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1255,7 +1255,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2891 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2901 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1304,7 +1304,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2938 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2948 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1336,7 +1336,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2988 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2998 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1373,7 +1373,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3021 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3031 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1402,7 +1402,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3073 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1447,7 +1447,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3130 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3140 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1489,7 +1489,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3199 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3209 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1531,7 +1531,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3249 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3259 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1561,7 +1561,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3281 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3291 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1599,7 +1599,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3324 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3334 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1630,7 +1630,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3384 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3394 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1673,7 +1673,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3405 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3415 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1697,7 +1697,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3438 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3448 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1727,7 +1727,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3485 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3495 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1773,7 +1773,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3541 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3551 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1810,7 +1810,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3577 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3587 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1834,7 +1834,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3609 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3619 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1871,7 +1871,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4557 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4567 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1899,7 +1899,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4590 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4600 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1930,7 +1930,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4621 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4631 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1961,7 +1961,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4667 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4677 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2002,7 +2002,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4690 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4700 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2029,7 +2029,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4749 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4759 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2083,7 +2083,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4825 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4836 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2092,7 +2092,7 @@ Note: If `leading` and `trailing` options are `true`, `func` will be called on t #### Arguments 1. `func` *(Function)*: The function to debounce. 2. `wait` *(Number)*: The number of milliseconds to delay. -3. `options` *(Object)*: The options object. [leading=false] A boolean to specify execution on the leading edge of the timeout. [trailing=true] A boolean to specify execution on the trailing edge of the timeout. +3. `options` *(Object)*: The options object. [leading=false] A boolean to specify execution on the leading edge of the timeout. [maxWait] The maximum time `func` is allowed to be delayed before it's called. [trailing=true] A boolean to specify execution on the trailing edge of the timeout. #### Returns *(Function)*: Returns the new debounced function. @@ -2116,7 +2116,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4878 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4921 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2141,7 +2141,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4904 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4947 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2168,7 +2168,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4929 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4972 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2194,7 +2194,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5002 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2220,7 +2220,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4994 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5037 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2247,7 +2247,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5025 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5068 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2284,7 +2284,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5058 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5101 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2316,7 +2316,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5123 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5142 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2352,7 +2352,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1352 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1362 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2390,7 +2390,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1407 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1417 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2437,7 +2437,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1537 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1547 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2483,7 +2483,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1561 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1571 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2509,7 +2509,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1583 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1593 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2537,7 +2537,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1624 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1634 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2573,7 +2573,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1649 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1659 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2601,7 +2601,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1666 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1676 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2628,7 +2628,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1691 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1701 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2653,7 +2653,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1708 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1718 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2677,7 +2677,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1215 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1225 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2704,7 +2704,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1241 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1251 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2731,7 +2731,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1734 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1744 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2755,7 +2755,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1751 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1761 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2779,7 +2779,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1768 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1778 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2803,7 +2803,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1793 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1803 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2833,7 +2833,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1852 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1862 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2878,7 +2878,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2038 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2048 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2916,7 +2916,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2055 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2065 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2940,7 +2940,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2118 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2128 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2975,7 +2975,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2140 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2150 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3002,7 +3002,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2157 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2167 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3026,7 +3026,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2085 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2095 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3056,7 +3056,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2185 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2195 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3091,7 +3091,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2210 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2220 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3115,7 +3115,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2227 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2237 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3139,7 +3139,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2244 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2254 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3163,7 +3163,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1274 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1284 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3187,7 +3187,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2303 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2313 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3243,7 +3243,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2418 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2428 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3274,7 +3274,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2453 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2463 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3298,7 +3298,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2491 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2501 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3329,7 +3329,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2546 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2556 "View in source") [Ⓣ][1] An alternative to `_.reduce`, this method transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3366,7 +3366,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2579 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2589 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3397,7 +3397,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5147 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5166 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3421,7 +3421,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5165 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5184 "View in source") [Ⓣ][1] This method returns the first argument passed to it. @@ -3446,7 +3446,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5191 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5210 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3476,7 +3476,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5220 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5239 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3496,7 +3496,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5244 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5263 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3523,7 +3523,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5267 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5286 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3551,7 +3551,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5311 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5330 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3586,7 +3586,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L445 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L448 "View in source") [Ⓣ][1] Create a new `lodash` function using the given `context` object. @@ -3604,7 +3604,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5395 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5414 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3686,7 +3686,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5520 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5539 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3718,7 +3718,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5547 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5566 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3742,7 +3742,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5567 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5586 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3776,7 +3776,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L814 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L824 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3795,7 +3795,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5810 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5829 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3807,7 +3807,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L632 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L642 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3819,7 +3819,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L657 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L667 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3831,7 +3831,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L649 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L659 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3843,7 +3843,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L666 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L676 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -3855,7 +3855,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L679 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L689 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3869,7 +3869,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L687 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L697 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3881,7 +3881,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L704 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L714 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3893,7 +3893,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L715 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L725 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3907,7 +3907,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L695 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L705 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3919,7 +3919,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L729 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L739 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3933,7 +3933,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L740 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L750 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3947,7 +3947,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L766 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L776 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3959,7 +3959,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L774 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L784 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3971,7 +3971,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L782 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L792 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3983,7 +3983,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L790 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L800 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3995,7 +3995,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L798 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L808 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -4007,7 +4007,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L806 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L816 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. From 54a46dccc3c2aed8cef024338c66e9cabc1f7d75 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 10 Jun 2013 12:37:24 -0700 Subject: [PATCH 113/117] Correct `_.throttle` method dependencies. Former-commit-id: 2118e1789803a042675fcc8acb19f1904a102578 --- build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.js b/build.js index c9dc07335d..0be61ba029 100755 --- a/build.js +++ b/build.js @@ -167,7 +167,7 @@ 'sortedIndex': ['createCallback', 'identity'], 'tap': ['value'], 'template': ['defaults', 'escape', 'escapeStringChar', 'keys', 'values'], - 'throttle': ['debounce'], + 'throttle': ['debounce', 'getObject', 'isObject', 'releaseObject'], 'times': ['createCallback'], 'toArray': ['isString', 'slice', 'values'], 'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'], From a4ebaf15ab40da7ae0bdf390da10f839c041698d Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Mon, 10 Jun 2013 23:55:13 -0700 Subject: [PATCH 114/117] Remove lodash.js from .npmignore. Former-commit-id: 437fe2fa2e19d4de8f83e2f760cf9da854ded128 --- .npmignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.npmignore b/.npmignore index 5877da9ab8..c9ec59ceff 100644 --- a/.npmignore +++ b/.npmignore @@ -4,7 +4,6 @@ *.d.ts *.map *.md -lodash.js bower.json component.json doc From 24f49c8d83d3af097de392a78e3694614d0c6c2b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 11 Jun 2013 08:19:54 -0700 Subject: [PATCH 115/117] Ensure `_.throttle` passes underscore unit tests in all environments. Former-commit-id: 5867875313995ed02a94cd879d537c295b8a5c5f --- dist/lodash.compat.js | 38 +++++++++++++++++++++----------- dist/lodash.compat.min.js | 6 ++--- dist/lodash.js | 38 +++++++++++++++++++++----------- dist/lodash.min.js | 6 ++--- doc/README.md | 46 +++++++++++++++++++-------------------- lodash.js | 38 +++++++++++++++++++++----------- 6 files changed, 104 insertions(+), 68 deletions(-) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index ea4efaeb63..fc33644fa5 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -4825,34 +4825,42 @@ timeoutId = null, trailing = true; - function trailingCall() { - var isCalled = trailing && (!leading || callCount > 1); - callCount = 0; - + function clear() { clearTimeout(maxTimeoutId); clearTimeout(timeoutId); + callCount = 0; maxTimeoutId = timeoutId = null; + } + function delayed() { + var isCalled = trailing && (!leading || callCount > 1); + clear(); if (isCalled) { + if (maxWait !== false) { + lastCalled = new Date; + } + result = func.apply(thisArg, args); + } + } + + function maxDelayed() { + clear(); + if (trailing || (maxWait !== wait)) { lastCalled = new Date; result = func.apply(thisArg, args); } } + wait = nativeMax(0, wait || 0); if (options === true) { var leading = true; trailing = false; } else if (isObject(options)) { - maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); leading = options.leading; + maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); trailing = 'trailing' in options ? options.trailing : trailing; } return function() { - var now = new Date; - if (!timeoutId && !leading) { - lastCalled = now; - } - var remaining = (maxWait || wait) - (now - lastCalled); args = arguments; thisArg = this; callCount++; @@ -4860,13 +4868,17 @@ // avoid issues with Titanium and `undefined` timeout ids // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); - timeoutId = null; if (maxWait === false) { if (leading && callCount < 2) { result = func.apply(thisArg, args); } } else { + var now = new Date; + if (!maxTimeoutId && !leading) { + lastCalled = now; + } + var remaining = maxWait - (now - lastCalled); if (remaining <= 0) { clearTimeout(maxTimeoutId); maxTimeoutId = null; @@ -4874,11 +4886,11 @@ result = func.apply(thisArg, args); } else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(trailingCall, remaining); + maxTimeoutId = setTimeout(maxDelayed, remaining); } } if (wait !== maxWait) { - timeoutId = setTimeout(trailingCall, wait); + timeoutId = setTimeout(delayed, wait); } return result; }; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index d7133dc728..e19b2ee233 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -21,9 +21,9 @@ return Tr(n,function(n,r,u){return t(n,r,u)?(e=n,b):void 0}),e}r=-1;for(var u=n. i>a&&(a=i)}}else t=!t&&dt(n)?u:_.createCallback(t,r),Tr(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,a=n)});return a}function St(n,t,r,e){var u=3>arguments.length;if(t=_.createCallback(t,e,4),qr(n)){var a=-1,o=n.length;for(u&&(r=n[++a]);++aarguments.length;if(typeof a!="number")var i=Rr(n),a=i.length;else Pr.unindexedChars&&dt(n)&&(u=n.split(""));return t=_.createCallback(t,e,4),xt(n,function(n,e,l){e=i?i[--a]:--a,r=o?(o=b,u[e]):t(r,u[e],e,l) }),r}function It(n,t,r){var e;if(t=_.createCallback(t,r),qr(n)){r=-1;for(var u=n.length;++r=O&&u===t;if(c){var f=o(i);f?(u=r,i=f):c=b}for(;++eu(i,f)&&l.push(f);return c&&g(i),l}function Nt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=-1;for(t=_.createCallback(t,r);++ae?kr(0,u+e):e||0}else if(e)return e=Ft(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function zt(n,t,r){if(typeof t!="number"&&t!=d){var e=0,u=-1,a=n?n.length:0;for(t=_.createCallback(t,r);++u>>1,r(n[e])r?0:r);++ti&&(a=n.apply(o,u)):0c&&(i=n.apply(l,o));else{var r=new Kt;!s&&!h&&(f=r);var e=p-(r-f);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:z,variable:"",imports:{_:_}};var zr={a:"x,F,k",h:"var a=arguments,b=0,c=typeof k=='number'?2:a.length;while(++b 1); - callCount = 0; - + function clear() { clearTimeout(maxTimeoutId); clearTimeout(timeoutId); + callCount = 0; maxTimeoutId = timeoutId = null; + } + function delayed() { + var isCalled = trailing && (!leading || callCount > 1); + clear(); if (isCalled) { + if (maxWait !== false) { + lastCalled = new Date; + } + result = func.apply(thisArg, args); + } + } + + function maxDelayed() { + clear(); + if (trailing || (maxWait !== wait)) { lastCalled = new Date; result = func.apply(thisArg, args); } } + wait = nativeMax(0, wait || 0); if (options === true) { var leading = true; trailing = false; } else if (isObject(options)) { - maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); leading = options.leading; + maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); trailing = 'trailing' in options ? options.trailing : trailing; } return function() { - var now = new Date; - if (!timeoutId && !leading) { - lastCalled = now; - } - var remaining = (maxWait || wait) - (now - lastCalled); args = arguments; thisArg = this; callCount++; @@ -4525,13 +4533,17 @@ // avoid issues with Titanium and `undefined` timeout ids // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); - timeoutId = null; if (maxWait === false) { if (leading && callCount < 2) { result = func.apply(thisArg, args); } } else { + var now = new Date; + if (!maxTimeoutId && !leading) { + lastCalled = now; + } + var remaining = maxWait - (now - lastCalled); if (remaining <= 0) { clearTimeout(maxTimeoutId); maxTimeoutId = null; @@ -4539,11 +4551,11 @@ result = func.apply(thisArg, args); } else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(trailingCall, remaining); + maxTimeoutId = setTimeout(maxDelayed, remaining); } } if (wait !== maxWait) { - timeoutId = setTimeout(trailingCall, wait); + timeoutId = setTimeout(delayed, wait); } return result; }; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 5183ed6396..0e60dee412 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -21,9 +21,9 @@ if(t&&((u=Ee(t))||m(t))){for(a=i.length;a--;)if(r=i[a]==t){f=l[a];break}if(!r){v }}else t=!t&&yt(n)?u:tt.createCallback(t,e),wt(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,a=n)});return a}function Ot(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Mt(r);++earguments.length;t=tt.createCallback(t,r,4);var a=-1,o=n.length;if(typeof o=="number")for(u&&(e=n[++a]);++aarguments.length; if(typeof u!="number")var o=Se(n),u=o.length;return t=tt.createCallback(t,r,4),wt(n,function(r,i,f){i=o?o[--u]:--u,e=a?(a=b,n[i]):t(e,n[i],i,f)}),e}function It(n,t,e){var r;t=tt.createCallback(t,e),e=-1;var u=n?n.length:0;if(typeof u=="number")for(;++e=w&&u===t;if(l){var c=o(i);c?(u=e,i=c):l=b}for(;++ru(i,c)&&f.push(c); return l&&p(i),f}function Nt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=y){var a=-1;for(t=tt.createCallback(t,e);++ar?_e(0,u+r):r||0}else if(r)return r=Ft(n,e),n[r]===e?r:-1;return n?t(n,e,r):-1}function Bt(n,t,e){if(typeof t!="number"&&t!=y){var r=0,u=-1,a=n?n.length:0;for(t=tt.createCallback(t,e);++u>>1,e(n[r])e?0:e);++ti&&(a=n.apply(o,u)):0>>1,e(n[r])e?0:e);++tl&&(i=n.apply(f,o));else{var e=new Vt;!s&&!m&&(c=e);var r=p-(e-c);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:tt}};var Ee=ye,Se=de?function(n){return gt(n)?de(n):[]}:Z,Ie={"&":"&","<":"<",">":">",'"':""","'":"'"},Ae=pt(Ie),Ut=ot(function $e(n,t,e){for(var r=-1,u=n?n.length:0,a=[];++r=w&&i===t,g=u||v?f():s;if(v){var h=o(g);h?(i=e,g=h):(v=b,g=u?g:(c(g),s))}for(;++ai(g,y))&&((u||v)&&g.push(y),s.push(h))}return v?(c(g.b),p(g)):u&&c(g),s});return Ht&&Y&&typeof pe=="function"&&(zt=qt(pe,r)),pe=8==je(B+"08")?je:function(n,t){return je(yt(n)?n.replace(F,""):n,t||0)},tt.after=function(n,t){return 1>n?t():function(){return 1>--n?t.apply(this,arguments):void 0 }},tt.assign=X,tt.at=function(n){for(var t=-1,e=ae.apply(Zt,Ce.call(arguments,1)),r=e.length,u=Mt(r);++t ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5614 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5626 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1009,7 +1009,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5631 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5643 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1030,7 +1030,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5648 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5660 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -2116,7 +2116,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4921 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4933 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2141,7 +2141,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4947 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4959 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2168,7 +2168,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4972 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4984 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2194,7 +2194,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5002 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5014 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2220,7 +2220,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5037 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5049 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2247,7 +2247,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5068 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5080 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2284,7 +2284,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5101 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5113 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2316,7 +2316,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5142 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5154 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -3397,7 +3397,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5166 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5178 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3421,7 +3421,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5184 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5196 "View in source") [Ⓣ][1] This method returns the first argument passed to it. @@ -3446,7 +3446,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5210 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5222 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3476,7 +3476,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5239 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5251 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3496,7 +3496,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5263 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5275 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3523,7 +3523,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5286 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5298 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3551,7 +3551,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5330 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5342 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3604,7 +3604,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5414 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5426 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3686,7 +3686,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5539 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5551 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3718,7 +3718,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5566 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5578 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3742,7 +3742,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5586 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5598 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3795,7 +3795,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5829 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5841 "View in source") [Ⓣ][1] *(String)*: The semantic version number. diff --git a/lodash.js b/lodash.js index e84a60674d..ac0ea5358a 100644 --- a/lodash.js +++ b/lodash.js @@ -4844,34 +4844,42 @@ timeoutId = null, trailing = true; - function trailingCall() { - var isCalled = trailing && (!leading || callCount > 1); - callCount = 0; - + function clear() { clearTimeout(maxTimeoutId); clearTimeout(timeoutId); + callCount = 0; maxTimeoutId = timeoutId = null; + } + function delayed() { + var isCalled = trailing && (!leading || callCount > 1); + clear(); if (isCalled) { + if (maxWait !== false) { + lastCalled = new Date; + } + result = func.apply(thisArg, args); + } + } + + function maxDelayed() { + clear(); + if (trailing || (maxWait !== wait)) { lastCalled = new Date; result = func.apply(thisArg, args); } } + wait = nativeMax(0, wait || 0); if (options === true) { var leading = true; trailing = false; } else if (isObject(options)) { - maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); leading = options.leading; + maxWait = 'maxWait' in options && nativeMax(wait, options.maxWait || 0); trailing = 'trailing' in options ? options.trailing : trailing; } return function() { - var now = new Date; - if (!timeoutId && !leading) { - lastCalled = now; - } - var remaining = (maxWait || wait) - (now - lastCalled); args = arguments; thisArg = this; callCount++; @@ -4879,13 +4887,17 @@ // avoid issues with Titanium and `undefined` timeout ids // https://github.com/appcelerator/titanium_mobile/blob/3_1_0_GA/android/titanium/src/java/ti/modules/titanium/TitaniumModule.java#L185-L192 clearTimeout(timeoutId); - timeoutId = null; if (maxWait === false) { if (leading && callCount < 2) { result = func.apply(thisArg, args); } } else { + var now = new Date; + if (!maxTimeoutId && !leading) { + lastCalled = now; + } + var remaining = maxWait - (now - lastCalled); if (remaining <= 0) { clearTimeout(maxTimeoutId); maxTimeoutId = null; @@ -4893,11 +4905,11 @@ result = func.apply(thisArg, args); } else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(trailingCall, remaining); + maxTimeoutId = setTimeout(maxDelayed, remaining); } } if (wait !== maxWait) { - timeoutId = setTimeout(trailingCall, wait); + timeoutId = setTimeout(delayed, wait); } return result; }; From f90f2e051aea064855df53b06bcbf7cdb359f7ca Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 11 Jun 2013 08:33:35 -0700 Subject: [PATCH 116/117] Bump to v1.3.0. Former-commit-id: 4b8a4e90b97d2960445073cd4288af19dadc9266 --- README.md | 72 ++++++++++++++++++++++++----------- bower.json | 2 +- component.json | 2 +- dist/lodash.compat.js | 4 +- dist/lodash.compat.min.js | 4 +- dist/lodash.js | 4 +- dist/lodash.min.js | 4 +- dist/lodash.underscore.js | 4 +- dist/lodash.underscore.min.js | 4 +- doc/README.md | 2 +- doc/parse.php | 2 +- lodash.js | 4 +- package.json | 2 +- 13 files changed, 68 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 93e0fc1715..f498f53360 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,28 @@ -# Lo-Dash v1.2.1 +# Lo-Dash v1.3.0 A low-level utility library delivering consistency, [customization](https://github.com/bestiejs/lodash#custom-builds), [performance](http://lodash.com/benchmarks), and [extra features](https://github.com/bestiejs/lodash#features). ## Download * Lo-Dash builds (for modern environments):
-[Development](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.js) and -[Production](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.min.js) +[Development](https://raw.github.com/bestiejs/lodash/v1.3.0/dist/lodash.js) and +[Production](https://raw.github.com/bestiejs/lodash/v1.3.0/dist/lodash.min.js) * Lo-Dash compatibility builds (for legacy and modern environments):
-[Development](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.compat.js) and -[Production](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.compat.min.js) +[Development](https://raw.github.com/bestiejs/lodash/v1.3.0/dist/lodash.compat.js) and +[Production](https://raw.github.com/bestiejs/lodash/v1.3.0/dist/lodash.compat.min.js) * Underscore compatibility builds:
-[Development](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.underscore.js) and -[Production](https://raw.github.com/bestiejs/lodash/v1.2.1/dist/lodash.underscore.min.js) +[Development](https://raw.github.com/bestiejs/lodash/v1.3.0/dist/lodash.underscore.js) and +[Production](https://raw.github.com/bestiejs/lodash/v1.3.0/dist/lodash.underscore.min.js) -* CDN copies of ≤ v1.2.1’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):
-[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.js), -[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.min.js),
-[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.compat.js), -[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.compat.min.js),
-[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.underscore.js), and -[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.2.1/lodash.underscore.min.js) +* CDN copies of ≤ v1.3.0’s builds are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/):
+[Lo-Dash dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.0/lodash.js), +[Lo-Dash prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.0/lodash.min.js),
+[Lo-Dash compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.0/lodash.compat.js), +[Lo-Dash compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.0/lodash.compat.min.js),
+[Underscore compat-dev](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.0/lodash.underscore.js), and +[Underscore compat-prod](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.0/lodash.underscore.min.js) * For optimal file size, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need @@ -68,6 +68,7 @@ For more information check out these articles, screencasts, and other videos ove * [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking and extended environment support * [_.support](http://lodash.com/docs#support) to flag environment features * [_.template](http://lodash.com/docs#template) supports [*“imports”* options](http://lodash.com/docs#templateSettings_imports), [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6), and [sourceURLs](http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl) + * [_.transform](http://lodash.com/docs#transform) as a powerful alternative to [_.reduce](http://lodash.com/docs#reduce) for transforming objects * [_.unzip](http://lodash.com/docs#unzip) as the inverse of [_.zip](http://lodash.com/docs#zip) * [_.where](http://lodash.com/docs#where) supports deep object comparisons * [_.clone](http://lodash.com/docs#clone), [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick), @@ -79,7 +80,7 @@ For more information check out these articles, screencasts, and other videos ove ## Support -Lo-Dash has been tested in at least Chrome 5~26, Firefox 2~20, IE 6-10, Opera 9.25~12, Safari 3-6, Node.js 0.4.8-0.10.5, Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. +Lo-Dash has been tested in at least Chrome 5~27, Firefox 2~21, IE 6-10, Opera 9.25~12, Safari 3-6, Node.js 0.4.8-0.10.7 (Node bug [#5622](https://github.com/joyent/node/issues/5622) prevents 0.10.8-0.10.10 from working), Narwhal 0.3.2, PhantomJS 1.9.0, RingoJS 0.9, and Rhino 1.7RC5. ## Custom builds @@ -248,14 +249,39 @@ require({ ## Release Notes -### v1.2.1 - - * Added Component package support - * Updated the build utility to work with changes in GitHub’s API - * Ensured `_.isPlainObject` works with objects created by `Object.create(null)` - * Ensured *“isType”* methods return `false` for subclassed values - * Ensured debounced functions, with `leading` and `trailing` calls enabled,
- only perform trailing calls after they’re called more than once +### v1.3.0 + + * Added `_.transform` method + * Added `_.chain` and `_.findWhere` aliases + * Added internal array and object pooling + * Added Istanbul test coverage reports to Travis CI + * Added `maxWait` option to `_.debounce` + * Added support for floating point numbers to `_.random` + * Added Volo configuration to package.json + * Adjusted UMD for `component build` + * Allowed more stable mixing of `lodash` and `underscore` build methods + * Ensured debounced function with, `leading` and `trailing` options, works as expected + * Ensured minified builds work with the Dojo builder + * Ensured minification avoids deoptimizing expressions containing boolean values + * Ensured unknown types return `false` in `_.isObject` and `_.isRegExp` + * Ensured `_.clone`, `_.flatten`, and `_.uniq` can be used as a `callback` for methods like `_.map` + * Ensured `_.forIn` works on objects with longer inheritance chains in IE < 9 + * Ensured `_.isPlainObject` returns `true` for empty objects in IE < 9 + * Ensured `_.max` and `_.min` chain correctly + * Ensured `clearTimeout` use doesn’t cause errors in Titanium + * Ensured that the `--stdout` build option doesn't write to a file + * Exposed memoized function’s `cache` + * Fixed `Error.prototype` iteration bugs + * Fixed "scripts" paths in component.json + * Made methods support customizing `_.indexOf` + * Made the build track dependencies of private functions + * Made the `template` pre-compiler build option avoid escaping non-ascii characters + * Made `_.createCallback` avoid binding functions if they don’t reference `this` + * Optimized the Closure Compiler minification process + * Optimized the large array cache for `_.difference`, `_.intersection`, and `_.uniq` + * Optimized internal `_.flatten` and `_.indexOf` use + * Reduced `_.unzip` and `_.zip` + * Removed special handling of arrays in `_.assign` and `_.defaults` The full changelog is available [here](https://github.com/bestiejs/lodash/wiki/Changelog). diff --git a/bower.json b/bower.json index c34bb4d453..f6f65c5107 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "1.2.1", + "version": "1.3.0", "main": "./dist/lodash.compat.js", "ignore": [ ".*", diff --git a/component.json b/component.json index cc39f96629..459ecc9c08 100644 --- a/component.json +++ b/component.json @@ -1,7 +1,7 @@ { "name": "lodash", "repo": "bestiejs/lodash", - "version": "1.2.1", + "version": "1.3.0", "description": "A low-level utility library delivering consistency, customization, performance, and extra features.", "license": "MIT", "scripts": [ diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index fc33644fa5..909499e2a4 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 1.2.1 (Custom Build) + * Lo-Dash 1.3.0 (Custom Build) * Build: `lodash -o ./dist/lodash.compat.js` * Copyright 2012-2013 The Dojo Foundation * Based on Underscore.js 1.4.4 @@ -5819,7 +5819,7 @@ * @memberOf _ * @type String */ - lodash.VERSION = '1.2.1'; + lodash.VERSION = '1.3.0'; // add "Chaining" functions to the wrapper lodash.prototype.toString = wrapperToString; diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index e19b2ee233..ba807370b4 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 1.2.1 (Custom Build) lodash.com/license + * Lo-Dash 1.3.0 (Custom Build) lodash.com/license * Build: `lodash -o ./dist/lodash.compat.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ @@ -45,7 +45,7 @@ a.l=t(n,r,u),a.m=e,a.n=n}),u=o.length,o.sort(a);u--;)n=o[u],o[u]=n.n,g(n);return var r=Er();return n%1||t%1?n+xr(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+cr(r*(t-n+1))},_.reduce=St,_.reduceRight=At,_.result=function(n,t){var r=n?n[t]:m;return ht(r)?n[t]():r},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Rr(n).length},_.some=It,_.sortedIndex=Ft,_.template=function(n,t,r){var e=_.templateSettings;n||(n=""),r=Hr({},r,e);var u,a=Hr({},r.imports,e.imports),e=Rr(a),a=_t(a),o=0,l=r.interpolate||D,c="__p+='",l=Xt((r.escape||D).source+"|"+l.source+"|"+(l===z?N:D).source+"|"+(r.evaluate||D).source+"|$","g"); n.replace(l,function(t,r,e,a,l,f){return e||(e=a),c+=n.slice(o,f).replace(T,i),r&&(c+="'+__e("+r+")+'"),l&&(u=y,c+="';"+l+";__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),o=f+t.length,t}),c+="';\n",l=r=r.variable,l||(r="obj",c="with("+r+"){"+c+"}"),c=(u?c.replace(S,""):c).replace(A,"$1").replace(I,"$1;"),c="function("+r+"){"+(l?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var f=Mt(e,"return "+c).apply(m,a) }catch(p){throw p.source=c,p}return t?f(t):(f.source=c,f)},_.unescape=function(n){return n==d?"":Yt(n).replace(B,ct)},_.uniqueId=function(n){var t=++j;return Yt(n==d?"":n)+t},_.all=jt,_.any=It,_.detect=kt,_.findWhere=kt,_.foldl=St,_.foldr=At,_.include=Ct,_.inject=St,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__];return gr.apply(t,arguments),n.apply(_,t)})}),_.first=Nt,_.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=d){var a=u;for(t=_.createCallback(t,r);a--&&t(n[a],a,n);)e++ -}else if(e=t,e==d||r)return n[u-1];return v(n,kr(0,u-e))}},_.take=Nt,_.head=Nt,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==d||r&&typeof t!="function"?e:new C(e)})}),_.VERSION="1.2.1",_.prototype.toString=function(){return Yt(this.__wrapped__)},_.prototype.value=Gt,_.prototype.valueOf=Gt,Tr(["join","pop","shift"],function(n){var t=nr[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Tr(["push","reverse","sort","unshift"],function(n){var t=nr[n]; +}else if(e=t,e==d||r)return n[u-1];return v(n,kr(0,u-e))}},_.take=Nt,_.head=Nt,Kr(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,r){var e=n(this.__wrapped__,t,r);return t==d||r&&typeof t!="function"?e:new C(e)})}),_.VERSION="1.3.0",_.prototype.toString=function(){return Yt(this.__wrapped__)},_.prototype.value=Gt,_.prototype.valueOf=Gt,Tr(["join","pop","shift"],function(n){var t=nr[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments)}}),Tr(["push","reverse","sort","unshift"],function(n){var t=nr[n]; _.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Tr(["concat","slice","splice"],function(n){var t=nr[n];_.prototype[n]=function(){return new C(t.apply(this.__wrapped__,arguments))}}),Pr.spliceObjects||Tr(["pop","shift","splice"],function(n){var t=nr[n],r="splice"==n;_.prototype[n]=function(){var n=this.__wrapped__,e=t.apply(n,arguments);return 0===n.length&&delete n[0],r?new C(e):e}}),_}var m,y=!0,d=null,b=!1,_=[],C=[],j=0,w={},x=+new Date+"",O=75,E=10,S=/\b__p\+='';/g,A=/\b(__p\+=)''\+/g,I=/(__e\(.*?\)|\b__t\))\+'';/g,B=/&(?:amp|lt|gt|quot|#39);/g,N=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,P=/\w*$/,z=/<%=([\s\S]+?)%>/g,F=(F=/\bthis\b/)&&F.test(h)&&F,$=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",q=RegExp("^["+$+"]*0+(?=.$)"),D=/($^)/,R=/[&<>"']/g,T=/['\n\r\t\u2028\u2029\\]/g,W="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),G="[object Arguments]",H="[object Array]",J="[object Boolean]",K="[object Date]",M="[object Error]",U="[object Function]",V="[object Number]",Q="[object Object]",X="[object RegExp]",Y="[object String]",Z={}; Z[U]=b,Z[G]=Z[H]=Z[J]=Z[K]=Z[V]=Z[Q]=Z[X]=Z[Y]=y;var nt={"boolean":b,"function":y,object:y,number:b,string:b,undefined:b},tt={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},rt=nt[typeof exports]&&exports,et=nt[typeof module]&&module&&module.exports==rt&&module,ut=nt[typeof global]&&global;!ut||ut.global!==ut&&ut.window!==ut||(n=ut);var at=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=at, define(function(){return at})):rt&&!rt.nodeType?et?(et.exports=at)._=at:rt._=at:n._=at }(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index 10aa5d2493..299b649888 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 1.2.1 (Custom Build) + * Lo-Dash 1.3.0 (Custom Build) * Build: `lodash modern -o ./dist/lodash.js` * Copyright 2012-2013 The Dojo Foundation * Based on Underscore.js 1.4.4 @@ -5484,7 +5484,7 @@ * @memberOf _ * @type String */ - lodash.VERSION = '1.2.1'; + lodash.VERSION = '1.3.0'; // add "Chaining" functions to the wrapper lodash.prototype.toString = wrapperToString; diff --git a/dist/lodash.min.js b/dist/lodash.min.js index 0e60dee412..90ffbe8a5c 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 1.2.1 (Custom Build) lodash.com/license + * Lo-Dash 1.3.0 (Custom Build) lodash.com/license * Build: `lodash modern -o ./dist/lodash.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ @@ -42,7 +42,7 @@ return u},tt.reject=function(n,t,e){return t=tt.createCallback(t,e),kt(n,functio var e=we();return n%1||t%1?n+ke(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+oe(e*(t-n+1))},tt.reduce=Et,tt.reduceRight=St,tt.result=function(n,t){var e=n?n[t]:g;return vt(e)?n[t]():e},tt.runInContext=v,tt.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Se(n).length},tt.some=It,tt.sortedIndex=Ft,tt.template=function(n,t,e){var r=tt.templateSettings;n||(n=""),e=Q({},e,r);var u,a=Q({},e.imports,r.imports),r=Se(a),a=mt(a),o=0,f=e.interpolate||R,l="__p+='",f=Qt((e.escape||R).source+"|"+f.source+"|"+(f===N?I:R).source+"|"+(e.evaluate||R).source+"|$","g"); n.replace(f,function(t,e,r,a,f,c){return r||(r=a),l+=n.slice(o,c).replace(q,i),e&&(l+="'+__e("+e+")+'"),f&&(u=h,l+="';"+f+";__p+='"),r&&(l+="'+((__t=("+r+"))==null?'':__t)+'"),o=c+t.length,t}),l+="';\n",f=e=e.variable,f||(e="obj",l="with("+e+"){"+l+"}"),l=(u?l.replace(x,""):l).replace(O,"$1").replace(E,"$1;"),l="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+l+"return __p}";try{var c=Gt(r,"return "+l).apply(g,a) }catch(p){throw p.source=l,p}return t?c(t):(c.source=l,c)},tt.unescape=function(n){return n==y?"":Xt(n).replace(S,ft)},tt.uniqueId=function(n){var t=++_;return Xt(n==y?"":n)+t},tt.all=_t,tt.any=It,tt.detect=jt,tt.findWhere=jt,tt.foldl=Et,tt.foldr=St,tt.include=dt,tt.inject=Et,d(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(){var t=[this.__wrapped__];return ce.apply(t,arguments),n.apply(tt,t)})}),tt.first=Nt,tt.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=y){var a=u; -for(t=tt.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==y||e)return n[u-1];return s(n,_e(0,u-r))}},tt.take=Nt,tt.head=Nt,d(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==y||e&&typeof t!="function"?r:new et(r)})}),tt.VERSION="1.2.1",tt.prototype.toString=function(){return Xt(this.__wrapped__)},tt.prototype.value=Kt,tt.prototype.valueOf=Kt,wt(["join","pop","shift"],function(n){var t=Zt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) +for(t=tt.createCallback(t,e);a--&&t(n[a],a,n);)r++}else if(r=t,r==y||e)return n[u-1];return s(n,_e(0,u-r))}},tt.take=Nt,tt.head=Nt,d(tt,function(n,t){tt.prototype[t]||(tt.prototype[t]=function(t,e){var r=n(this.__wrapped__,t,e);return t==y||e&&typeof t!="function"?r:new et(r)})}),tt.VERSION="1.3.0",tt.prototype.toString=function(){return Xt(this.__wrapped__)},tt.prototype.value=Kt,tt.prototype.valueOf=Kt,wt(["join","pop","shift"],function(n){var t=Zt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments) }}),wt(["push","reverse","sort","unshift"],function(n){var t=Zt[n];tt.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),wt(["concat","slice","splice"],function(n){var t=Zt[n];tt.prototype[n]=function(){return new et(t.apply(this.__wrapped__,arguments))}}),tt}var g,h=!0,y=null,b=!1,m=[],d=[],_=0,k={},j=+new Date+"",w=75,C=10,x=/\b__p\+='';/g,O=/\b(__p\+=)''\+/g,E=/(__e\(.*?\)|\b__t\))\+'';/g,S=/&(?:amp|lt|gt|quot|#39);/g,I=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,N=/<%=([\s\S]+?)%>/g,$=($=/\bthis\b/)&&$.test(v)&&$,B=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",F=RegExp("^["+B+"]*0+(?=.$)"),R=/($^)/,T=/[&<>"']/g,q=/['\n\r\t\u2028\u2029\\]/g,D="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),z="[object Arguments]",W="[object Array]",P="[object Boolean]",K="[object Date]",M="[object Function]",U="[object Number]",V="[object Object]",G="[object RegExp]",H="[object String]",J={}; J[M]=b,J[z]=J[W]=J[P]=J[K]=J[U]=J[V]=J[G]=J[H]=h;var L={"boolean":b,"function":h,object:h,number:b,string:b,undefined:b},Q={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},X=L[typeof exports]&&exports,Y=L[typeof module]&&module&&module.exports==X&&module,Z=L[typeof global]&&global;!Z||Z.global!==Z&&Z.window!==Z||(n=Z);var nt=v();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=nt, define(function(){return nt})):X&&!X.nodeType?Y?(Y.exports=nt)._=nt:X._=nt:n._=nt }(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index becb0b48ef..31f74237cb 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 1.2.1 (Custom Build) + * Lo-Dash 1.3.0 (Custom Build) * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Copyright 2012-2013 The Dojo Foundation * Based on Underscore.js 1.4.4 @@ -4418,7 +4418,7 @@ * @memberOf _ * @type String */ - lodash.VERSION = '1.2.1'; + lodash.VERSION = '1.3.0'; // add functions to `lodash.prototype` mixin(lodash); diff --git a/dist/lodash.underscore.min.js b/dist/lodash.underscore.min.js index f46f284d94..2cd3559627 100644 --- a/dist/lodash.underscore.min.js +++ b/dist/lodash.underscore.min.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 1.2.1 (Custom Build) lodash.com/license + * Lo-Dash 1.3.0 (Custom Build) lodash.com/license * Build: `lodash underscore exports="amd,commonjs,global,node" -o ./dist/lodash.underscore.js` * Underscore.js 1.4.4 underscorejs.org/LICENSE */ @@ -31,5 +31,5 @@ t?u[o]=t[r]:u[o[0]]=o[1]}return u},f.select=k,f.tail=V,f.unique=G,f.chain=functi },f.isEmpty=b,f.isEqual=j,f.isFinite=function(n){return Rt(n)&&!Dt(parseFloat(n))},f.isFunction=w,f.isNaN=function(n){return x(n)&&n!=+n},f.isNull=function(n){return n===X},f.isNumber=x,f.isObject=A,f.isRegExp=function(n){return!(!n||!gt[typeof n])&&kt.call(n)==st},f.isString=O,f.isUndefined=function(n){return typeof n=="undefined"},f.lastIndexOf=function(n,t,r){var e=n?n.length:0;for(typeof r=="number"&&(e=(0>r?Tt(0,e+r):$t(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},f.mixin=L,f.noConflict=function(){return n._=bt,this },f.random=function(n,t){n==X&&t==X&&(t=1),n=+n||0,t==X?(t=n,n=0):t=+t||0;var r=It();return n%1||t%1?n+$t(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+Ot(r*(t-n+1))},f.reduce=M,f.reduceRight=T,f.result=function(n,t){var r=n?n[t]:X;return w(r)?n[t]():r},f.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Vt(n).length},f.some=$,f.sortedIndex=W,f.template=function(n,t,r){var e=f.templateSettings;n||(n=""),r=m({},r,e);var u=0,o="__p+='",e=r.variable;n.replace(RegExp((r.escape||et).source+"|"+(r.interpolate||et).source+"|"+(r.evaluate||et).source+"|$","g"),function(t,r,e,a,f){return o+=n.slice(u,f).replace(ot,i),r&&(o+="'+_['escape']("+r+")+'"),a&&(o+="';"+a+";__p+='"),e&&(o+="'+((__t=("+e+"))==null?'':__t)+'"),u=f+t.length,t }),o+="';\n",e||(e="obj",o="with("+e+"||{}){"+o+"}"),o="function("+e+"){var __t,__p='',__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+o+"return __p}";try{var a=Function("_","return "+o)(f)}catch(c){throw c.source=o,c}return t?a(t):(a.source=o,a)},f.unescape=function(n){return n==X?"":(n+"").replace(rt,g)},f.uniqueId=function(n){var t=++Z+"";return n?n+t:t},f.all=N,f.any=$,f.detect=B,f.findWhere=function(n,t){return I(n,t,Q)},f.foldl=M,f.foldr=T,f.include=S,f.inject=M,f.first=C,f.last=function(n,t,r){if(n){var e=0,u=n.length; -if(typeof t!="number"&&t!=X){var o=u;for(t=J(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==X||r)return n[u-1];return zt.call(n,Tt(0,u-e))}},f.take=C,f.head=C,f.VERSION="1.2.1",L(f),f.prototype.chain=function(){return this.__chain__=Q,this},f.prototype.value=function(){return this.__wrapped__},F("pop push reverse shift sort splice unshift".split(" "),function(n){var t=dt[n];f.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!Pt.spliceObjects&&0===n.length&&delete n[0],this}}),F(["concat","join","slice"],function(n){var t=dt[n]; +if(typeof t!="number"&&t!=X){var o=u;for(t=J(t,r);o--&&t(n[o],o,n);)e++}else if(e=t,e==X||r)return n[u-1];return zt.call(n,Tt(0,u-e))}},f.take=C,f.head=C,f.VERSION="1.3.0",L(f),f.prototype.chain=function(){return this.__chain__=Q,this},f.prototype.value=function(){return this.__wrapped__},F("pop push reverse shift sort splice unshift".split(" "),function(n){var t=dt[n];f.prototype[n]=function(){var n=this.__wrapped__;return t.apply(n,arguments),!Pt.spliceObjects&&0===n.length&&delete n[0],this}}),F(["concat","join","slice"],function(n){var t=dt[n]; f.prototype[n]=function(){var n=t.apply(this.__wrapped__,arguments);return this.__chain__&&(n=new c(n),n.__chain__=Q),n}}),typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=f, define(function(){return f})):yt&&!yt.nodeType?mt?(mt.exports=f)._=f:yt._=f:n._=f}(this); \ No newline at end of file diff --git a/doc/README.md b/doc/README.md index c0b2519db9..0fa513e3c7 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v1.2.1 +# Lo-Dash v1.3.0 diff --git a/doc/parse.php b/doc/parse.php index 8a4177f3b9..433c605c47 100644 --- a/doc/parse.php +++ b/doc/parse.php @@ -21,7 +21,7 @@ // generate Markdown $markdown = docdown(array( 'path' => '../' . $file, - 'title' => 'Lo-Dash v1.2.1', + 'title' => 'Lo-Dash v1.3.0', 'toc' => 'categories', 'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js' )); diff --git a/lodash.js b/lodash.js index ac0ea5358a..6f022e33c2 100644 --- a/lodash.js +++ b/lodash.js @@ -1,6 +1,6 @@ /** * @license - * Lo-Dash 1.2.1 + * Lo-Dash 1.3.0 * Copyright 2012-2013 The Dojo Foundation * Based on Underscore.js 1.4.4 * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud Inc. @@ -5838,7 +5838,7 @@ * @memberOf _ * @type String */ - lodash.VERSION = '1.2.1'; + lodash.VERSION = '1.3.0'; // add "Chaining" functions to the wrapper lodash.prototype.toString = wrapperToString; diff --git a/package.json b/package.json index 36e29b3ffd..a4f287c2a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lodash", - "version": "1.2.1", + "version": "1.3.0", "description": "A low-level utility library delivering consistency, customization, performance, and extra features.", "homepage": "http://lodash.com/", "license": "MIT", From 7ac57c27859031433682bbf39633ab64814312f4 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Tue, 11 Jun 2013 08:33:35 -0700 Subject: [PATCH 117/117] Update v1.3.0 docs --- doc/README.md | 252 +++++++++++++++++++++++++------------------------- doc/parse.php | 4 +- 2 files changed, 128 insertions(+), 128 deletions(-) diff --git a/doc/README.md b/doc/README.md index 0fa513e3c7..c1fe895c29 100644 --- a/doc/README.md +++ b/doc/README.md @@ -218,7 +218,7 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3637 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3637 "View in source") [Ⓣ][1] Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -242,7 +242,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3667 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3667 "View in source") [Ⓣ][1] Creates an array of `array` elements not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -267,7 +267,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3717 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3717 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the index of the element that passes the callback check, instead of the element itself. @@ -295,7 +295,7 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3787 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3787 "View in source") [Ⓣ][1] Gets the first element of the `array`. If a number `n` is passed, the first `n` elements of the `array` are returned. If a `callback` function is passed, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -355,7 +355,7 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3849 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3849 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is passed, each element of `array` is passed through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -398,7 +398,7 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3893 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3893 "View in source") [Ⓣ][1] Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. @@ -430,7 +430,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3960 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3960 "View in source") [Ⓣ][1] Gets all but the last element of `array`. If a number `n` is passed, the last `n` elements are excluded from the result. If a `callback` function is passed, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -487,7 +487,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3994 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3994 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -511,7 +511,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4096 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4096 "View in source") [Ⓣ][1] Gets the last element of the `array`. If a number `n` is passed, the last `n` elements of the `array` are returned. If a `callback` function is passed, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). @@ -568,7 +568,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4137 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4137 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -597,7 +597,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4178 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4178 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. @@ -635,7 +635,7 @@ _.range(0); ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4257 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4257 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is passed, the first `n` values are excluded from the result. If a `callback` function is passed, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -695,7 +695,7 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4321 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4321 "View in source") [Ⓣ][1] Uses a binary search to determine the smallest index at which the `value` should be inserted into `array` in order to maintain the sort order of the sorted `array`. If `callback` is passed, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -744,7 +744,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4353 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4353 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays using strict equality for comparisons, i.e. `===`. @@ -768,7 +768,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.uniq(array [, isSorted=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4403 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4403 "View in source") [Ⓣ][1] Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is passed, each element of `array` is passed through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. @@ -815,7 +815,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.unzip(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4459 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4459 "View in source") [Ⓣ][1] The inverse of `_.zip`, this method splits groups of elements into arrays composed of elements from each group at their corresponding indexes. @@ -839,7 +839,7 @@ _.unzip([['moe', 30, true], ['larry', 40, false]]); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4485 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4485 "View in source") [Ⓣ][1] Creates an array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -864,7 +864,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4505 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4505 "View in source") [Ⓣ][1] Groups the elements of each array at their corresponding indexes. Useful for separate data sources that are coordinated through matching array indexes. For a matrix of nested arrays, `_.zip.apply(...)` can transpose the matrix in a similar fashion. @@ -888,7 +888,7 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4527 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4527 "View in source") [Ⓣ][1] Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. @@ -923,7 +923,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L615 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L615 "View in source") [Ⓣ][1] Creates a `lodash` object, which wraps the given `value`, to enable method chaining. @@ -979,7 +979,7 @@ _.isArray(squares.value()); ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5626 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5626 "View in source") [Ⓣ][1] Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The purpose of this method is to "tap into" a method chain, in order to perform operations on intermediate results within the chain. @@ -1009,7 +1009,7 @@ _([1, 2, 3, 4]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5643 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5643 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1030,7 +1030,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5660 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5660 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1061,7 +1061,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2624 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2624 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1089,7 +1089,7 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2666 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2666 "View in source") [Ⓣ][1] Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -1127,7 +1127,7 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2721 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2721 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1163,7 +1163,7 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2773 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2773 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1209,7 +1209,7 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2834 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2834 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1255,7 +1255,7 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2901 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2901 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1304,7 +1304,7 @@ _.find(food, 'organic'); ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2948 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2948 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each element in the `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -1336,7 +1336,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2998 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2998 "View in source") [Ⓣ][1] Creates an object composed of keys returned from running each element of the `collection` through the `callback`. The corresponding value of each key is an array of elements passed to `callback` that returned the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1373,7 +1373,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3031 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3031 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be passed to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. @@ -1402,7 +1402,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3083 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3083 "View in source") [Ⓣ][1] Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1447,7 +1447,7 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3140 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3140 "View in source") [Ⓣ][1] Retrieves the maximum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1489,7 +1489,7 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3209 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3209 "View in source") [Ⓣ][1] Retrieves the minimum value of an `array`. If `callback` is passed, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. @@ -1531,7 +1531,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3259 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3259 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1561,7 +1561,7 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3291 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3291 "View in source") [Ⓣ][1] Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not passed, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. @@ -1599,7 +1599,7 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3334 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3334 "View in source") [Ⓣ][1] This method is similar to `_.reduce`, except that it iterates over a `collection` from right to left. @@ -1630,7 +1630,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); ### `_.reject(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3394 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3394 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. @@ -1673,7 +1673,7 @@ _.reject(food, { 'type': 'fruit' }); ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3415 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3415 "View in source") [Ⓣ][1] Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -1697,7 +1697,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3448 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3448 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1727,7 +1727,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3495 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3495 "View in source") [Ⓣ][1] Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1773,7 +1773,7 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3551 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3551 "View in source") [Ⓣ][1] Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. @@ -1810,7 +1810,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3587 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3587 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -1834,7 +1834,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3619 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L3619 "View in source") [Ⓣ][1] Examines each element in a `collection`, returning an array of all elements that have the given `properties`. When checking `properties`, this method performs a deep comparison between values to determine if they are equivalent to each other. @@ -1871,7 +1871,7 @@ _.where(stooges, { 'age': 40 }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4567 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4567 "View in source") [Ⓣ][1] If `n` is greater than `0`, a function is created that is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. If `n` is less than `1`, `func` is executed immediately, without a `this` binding or additional arguments, and its result is returned. @@ -1899,7 +1899,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4600 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4600 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those passed to the bound function. @@ -1930,7 +1930,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4631 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4631 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. @@ -1961,7 +1961,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4677 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4677 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those passed to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2002,7 +2002,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4700 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4700 "View in source") [Ⓣ][1] Creates a function that is the composition of the passed functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2029,7 +2029,7 @@ welcome('moe'); ### `_.createCallback([func=identity, thisArg, argCount=3])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4759 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4759 "View in source") [Ⓣ][1] Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. @@ -2083,7 +2083,7 @@ _.toLookup(stooges, 'name'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4836 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4836 "View in source") [Ⓣ][1] Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -2116,7 +2116,7 @@ jQuery('#postbox').on('click', _.debounce(sendMail, 200, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4933 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4933 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be passed to `func` when it is invoked. @@ -2141,7 +2141,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4959 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4959 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be passed to `func` when it is invoked. @@ -2168,7 +2168,7 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4984 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L4984 "View in source") [Ⓣ][1] Creates a function that memoizes the result of `func`. If `resolver` is passed, it will be used to determine the cache key for storing the result based on the arguments passed to the memoized function. By default, the first argument passed to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. @@ -2194,7 +2194,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5014 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5014 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2220,7 +2220,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5049 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5049 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. @@ -2247,7 +2247,7 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5080 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5080 "View in source") [Ⓣ][1] This method is similar to `_.partial`, except that `partial` arguments are appended to those passed to the new function. @@ -2284,7 +2284,7 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5113 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5113 "View in source") [Ⓣ][1] Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2316,7 +2316,7 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5154 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5154 "View in source") [Ⓣ][1] Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments passed to the function are appended to those passed to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. @@ -2352,7 +2352,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1362 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1362 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -2390,7 +2390,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1417 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1417 "View in source") [Ⓣ][1] Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2437,7 +2437,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1547 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1547 "View in source") [Ⓣ][1] Creates a deep clone of `value`. If a `callback` function is passed, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. @@ -2483,7 +2483,7 @@ clone.node == view.node; ### `_.defaults(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1571 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1571 "View in source") [Ⓣ][1] Assigns own enumerable properties of source object(s) to the destination object for all destination properties that resolve to `undefined`. Once a property is set, additional defaults of the same property will be ignored. @@ -2509,7 +2509,7 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1593 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1593 "View in source") [Ⓣ][1] This method is similar to `_.find`, except that it returns the key of the element that passes the callback check, instead of the element itself. @@ -2537,7 +2537,7 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1634 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1634 "View in source") [Ⓣ][1] Iterates over `object`'s own and inherited enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2573,7 +2573,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1659 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1659 "View in source") [Ⓣ][1] Iterates over an object's own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -2601,7 +2601,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1676 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1676 "View in source") [Ⓣ][1] Creates a sorted array of all enumerable properties, own and inherited, of `object` that have function values. @@ -2628,7 +2628,7 @@ _.functions(_); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1701 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1701 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -2653,7 +2653,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1718 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1718 "View in source") [Ⓣ][1] Creates an object composed of the inverted keys and values of the given `object`. @@ -2677,7 +2677,7 @@ _.invert({ 'first': 'moe', 'second': 'larry' }); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1225 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1225 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -2704,7 +2704,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1251 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1251 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -2731,7 +2731,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1744 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1744 "View in source") [Ⓣ][1] Checks if `value` is a boolean value. @@ -2755,7 +2755,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1761 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1761 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -2779,7 +2779,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1778 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1778 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -2803,7 +2803,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1803 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1803 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays, strings, or `arguments` objects with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -2833,7 +2833,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1862 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1862 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is passed, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. @@ -2878,7 +2878,7 @@ _.isEqual(words, otherWords, function(a, b) { ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2048 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2048 "View in source") [Ⓣ][1] Checks if `value` is, or can be coerced to, a finite number. @@ -2916,7 +2916,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2065 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2065 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -2940,7 +2940,7 @@ _.isFunction(_); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2128 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2128 "View in source") [Ⓣ][1] Checks if `value` is `NaN`. @@ -2975,7 +2975,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2150 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2150 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -3002,7 +3002,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2167 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2167 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -3026,7 +3026,7 @@ _.isNumber(8.4 * 5); ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2095 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2095 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)* @@ -3056,7 +3056,7 @@ _.isObject(1); ### `_.isPlainObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2195 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2195 "View in source") [Ⓣ][1] Checks if a given `value` is an object created by the `Object` constructor. @@ -3091,7 +3091,7 @@ _.isPlainObject({ 'name': 'moe', 'age': 40 }); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2220 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2220 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -3115,7 +3115,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2237 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2237 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -3139,7 +3139,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2254 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2254 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -3163,7 +3163,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1284 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L1284 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property names of `object`. @@ -3187,7 +3187,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2313 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2313 "View in source") [Ⓣ][1] Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is passed, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. @@ -3243,7 +3243,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2428 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2428 "View in source") [Ⓣ][1] Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is passed, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3274,7 +3274,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2463 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2463 "View in source") [Ⓣ][1] Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. @@ -3298,7 +3298,7 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2501 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2501 "View in source") [Ⓣ][1] Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is passed, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. @@ -3329,7 +3329,7 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2556 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2556 "View in source") [Ⓣ][1] An alternative to `_.reduce`, this method transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. @@ -3366,7 +3366,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2589 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L2589 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3397,7 +3397,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5178 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5178 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3421,7 +3421,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5196 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5196 "View in source") [Ⓣ][1] This method returns the first argument passed to it. @@ -3446,7 +3446,7 @@ moe === _.identity(moe); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5222 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5222 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -3476,7 +3476,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5251 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5251 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3496,7 +3496,7 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5275 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5275 "View in source") [Ⓣ][1] Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. @@ -3523,7 +3523,7 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5298 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5298 "View in source") [Ⓣ][1] Produces a random number between `min` and `max` *(inclusive)*. If only one argument is passed, a number between `0` and the given number will be returned. @@ -3551,7 +3551,7 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5342 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5342 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. @@ -3586,7 +3586,7 @@ _.result(object, 'stuff'); ### `_.runInContext([context=window])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L448 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L448 "View in source") [Ⓣ][1] Create a new `lodash` function using the given `context` object. @@ -3604,7 +3604,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5426 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5426 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -3686,7 +3686,7 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5551 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5551 "View in source") [Ⓣ][1] Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. @@ -3718,7 +3718,7 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5578 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5578 "View in source") [Ⓣ][1] The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. @@ -3742,7 +3742,7 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5598 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5598 "View in source") [Ⓣ][1] Generates a unique ID. If `prefix` is passed, the ID will be appended to it. @@ -3776,7 +3776,7 @@ _.uniqueId(); ### `_.templateSettings.imports._` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L824 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L824 "View in source") [Ⓣ][1] A reference to the `lodash` function. @@ -3795,7 +3795,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5841 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L5841 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -3807,7 +3807,7 @@ A reference to the `lodash` function. ### `_.support` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L642 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L642 "View in source") [Ⓣ][1] *(Object)*: An object used to flag environments features. @@ -3819,7 +3819,7 @@ A reference to the `lodash` function. ### `_.support.argsClass` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L667 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L667 "View in source") [Ⓣ][1] *(Boolean)*: Detect if an `arguments` object's [[Class]] is resolvable *(all but Firefox < `4`, IE < `9`)*. @@ -3831,7 +3831,7 @@ A reference to the `lodash` function. ### `_.support.argsObject` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L659 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L659 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` objects are `Object` objects *(all but Narwhal and Opera < `10.5`)*. @@ -3843,7 +3843,7 @@ A reference to the `lodash` function. ### `_.support.enumErrorProps` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L676 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L676 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `name` or `message` properties of `Error.prototype` are enumerable by default. *(IE < `9`, Safari < `5.1`)* @@ -3855,7 +3855,7 @@ A reference to the `lodash` function. ### `_.support.enumPrototypes` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L689 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L689 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `prototype` properties are enumerable by default. @@ -3869,7 +3869,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.fastBind` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L697 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L697 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Function#bind` exists and is inferred to be fast *(all but V8)*. @@ -3881,7 +3881,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumArgs` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L714 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L714 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `arguments` object indexes are non-enumerable *(Firefox < `4`, IE < `9`, PhantomJS, Safari < `5.1`)*. @@ -3893,7 +3893,7 @@ Firefox < `3.6`, Opera > `9.50` - Opera < `11.60`, and Safari < `5.1` *(if the p ### `_.support.nonEnumShadows` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L725 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L725 "View in source") [Ⓣ][1] *(Boolean)*: Detect if properties shadowing those on `Object.prototype` are non-enumerable. @@ -3907,7 +3907,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.ownLast` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L705 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L705 "View in source") [Ⓣ][1] *(Boolean)*: Detect if own properties are iterated after inherited properties *(all but IE < `9`)*. @@ -3919,7 +3919,7 @@ In IE < `9` an objects own properties, shadowing non-enumerable ones, are made n ### `_.support.spliceObjects` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L739 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L739 "View in source") [Ⓣ][1] *(Boolean)*: Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. @@ -3933,7 +3933,7 @@ Firefox < `10`, IE compatibility mode, and IE < `9` have buggy Array `shift()` a ### `_.support.unindexedChars` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L750 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L750 "View in source") [Ⓣ][1] *(Boolean)*: Detect lack of support for accessing string characters by index. @@ -3947,7 +3947,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L776 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L776 "View in source") [Ⓣ][1] *(Object)*: By default, the template delimiters used by Lo-Dash are similar to those in embedded Ruby *(ERB)*. Change the following template settings to use alternative delimiters. @@ -3959,7 +3959,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L784 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L784 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -3971,7 +3971,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L792 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L792 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -3983,7 +3983,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L800 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L800 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -3995,7 +3995,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L808 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L808 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. @@ -4007,7 +4007,7 @@ IE < `8` can't access characters by index and IE `8` can only access characters ### `_.templateSettings.imports` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L816 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/lodash/lodash/blob/1.3.0/lodash.js#L816 "View in source") [Ⓣ][1] *(Object)*: Used to import variables into the compiled template. @@ -4022,4 +4022,4 @@ IE < `8` can't access characters by index and IE `8` can only access characters - [1]: #Arrays "Jump back to the TOC." \ No newline at end of file + [1]: #Arrays "Jump back to the TOC." diff --git a/doc/parse.php b/doc/parse.php index 433c605c47..1d5081e958 100644 --- a/doc/parse.php +++ b/doc/parse.php @@ -23,7 +23,7 @@ 'path' => '../' . $file, 'title' => 'Lo-Dash v1.3.0', 'toc' => 'categories', - 'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js' + 'url' => 'https://github.com/lodash/lodash/blob/1.3.0/lodash.js' )); // save to a .md file @@ -33,4 +33,4 @@ header('Content-Type: text/plain;charset=utf-8'); echo $markdown . PHP_EOL; -?> \ No newline at end of file +?>