From 0dc88bb4126c28e290455dd18b33b94cf77f66c1 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 11 Jul 2012 22:46:16 -0400 Subject: [PATCH 1/3] Fix template regressions. [Closes #44] Former-commit-id: 15e98d86c290fea74780822b49b5d71e54064e01 --- lodash.js | 104 ++++++++++++++++++--------------------------------- test/test.js | 25 ++++++++++++- 2 files changed, 61 insertions(+), 68 deletions(-) diff --git a/lodash.js b/lodash.js index 6ee75ebc7a..17094979dc 100644 --- a/lodash.js +++ b/lodash.js @@ -50,15 +50,10 @@ /** Used to detect delimiter values that should be processed by `tokenizeEvaluate` */ var reComplexDelimiter = /[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/; - /** Used to match code generated in place of template delimiters */ - var reDelimiterCodeLeading = /^';\n/, - reDelimiterCodeMiddle = /^' \+\n/, - reDelimiterCodeTrailing = /(?:__p \+= '|\+\n')$/; - /** Used to match empty string literals in compiled template source */ var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+?=) '' \+/g, - reEmptyStringTrailing = /(__w?e\(.*?\)|\b__w?t\)) \+\n'';/g; + reEmptyStringMiddle = /\b(__p \+=) '' \+/g, + reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; /** Used to insert the data object variable into compiled template source */ var reInsertVariable = /(?:__e|__t = )\(\s*(?![\d\s"']|this\.)/g; @@ -672,12 +667,10 @@ var index = tokenized.length; if (value) { tokenized[index] = "';\n" + value + ";\n__p += '" - } - else if (escapeValue) { - tokenized[index] = "' +\n__we(" + escapeValue + ") +\n'"; - } - else if (interpolateValue) { - tokenized[index] = "' +\n((__wt = (" + interpolateValue + ")) == null ? '' : __wt) +\n'"; + } else if (escapeValue) { + tokenized[index] = "' +\n__e(" + escapeValue + ") +\n'"; + } else if (interpolateValue) { + tokenized[index] = "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'"; } return token + index; } @@ -3307,11 +3300,8 @@ // https://github.com/olado/doT options || (options = {}); - var endIndex, - isEvaluating, - startIndex, + var isEvaluating, result, - useWith, escapeDelimiter = options.escape, evaluateDelimiter = options.evaluate, interpolateDelimiter = options.interpolate, @@ -3337,83 +3327,63 @@ text = text.replace(interpolateDelimiter, tokenizeInterpolate); } if (evaluateDelimiter != lastEvaluateDelimiter) { + // generate `reEvaluateDelimiter` to match `_.templateSettings.evaluate` + // and internal ``, `` delimiters lastEvaluateDelimiter = evaluateDelimiter; reEvaluateDelimiter = RegExp( (evaluateDelimiter ? evaluateDelimiter.source : '($^)') + '||' , 'g'); } - startIndex = tokenized.length; + isEvaluating = tokenized.length; text = text.replace(reEvaluateDelimiter, tokenizeEvaluate); - endIndex = tokenized.length - 1; - isEvaluating = startIndex <= endIndex; - - // if `options.variable` is not specified and the template contains "evaluate" - // delimiters, inject a with-statement around all "evaluate" delimiters to - // add the data object to the top of the scope chain - if (!variable) { - variable = settings.variable || lastVariable || 'obj'; - useWith = isEvaluating; - - if (useWith) { - tokenized[startIndex] = "';\n__with (" + variable + ') {\n' + tokenized[startIndex] - .replace(reDelimiterCodeLeading, '') - .replace(reDelimiterCodeMiddle, '__p += '); - - tokenized[endIndex] = tokenized[endIndex] - .replace(reDelimiterCodeTrailing, '') + "\n}__\n__p += '"; - } - } - - var strInsertVariable = '$&' + variable + '.', - strDoubleVariable = '$1__d'; + isEvaluating = isEvaluating != tokenized.length; // escape characters that cannot be included in string literals and // detokenize delimiter code snippets - text = "__p = '" + text + text = "__p += '" + text .replace(reUnescapedString, escapeStringChar) .replace(reToken, detokenize) + "';\n"; // clear stored code snippets tokenized.length = 0; - // find the start and end indexes of the with-statement - if (useWith) { - startIndex = text.indexOf('__with'); - endIndex = text.indexOf('}__', startIndex + 10); - } - // memoize `reDoubleVariable` - if (variable != lastVariable) { - lastVariable = variable; - reDoubleVariable = RegExp('([(\\s])' + variable + '\\.' + variable + '\\b', 'g'); - } - // prepend data object references to property names outside of the with-statement - text = (useWith ? text.slice(0, startIndex) : text) - .replace(reInsertVariable, strInsertVariable) - .replace(reDoubleVariable, strDoubleVariable) + - (useWith - ? text.slice(startIndex + 2, endIndex + 1) + - text.slice(endIndex + 3) - .replace(reInsertVariable, strInsertVariable) - .replace(reDoubleVariable, strDoubleVariable) - : '' - ); + // if `options.variable` is not specified and the template contains "evaluate" + // delimiters, wrap a with-statement around the generated code to add the + // data object to the top of the scope chain + if (!variable) { + variable = settings.variable || lastVariable || 'obj'; + + if (isEvaluating) { + text = 'with (' + variable + ') {\n' + text + '\n}\n'; + } + else { + if (variable != lastVariable) { + // generate `reDoubleVariable` to match references like `obj.obj` inside + // transformed "escape" and "interpolate" delimiters + lastVariable = variable; + reDoubleVariable = RegExp('(\\(\\s*)' + variable + '\\.' + variable + '\\b', 'g'); + } + // avoid a with-statement by prepending data object references to property names + text = text + .replace(reInsertVariable, '$&' + variable + '.') + .replace(reDoubleVariable, '$1__d'); + } + } // cleanup code by stripping empty strings - text = (isEvaluating ? text.replace(reEmptyStringLeading, '') : text) + text = ( isEvaluating ? text.replace(reEmptyStringLeading, '') : text) .replace(reEmptyStringMiddle, '$1') .replace(reEmptyStringTrailing, '$1;'); // frame code as the function body text = 'function(' + variable + ') {\n' + variable + ' || (' + variable + ' = {});\n' + - 'var __p, __t, __wt' + - ', __d = ' + variable + '.' + variable + ' || ' + variable + - ', __e = _.escape, __we = __e' + + 'var __t, __p = \'\', __e = _.escape' + (isEvaluating ? ', __j = Array.prototype.join;\n' + 'function print() { __p += __j.call(arguments, \'\') }\n' - : ';\n' + : ', __d = ' + variable + '.' + variable + ' || ' + variable + ';\n' ) + text + 'return __p\n}'; diff --git a/test/test.js b/test/test.js index e6bed5281f..c240e244c6 100644 --- a/test/test.js +++ b/test/test.js @@ -771,9 +771,32 @@ var compiled = _.template(key), data = { 'a': 1, 'b': 2 }; - equal(compiled(data), value); + equal(compiled(data), value, key); }); }); + + test('should allow referencing variables declared in "evaluate" delimiters from other delimiters', function() { + var compiled = _.template('<% var b = a; %><%= b.value %>'), + data = { 'a': { 'value': 1 } }; + + equal(compiled(data), '1'); + }); + + test('should work when passing `options.variable`', function() { + var compiled = _.template( + '<% _.forEach( data.a, function( value ) { %>' + + '<%= value.valueOf() %>' + + '<% }) %>', null, { 'variable': 'data' } + ); + + var data = { 'a': [1, 2, 3] }; + + try { + equal(compiled(data), '123'); + } catch(e) { + ok(false); + } + }); }()); /*--------------------------------------------------------------------------*/ From 1f3546a9f6bc45a8a537a4f28c4e3d8c81bf558c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 11 Jul 2012 23:37:12 -0400 Subject: [PATCH 2/3] Cleanup pre-compile.js and build.js removing more unused vars missed by minifiers. Former-commit-id: 198715b39ced1a33bd55109099af462ae96a7188 --- build.js | 134 +++++++++++++++++++++++++------------------ build/pre-compile.js | 4 +- 2 files changed, 79 insertions(+), 59 deletions(-) diff --git a/build.js b/build.js index cbc829a24b..7d6d23438a 100755 --- a/build.js +++ b/build.js @@ -405,10 +405,14 @@ * @returns {String} Returns the modified source. */ function removeFromCreateIterator(source, refName) { - var snippet = matchFunction(source, 'createIterator').match(/Function\([\s\S]+$/)[0], - modified = snippet.replace(RegExp('\\b' + refName + '\\b,? *', 'g'), ''); - - return source.replace(snippet, modified); + var snippet = matchFunction(source, 'createIterator'); + if (snippet) { + // clip the snippet the `factory` assignment + snippet = snippet.match(/Function\([\s\S]+$/)[0]; + var modified = snippet.replace(RegExp('\\b' + refName + '\\b,? *', 'g'), ''); + source = source.replace(snippet, modified); + } + return source; } /** @@ -611,56 +615,6 @@ } }); } - - // remove associated functions, variables, and code snippets - if (isRemoved(source, 'isArguments')) { - source = removeIsArgumentsFallback(source); - } - if (isRemoved(source, 'mixin')) { - // remove `LoDash` constructor - source = removeFunction(source, 'LoDash'); - // remove `LoDash` calls - source = source.replace(/(?:new +LoDash(?!\()|(?:new +)?LoDash\([^)]*\));?/g, ''); - // remove `LoDash.prototype` additions - source = source.replace(/(?:\s*\/\/.*)*\s*LoDash.prototype *=[\s\S]+?\/\*-+\*\//, ''); - } - if (isRemoved(source, 'sortBy')) { - source = removeFunction(source, 'compareAscending'); - } - if (isRemoved(source, 'template')) { - // remove `templateSettings` assignment - source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, ''); - } - if (isRemoved(source, 'isArray', 'isEmpty', 'isEqual', 'size')) { - source = removeVar(source, 'arrayClass'); - } - if (isRemoved(source, 'bind', 'functions', 'groupBy', 'invoke', 'isEqual', 'isFunction', 'result', 'sortBy', 'toArray')) { - source = removeVar(source, 'funcClass'); - } - if (isRemoved(source, 'bind')) { - source = removeVar(source, 'nativeBind'); - source = removeVar(source, 'isBindFast'); - } - if (isRemoved(source, 'isArray')) { - source = removeVar(source, 'nativeIsArray'); - } - if (isRemoved(source, 'keys')) { - source = removeFunction(source, 'shimKeys'); - } - if (isRemoved(source, 'clone', 'isObject', 'keys')) { - source = removeVar(source, 'objectTypes'); - } - if (isRemoved(source, 'bind', 'isArray', 'keys')) { - source = removeVar(source, 'reNative'); - } - if (isRemoved(source, 'isEmpty', 'isEqual', 'isString', 'size')) { - source = removeVar(source, 'stringClass'); - } - - // consolidate consecutive horizontal rule comment separators - source = source.replace(/(?:\s*\/\*-+\*\/\s*){2,}/g, function(separators) { - return separators.match(/^\s*/)[0] + separators.slice(separators.lastIndexOf('/*')); - }); }()); /*--------------------------------------------------------------------------*/ @@ -847,12 +801,13 @@ // remove unnecessary code snippet = snippet - .replace(/, *__t,[^;]+|function print[^}]+}/g, '') + .replace(/var __t.+/, "var __p = '';") + .replace(/function print[^}]+}/, '') .replace(/'(?:\\n|\s)+'/g, "''") .replace(/__p *\+= *' *';/g, '') .replace(/(__p *\+= *)' *' *\+/g, '$1') .replace(/(\{) *;|; *(\})/g, '$1$2') - .replace(/\(\(__w?t *= *\( *([^)]+) *\)\) *== *null *\? *'' *: *__w?t\)/g, '$1'); + .replace(/\(\(__t *= *\( *([^)]+) *\)\) *== *null *\? *'' *: *__t\)/g, '$1'); // remove the with-statement snippet = snippet.replace(/ *with *\(.+?\) *{/, '\n').replace(/}([^}]*}[^}]*$)/, '$1'); @@ -860,7 +815,7 @@ // minor cleanup snippet = snippet .replace(/obj *\|\| *\(obj *= *\{}\);/, '') - .replace(/var __p;\s*__p/, 'var __p'); + .replace(/var __p = '';\s*__p \+=/, 'var __p ='); // remove comments, including sourceURLs snippet = snippet.replace(/\s*\/\/.*(?:\n|$)/g, ''); @@ -871,9 +826,74 @@ /*--------------------------------------------------------------------------*/ + // remove associated functions, variables, and code snippets that the minifier may miss + if (isRemoved(source, 'isArguments')) { + source = removeIsArgumentsFallback(source); + } + if (isRemoved(source, 'mixin')) { + // remove `LoDash` constructor + source = removeFunction(source, 'LoDash'); + // remove `LoDash` calls + source = source.replace(/(?:new +LoDash(?!\()|(?:new +)?LoDash\([^)]*\));?/g, ''); + // remove `LoDash.prototype` additions + source = source.replace(/(?:\s*\/\/.*)*\s*LoDash.prototype *=[\s\S]+?\/\*-+\*\//, ''); + } + if (isRemoved(source, 'sortBy')) { + source = removeFunction(source, 'compareAscending'); + } + if (isRemoved(source, 'template')) { + // remove `templateSettings` assignment + source = source.replace(/(?:\n +\/\*[^*]*\*+(?:[^\/][^*]*\*+)*\/)?\n *lodash\.templateSettings[\s\S]+?};\n/, ''); + } + if (isRemoved(source, 'toArray')) { + source = removeVar(source, 'noArraySliceOnStrings'); + } + if (isRemoved(source, 'isArray', 'isEmpty', 'isEqual', 'size')) { + source = removeVar(source, 'arrayClass'); + } + if (isRemoved(source, 'bind', 'functions', 'groupBy', 'invoke', 'isEqual', 'isFunction', 'result', 'sortBy', 'toArray')) { + source = removeVar(source, 'funcClass'); + } + if (isRemoved(source, 'bind')) { + source = removeVar(source, 'nativeBind'); + source = removeVar(source, 'isBindFast'); + } + if (isRemoved(source, 'isArray')) { + source = removeVar(source, 'nativeIsArray'); + } + if (isRemoved(source, 'keys')) { + source = removeFunction(source, 'shimKeys'); + } + if (isRemoved(source, 'clone', 'isObject', 'keys')) { + source = removeVar(source, 'objectTypes'); + } + if (isRemoved(source, 'bind', 'isArray', 'keys')) { + source = removeVar(source, 'reNative'); + } + if (isRemoved(source, 'isEmpty', 'isEqual', 'isString', 'size')) { + source = removeVar(source, 'stringClass'); + } + if ((source.match(/\bcreateIterator\b/g) || []).length < 2) { + source = removeFunction(source, 'createIterator'); + } + if (isRemoved(source, 'createIterator', 'extend', 'isEqual')) { + source = removeVar(source, 'hasDontEnumBug'); + } + if (isRemoved(source, 'createIterator', 'keys')) { + source = removeVar(source, 'nativeKeys'); + } + if (isRemoved(source, 'createIterator', 'reduceRight')) { + source = removeVar(source, 'noCharByIndex'); + } + // remove pseudo private properties source = source.replace(/(?:(?:\s*\/\/.*)*\s*lodash\._[^=]+=.+\n)+/g, '\n'); + // consolidate consecutive horizontal rule comment separators + source = source.replace(/(?:\s*\/\*-+\*\/\s*){2,}/g, function(separators) { + return separators.match(/^\s*/)[0] + separators.slice(separators.lastIndexOf('/*')); + }); + // cleanup code source = source.replace(/^ *;\n/gm, ''); diff --git a/build/pre-compile.js b/build/pre-compile.js index 5736212e7c..759625b049 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -308,8 +308,8 @@ modified = modified.replace(RegExp('\\.(' + iteratorOptions.join('|') + ')\\b', 'g'), "['$1']"); if (isCreateIterator) { - // replace with modified snippet early and clip snippet so other arguments - // aren't minified + // replace with modified snippet early and clip snippet to the `factory` + // call so other arguments aren't minified source = source.replace(snippet, modified); snippet = modified = modified.replace(/factory\([\s\S]+$/, ''); } From 46781e761401634585044f93241d0b776ceed31c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Thu, 12 Jul 2012 00:06:36 -0400 Subject: [PATCH 3/3] Bump to v0.4.1. Former-commit-id: ef73c95edc22d59412affba898d9820251c06b5b --- README.md | 57 ++++++++------- build.js | 9 ++- doc/README.md | 188 +++++++++++++++++++++++++------------------------- doc/parse.php | 2 +- lodash.js | 4 +- lodash.min.js | 62 ++++++++--------- package.json | 2 +- test/test.js | 2 +- 8 files changed, 167 insertions(+), 159 deletions(-) diff --git a/README.md b/README.md index a322648490..88ce31ece5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v0.4.0 +# Lo-Dash v0.4.1 A drop-in replacement for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), that delivers [performance improvements](http://lodash.com/benchmarks), [bug fixes](https://github.com/bestiejs/lodash#closed-underscorejs-issues), and [additional features](https://github.com/bestiejs/lodash#features). @@ -6,8 +6,8 @@ Lo-Dash’s performance is gained by avoiding slower native methods, instead opt ## Download - * [Development source](https://raw.github.com/bestiejs/lodash/v0.4.0/lodash.js) - * [Production source](https://raw.github.com/bestiejs/lodash/v0.4.0/lodash.min.js) + * [Development source](https://raw.github.com/bestiejs/lodash/v0.4.1/lodash.js) + * [Production source](https://raw.github.com/bestiejs/lodash/v0.4.1/lodash.min.js) * CDN copies of ≤ [v0.3.2](http://cdnjs.cloudflare.com/ajax/libs/lodash.js/0.3.2/lodash.min.js) are available on [cdnjs](http://cdnjs.com/) thanks to [CloudFlare](http://www.cloudflare.com/) * For optimal performance, [create a custom build](https://github.com/bestiejs/lodash#custom-builds) with only the features you need @@ -61,7 +61,7 @@ lodash backbone lodash legacy ~~~ - * Mobile builds, with IE bug fixes and method compilation removed, may be created using the `mobile` modifier argument. + * Mobile builds, with IE < 9 bug fixes and method compilation removed, may be created using the `mobile` modifier argument. ~~~ bash lodash mobile ~~~ @@ -146,29 +146,29 @@ require({ ## Closed Underscore.js issues (20+) - * Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [#659](https://github.com/documentcloud/underscore/issues/659), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L306-312)] - * Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L257-263), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L607-621), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L840-843)] - * Ensure *"Arrays"* methods allow falsey `array` arguments [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L908-947)] - * Ensure *"Collections"* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L265-283), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L623-640), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L845-848)] - * Ensure templates compiled with errors are inspectable [[#666](https://github.com/documentcloud/underscore/issues/666), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L737-744)] - * Fix cross-browser object iteration bugs [[#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L195-207), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L317-342), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L438-449), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L457-459), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L477-497), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L667-669)] + * Allow iteration of objects with a `length` property [[#148](https://github.com/documentcloud/underscore/issues/148), [#154](https://github.com/documentcloud/underscore/issues/154), [#252](https://github.com/documentcloud/underscore/issues/252), [#448](https://github.com/documentcloud/underscore/issues/448), [#659](https://github.com/documentcloud/underscore/issues/659), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L306-312)] + * Ensure array-like objects with invalid `length` properties are treated like regular objects [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L257-263), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L607-621), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L863-866)] + * Ensure *"Arrays"* methods allow falsey `array` arguments [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L931-970)] + * Ensure *"Collections"* methods allow string `collection` arguments [[#247](https://github.com/documentcloud/underscore/issues/247), [#276](https://github.com/documentcloud/underscore/issues/276), [#561](https://github.com/documentcloud/underscore/pull/561), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L265-283), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L623-640), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L868-871)] + * Ensure templates compiled with errors are inspectable [[#666](https://github.com/documentcloud/underscore/issues/666), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L737-744)] + * Fix cross-browser object iteration bugs [[#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L195-207), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L317-342), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L438-449), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L457-459), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L477-497), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L667-669)] * Handle arrays with `undefined` values correctly in IE < 9 [[#601](https://github.com/documentcloud/underscore/issues/601)] - * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L86-92)] - * Register as an AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L70-84)] - * `_(…)` should return passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L104-107)] - * `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L138-147)] - * `_.escape` should return an empty string when passed `null` or `undefined` [[#407](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L176-179)] - * `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L252-255)] - * `_.groupBy` should add values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L357-364)] - * `_isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L467-469)] - * `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L591-605)] - * `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L650-652)] - * `_.size` shouldn't error on falsey values [[#650](https://github.com/documentcloud/underscore/pull/650), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L654-661)] - * `_.size` should work with `arguments` objects cross-browser [[#653](https://github.com/documentcloud/underscore/issues/653), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L663-665)] - * `_.sortedIndex` should support arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L707-716)] - * `_.template` should not augment the `options` object [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L731-735)] - * `_.throttle` should work when called in a tight loop [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L791-801)] - * `_.zipObject` should accept less than two arguments [[test](https://github.com/bestiejs/lodash/blob/v0.4.0/test/test.js#L870-872)] + * Methods should work on pages with incorrectly shimmed native methods [[#7](https://github.com/documentcloud/underscore/issues/7), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L86-92)] + * Register as an AMD module, but still export to global [[#431](https://github.com/documentcloud/underscore/pull/431), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L70-84)] + * `_(…)` should return passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L104-107)] + * `_.contains` should work with strings [[#667](https://github.com/documentcloud/underscore/pull/667), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L138-147)] + * `_.escape` should return an empty string when passed `null` or `undefined` [[#407](https://github.com/documentcloud/underscore/issues/427), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L176-179)] + * `_.forEach` should be chainable [[#142](https://github.com/documentcloud/underscore/issues/142), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L252-255)] + * `_.groupBy` should add values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L357-364)] + * `_isNaN(new Number(NaN))` should return `true` [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L467-469)] + * `_.reduceRight` should pass correct callback arguments when iterating objects [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L591-605)] + * `_.size` should return the `length` of string values [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L650-652)] + * `_.size` shouldn't error on falsey values [[#650](https://github.com/documentcloud/underscore/pull/650), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L654-661)] + * `_.size` should work with `arguments` objects cross-browser [[#653](https://github.com/documentcloud/underscore/issues/653), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L663-665)] + * `_.sortedIndex` should support arrays with high `length` values [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L707-716)] + * `_.template` should not augment the `options` object [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L731-735)] + * `_.throttle` should work when called in a tight loop [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L814-824)] + * `_.zipObject` should accept less than two arguments [[test](https://github.com/bestiejs/lodash/blob/v0.4.1/test/test.js#L893-895)] ## Optimized methods (50+) @@ -233,6 +233,11 @@ require({ ## Release Notes +### v0.4.1 + + * Fixed `_.template` regression + * Optimized build process to detect and remove more unused variables + ### v0.4.0 * Added `bin` and `scripts` entries to package.json diff --git a/build.js b/build.js index 7d6d23438a..26ba3eea9a 100755 --- a/build.js +++ b/build.js @@ -615,6 +615,12 @@ } }); } + + // remove `isArguments` fallback before `isArguments` is transformed by + // other parts of the build process + if (isRemoved(source, 'isArguments')) { + source = removeIsArgumentsFallback(source); + } }()); /*--------------------------------------------------------------------------*/ @@ -827,9 +833,6 @@ /*--------------------------------------------------------------------------*/ // remove associated functions, variables, and code snippets that the minifier may miss - if (isRemoved(source, 'isArguments')) { - source = removeIsArgumentsFallback(source); - } if (isRemoved(source, 'mixin')) { // remove `LoDash` constructor source = removeFunction(source, 'LoDash'); diff --git a/doc/README.md b/doc/README.md index 19557f49c4..b01d7a65af 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v0.4.0 +# Lo-Dash v0.4.1 @@ -130,7 +130,7 @@ ### `_(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L197 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L192 "View in source") [Ⓣ][1] The `lodash` function. @@ -148,7 +148,7 @@ The `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3593 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3563 "View in source") [Ⓣ][1] *(String)*: The semantic version number. @@ -160,7 +160,7 @@ The `lodash` function. ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1953 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1946 "View in source") [Ⓣ][1] Creates a new function that is restricted to executing only after it is called `n` times. @@ -188,7 +188,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2007 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2000 "View in source") [Ⓣ][1] Creates a new 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. Lazy defined methods may be bound by passing the object they are bound to as `func` and the method name as `thisArg`. @@ -239,7 +239,7 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2077 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2070 "View in source") [Ⓣ][1] Binds methods on `object` to `object`, overwriting the existing method. If no method names are provided, all the function properties of `object` will be bound. @@ -270,7 +270,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick); ### `_.chain(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3518 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3488 "View in source") [Ⓣ][1] Wraps the value in a `lodash` wrapper object. @@ -304,7 +304,7 @@ var youngest = _.chain(stooges) ### `_.clone(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2403 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2396 "View in source") [Ⓣ][1] Create a shallow clone of the `value`. Any nested objects or arrays will be assigned by reference and not cloned. @@ -328,7 +328,7 @@ _.clone({ 'name': 'moe' }); ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1200 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1193 "View in source") [Ⓣ][1] Produces a new array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. @@ -352,7 +352,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2109 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2102 "View in source") [Ⓣ][1] Creates a new function that is the composition of the passed functions, where each function consumes the return value of the function that follows. In math terms, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. @@ -379,7 +379,7 @@ welcome('moe'); ### `_.contains(collection, target)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L726 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L719 "View in source") [Ⓣ][1] Checks if a given `target` value is present in a `collection` using strict equality for comparisons, i.e. `===`. @@ -410,7 +410,7 @@ _.contains('curly', 'ur'); ### `_.debounce(func, wait, immediate)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2142 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2135 "View in source") [Ⓣ][1] Creates a new function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass `true` for `immediate` to cause debounce to invoke `func` on the leading, instead of the trailing, edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. @@ -436,7 +436,7 @@ jQuery(window).on('resize', lazyLayout); ### `_.defaults(object [, defaults1, defaults2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2426 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2419 "View in source") [Ⓣ][1] Assigns missing properties on `object` with default values from the defaults objects. Once a property is set, additional defaults of the same property will be ignored. @@ -462,7 +462,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'rainbow' }); ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2207 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2200 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments are passed to `func` when it is invoked. @@ -487,7 +487,7 @@ _.defer(function() { alert('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2187 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2180 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments are passed to `func` when it is invoked. @@ -514,7 +514,7 @@ _.delay(log, 1000, 'logged later'); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1232 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1225 "View in source") [Ⓣ][1] Produces a new array of `array` values not present in the other arrays using strict equality for comparisons, i.e. `===`. @@ -539,7 +539,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3135 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3128 "View in source") [Ⓣ][1] Escapes a string for inclusion in HTML, replacing `&`, `<`, `"`, and `'` characters. @@ -563,7 +563,7 @@ _.escape('Curly, Larry & Moe'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L755 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L748 "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 `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -589,7 +589,7 @@ _.every([true, 1, null, 'yes'], Boolean); ### `_.extend(object [, source1, source2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2445 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2438 "View in source") [Ⓣ][1] Copies enumerable properties from the source objects to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources. @@ -614,7 +614,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L776 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L769 "View in source") [Ⓣ][1] Examines each value in a `collection`, returning an array of all values the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -640,7 +640,7 @@ var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }) ### `_.find(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L798 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L791 "View in source") [Ⓣ][1] Examines each value in a `collection`, returning the first one the `callback` returns truthy for. The function returns as soon as it finds an acceptable value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -666,7 +666,7 @@ var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); ### `_.first(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1268 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1261 "View in source") [Ⓣ][1] Gets the first value of the `array`. Pass `n` to return the first `n` values of the `array`. @@ -692,7 +692,7 @@ _.first([5, 4, 3, 2, 1]); ### `_.flatten(array, shallow)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1292 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1285 "View in source") [Ⓣ][1] Flattens a nested array *(the nesting can be to any depth)*. If `shallow` is truthy, `array` will only be flattened a single level. @@ -720,7 +720,7 @@ _.flatten([1, [2], [3, [[4]]]], true); ### `_.forEach(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L825 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L818 "View in source") [Ⓣ][1] Iterates over a `collection`, executing the `callback` for each value in the `collection`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -749,7 +749,7 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, alert); ### `_.forIn(object, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2474 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2467 "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 `3` arguments; *(value, key, object)*. @@ -785,7 +785,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2497 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2490 "View in source") [Ⓣ][1] Iterates over `object`'s own enumerable properties, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, key, object)*. @@ -813,7 +813,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.functions(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2514 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2507 "View in source") [Ⓣ][1] Produces a sorted array of the enumerable properties, own and inherited, of `object` that have function values. @@ -837,7 +837,7 @@ _.functions(_); ### `_.groupBy(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L853 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L846 "View in source") [Ⓣ][1] Splits `collection` into sets, grouped by the result of running each value through `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. The `callback` argument may also be the name of a property to group by. @@ -869,7 +869,7 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.has(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2537 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2530 "View in source") [Ⓣ][1] Checks if the specified object `property` exists and is a direct property, instead of an inherited property. @@ -894,7 +894,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3154 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3147 "View in source") [Ⓣ][1] This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback. @@ -919,7 +919,7 @@ moe === _.identity(moe); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1336 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1329 "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 `isSorted` will run a faster binary search. @@ -951,7 +951,7 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1376 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1369 "View in source") [Ⓣ][1] Gets all but the last value of `array`. Pass `n` to exclude the last `n` values from the result. @@ -977,7 +977,7 @@ _.initial([3, 2, 1]); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1397 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1390 "View in source") [Ⓣ][1] Computes the intersection of all the passed-in arrays. @@ -1001,7 +1001,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L887 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L880 "View in source") [Ⓣ][1] Invokes the method named by `methodName` on each element in the `collection`. 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`. @@ -1030,7 +1030,7 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.isArguments(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2557 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2550 "View in source") [Ⓣ][1] Checks if `value` is an `arguments` object. @@ -1057,7 +1057,7 @@ _.isArguments([1, 2, 3]); ### `_.isArray(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2583 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2576 "View in source") [Ⓣ][1] Checks if `value` is an array. @@ -1084,7 +1084,7 @@ _.isArray([1, 2, 3]); ### `_.isBoolean(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2600 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2593 "View in source") [Ⓣ][1] Checks if `value` is a boolean *(`true` or `false`)* value. @@ -1108,7 +1108,7 @@ _.isBoolean(null); ### `_.isDate(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2617 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2610 "View in source") [Ⓣ][1] Checks if `value` is a date. @@ -1132,7 +1132,7 @@ _.isDate(new Date); ### `_.isElement(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2634 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2627 "View in source") [Ⓣ][1] Checks if `value` is a DOM element. @@ -1156,7 +1156,7 @@ _.isElement(document.body); ### `_.isEmpty(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2658 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2651 "View in source") [Ⓣ][1] Checks if `value` is empty. Arrays or strings with a length of `0` and objects with no own enumerable properties are considered "empty". @@ -1186,7 +1186,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, stack])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2692 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2685 "View in source") [Ⓣ][1] Performs a deep comparison between two values to determine if they are equivalent to each other. @@ -1218,7 +1218,7 @@ _.isEqual(moe, clone); ### `_.isFinite(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2853 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2846 "View in source") [Ⓣ][1] Checks if `value` is a finite number. Note: This is not the same as native `isFinite`, which will return true for booleans and other values. See http://es5.github.com/#x15.1.2.5. @@ -1248,7 +1248,7 @@ _.isFinite(Infinity); ### `_.isFunction(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2870 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2863 "View in source") [Ⓣ][1] Checks if `value` is a function. @@ -1272,7 +1272,7 @@ _.isFunction(''.concat); ### `_.isNaN(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2922 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2915 "View in source") [Ⓣ][1] 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. @@ -1305,7 +1305,7 @@ _.isNaN(undefined); ### `_.isNull(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2945 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2938 "View in source") [Ⓣ][1] Checks if `value` is `null`. @@ -1332,7 +1332,7 @@ _.isNull(undefined); ### `_.isNumber(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2962 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2955 "View in source") [Ⓣ][1] Checks if `value` is a number. @@ -1356,7 +1356,7 @@ _.isNumber(8.4 * 5; ### `_.isObject(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2891 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2884 "View in source") [Ⓣ][1] Checks if `value` is the language type of Object. *(e.g. arrays, functions, objects, regexps, `new Number(0)`, and `new String('')`)* @@ -1383,7 +1383,7 @@ _.isObject(1); ### `_.isRegExp(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2979 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2972 "View in source") [Ⓣ][1] Checks if `value` is a regular expression. @@ -1407,7 +1407,7 @@ _.isRegExp(/moe/); ### `_.isString(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2996 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2989 "View in source") [Ⓣ][1] Checks if `value` is a string. @@ -1431,7 +1431,7 @@ _.isString('moe'); ### `_.isUndefined(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3014 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3007 "View in source") [Ⓣ][1] Checks if `value` is `undefined`. @@ -1455,7 +1455,7 @@ _.isUndefined(void 0); ### `_.keys(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3031 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3024 "View in source") [Ⓣ][1] Produces an array of object`'s own enumerable property names. @@ -1479,7 +1479,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.last(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1435 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1428 "View in source") [Ⓣ][1] Gets the last value of the `array`. Pass `n` to return the lasy `n` values of the `array`. @@ -1505,7 +1505,7 @@ _.last([3, 2, 1]); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1461 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1454 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. @@ -1534,7 +1534,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L924 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L917 "View in source") [Ⓣ][1] Produces a new array of values by mapping each element in the `collection` through a transformation `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -1563,7 +1563,7 @@ _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); ### `_.max(array [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1501 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1494 "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 `3` arguments; *(value, index, array)*. @@ -1595,7 +1595,7 @@ _.max(stooges, function(stooge) { return stooge.age; }); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2230 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2223 "View in source") [Ⓣ][1] Creates a new 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. @@ -1621,7 +1621,7 @@ var fibonacci = _.memoize(function(n) { ### `_.min(array [, callback, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1551 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1544 "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 `3` arguments; *(value, index, array)*. @@ -1647,7 +1647,7 @@ _.min([10, 5, 100, 2, 1000]); ### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3180 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3173 "View in source") [Ⓣ][1] Adds functions properties of `object` to the `lodash` function and chainable wrapper. @@ -1677,7 +1677,7 @@ _('larry').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3211 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3204 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -1697,7 +1697,7 @@ var lodash = _.noConflict(); ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2256 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2249 "View in source") [Ⓣ][1] Creates a new function that is restricted to one execution. Repeat calls to the function will return the value of the first call. @@ -1723,7 +1723,7 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2289 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2282 "View in source") [Ⓣ][1] Creates a new function that, when called, invokes `func` with any additional `partial` arguments prepended to those passed to the partially applied function. This method is similar `bind`, except it does **not** alter the `this` binding. @@ -1750,7 +1750,7 @@ hi('moe'); ### `_.pick(object [, prop1, prop2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3053 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3046 "View in source") [Ⓣ][1] Creates an object composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. @@ -1775,7 +1775,7 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L947 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L940 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1806,7 +1806,7 @@ _.pluck(stooges, 'name'); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1612 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1605 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `stop`. This method is a port of Python's `range()` function. See http://docs.python.org/library/functions.html#range. @@ -1844,7 +1844,7 @@ _.range(0); ### `_.reduce(collection, callback [, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L976 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L969 "View in source") [Ⓣ][1] Boils down a `collection` to a single value. The initial state of the reduction is `accumulator` and each successive step of it should be returned by the `callback`. The `callback` is bound to `thisArg` and invoked with `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*. @@ -1871,7 +1871,7 @@ var sum = _.reduce([1, 2, 3], function(memo, num) { return memo + num; }); ### `_.reduceRight(collection, callback [, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1013 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1006 "View in source") [Ⓣ][1] The right-associative version of `_.reduce`. @@ -1899,7 +1899,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#L1068 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1061 "View in source") [Ⓣ][1] The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for. @@ -1925,7 +1925,7 @@ var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); ### `_.rest(array [, n, guard])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1649 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1642 "View in source") [Ⓣ][1] The opposite of `_.initial`, this method gets all but the first value of `array`. Pass `n` to exclude the first `n` values from the result. @@ -1951,7 +1951,7 @@ _.rest([3, 2, 1]); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3243 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3236 "View in source") [Ⓣ][1] Resolves the value of `property` on `object`. If `property` is a function it will be invoked and its result returned, else the property value is returned. If `object` is falsey, then `null` is returned. @@ -1986,7 +1986,7 @@ _.result(object, 'stuff'); ### `_.shuffle(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1670 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1663 "View in source") [Ⓣ][1] Produces a new array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. @@ -2010,7 +2010,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3092 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3085 "View in source") [Ⓣ][1] Gets the size of `value` by returning `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object. @@ -2040,7 +2040,7 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1092 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1085 "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 `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. @@ -2066,7 +2066,7 @@ _.some([null, 0, 'yes', false]); ### `_.sortBy(collection, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1125 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1118 "View in source") [Ⓣ][1] Produces a new sorted array, sorted in ascending order by the results of running each element of `collection` through a transformation `callback`. The `callback` is bound to `thisArg` and invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*. The `callback` argument may also be the name of a property to sort by *(e.g. 'length')*. @@ -2098,7 +2098,7 @@ _.sortBy(['larry', 'brendan', 'moe'], 'length'); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1722 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1715 "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 `1` argument; *(value)*. @@ -2139,7 +2139,7 @@ _.sortedIndex(['twenty', 'thirty', 'fourty'], 'thirty-five', function(word) { ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3545 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3515 "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. @@ -2169,7 +2169,7 @@ _.chain([1,2,3,200]) ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3303 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3296 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -2228,7 +2228,7 @@ _.template('<%= data.hasWith %>', { 'hasWith': 'no' }, { 'variable': 'data' }); ### `_.throttle(func, wait)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2325 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2318 "View in source") [Ⓣ][1] Creates a new function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. If the throttled function is invoked more than once during the `wait` timeout, `func` will also be called on the trailing edge of the timeout. Subsequent calls to the throttled function will return the result of the last `func` call. @@ -2253,7 +2253,7 @@ jQuery(window).on('scroll', throttled); ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3461 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3431 "View in source") [Ⓣ][1] Executes the `callback` function `n` times. The `callback` is bound to `thisArg` and invoked with `1` argument; *(index)*. @@ -2279,7 +2279,7 @@ _.times(3, function() { this.grantWish(); }, genie); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1168 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1161 "View in source") [Ⓣ][1] Converts the `collection`, into an array. Useful for converting the `arguments` object. @@ -2303,7 +2303,7 @@ Converts the `collection`, into an array. Useful for converting the `arguments` ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1762 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1755 "View in source") [Ⓣ][1] Computes the union of the passed-in arrays. @@ -2327,7 +2327,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#L1807 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1800 "View in source") [Ⓣ][1] Produces 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 value of `array` is passed through a transformation `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with `3` arguments; *(value, index, array)*. @@ -2363,7 +2363,7 @@ _.uniq([1, 2, 1.5, 3, 2.5], function(num) { return this.floor(num); }, Math); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3488 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3458 "View in source") [Ⓣ][1] Generates a unique id. If `prefix` is passed, the id will be appended to it. @@ -2387,7 +2387,7 @@ _.uniqueId('contact_'); ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3113 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3106 "View in source") [Ⓣ][1] Produces an array of `object`'s own enumerable property values. @@ -2411,7 +2411,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1856 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1849 "View in source") [Ⓣ][1] Produces a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`. @@ -2436,7 +2436,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.wrap(func, wrapper [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2377 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2370 "View in source") [Ⓣ][1] Create a new function that passes the `func` function to the `wrapper` function as its first argument. Additional arguments are appended to those passed to the `wrapper` function. @@ -2466,7 +2466,7 @@ hello(); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1888 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1881 "View in source") [Ⓣ][1] Merges 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. @@ -2490,7 +2490,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]); ### `_.zipObject(keys)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1917 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1910 "View in source") [Ⓣ][1] Merges an array of `keys` and an array of `values` into a single object. @@ -2521,7 +2521,7 @@ _.zipObject(['moe', 'larry', 'curly'], [30, 40, 50]); ### `_.prototype.chain()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3563 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3533 "View in source") [Ⓣ][1] Enables method chaining on the wrapper object. @@ -2542,7 +2542,7 @@ _([1, 2, 3]).value(); ### `_.prototype.value()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3580 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3550 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -2570,7 +2570,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L225 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L220 "View in source") [Ⓣ][1] *(Object)*: By default, Lo-Dash uses embedded Ruby *(ERB)* style template delimiters, change the following template settings to use alternative delimiters. @@ -2582,7 +2582,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.escape` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L234 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L229 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to be HTML-escaped. @@ -2594,7 +2594,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.evaluate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L243 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L238 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect code to be evaluated. @@ -2606,7 +2606,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.interpolate` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L252 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L247 "View in source") [Ⓣ][1] *(RegExp)*: Used to detect `data` property values to inject. @@ -2618,7 +2618,7 @@ _([1, 2, 3]).value(); ### `_.templateSettings.variable` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L261 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L256 "View in source") [Ⓣ][1] *(String)*: Used to reference the data object in the template text. diff --git a/doc/parse.php b/doc/parse.php index ef05835cc1..7ac59c84ad 100644 --- a/doc/parse.php +++ b/doc/parse.php @@ -21,7 +21,7 @@ // generate Markdown $markdown = docdown(array( 'path' => '../' . $file, - 'title' => 'Lo-Dash v0.4.0', + 'title' => 'Lo-Dash v0.4.1', 'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js' )); diff --git a/lodash.js b/lodash.js index 17094979dc..432956722a 100644 --- a/lodash.js +++ b/lodash.js @@ -1,5 +1,5 @@ /*! - * Lo-Dash v0.4.0 + * Lo-Dash v0.4.1 * Copyright 2012 John-David Dalton * Based on Underscore.js 1.3.3, copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. * @@ -3560,7 +3560,7 @@ * @memberOf _ * @type String */ - lodash.VERSION = '0.4.0'; + lodash.VERSION = '0.4.1'; // assign static methods lodash.after = after; diff --git a/lodash.min.js b/lodash.min.js index 44ca84a2b5..32316688f6 100644 --- a/lodash.min.js +++ b/lodash.min.js @@ -1,35 +1,35 @@ /*! - Lo-Dash 0.4.0 lodash.com/license + Lo-Dash 0.4.1 lodash.com/license Underscore.js 1.3.3 github.com/documentcloud/underscore/blob/master/LICENSE */ -;(function(e,t){"use strict";function s(e){return new o(e)}function o(e){if(e&&e._wrapped)return e;this._wrapped=e}function u(){for(var e,t,n,s=-1,o=arguments.length,u={e:"",f:"",j:"",q:"",c:{d:""},n:{d:""}};++sn;n++)t+="l='"+u.p[n]+"';if(","constructor"==u.p[n]&&(t+="!(h&&h.prototype===n)&&"),t+="j.call(n,l)){"+u.n.i+"}"}u.c&&(t+="}")}return t+=u.e+";return A",Function("c,g,i,j,k,o,u,r,z,C,F,I",'"use strict";return function('+e+"){"+t+"}")(ft,a,ht,et,k,h,Tt,at,nt,rt,vt,it)}function a(e,n){return e=e.a,n=n.a,e===t?1:n===t?-1:en?1:0}function f(e,t){return Y[t]}function l(e){return"\\"+Nt[e]}function c -(e){return xt[e]}function h(e,t){return function(n,r,i){return e.call(t,n,r,i)}}function p(){}function d(e,t){if(F.test(t))return"";var n=Y.length;return Y[n]="'+__e("+t+")+'",G+n}function v(e,t,n,r){return e=Y.length,t?Y[e]="';"+t+";__p+='":n?Y[e]="'+__we("+n+")+'":r&&(Y[e]="'+((__wt=("+r+"))==null?'':__wt)+'"),G+e}function m(e,t){if(F.test(t))return"";var n=Y.length;return Y[n]="'+((__t=("+t+"))==null?'':__t)+'",G+n}function g(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments -.length;r&&(t=h(t,r));if(i===i>>>0){var o=wt&&it.call(e)==vt?e.split(""):e;for(i&&s&&(n=o[--i]);i--;)n=t(n,o[i],i,e);return n}o=en(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function y(e,t,n){if(e)return t==r||n?e[0]:rt.call(e,0,t)}function b(e,t){var n=[];if(!e)return n;for(var r,i=-1,s=e.length;++in?Math.max(0,i+n):n)-1}for(;++ri&&(i=e[s]);return i}for(n&&(t=h(t,n));++sr&&(r=n,i=e[s]);return i}function S(e,t,n){return e?rt.call(e,t==r||n?1:t):[]}function x(e,t,n,r){if(!e)return 0;var i=0,s=e.length;if(n){r&&(n=N(n,r));for(t=n(t);i>>1,n(e[r])>>1,e[r]w(a,r))a.push(r),s.push(e[o]);return s}function N(e,t){function n(){var o=arguments,u=t;return i||(e=t[r]),s.length&&(o=o.length?Z.apply(s,o):s),this instanceof n?(p.prototype=e.prototype,u=new p,(o=e.apply(u,o))&&Tt[typeof o]?o:u):e.apply(u,o)}var r,i=it.call(e)==ht;if(i){if(Et||st&&2++u&&(l=Q[u],!et.call(e,l)||!!(a=et.call -(t,l)&&C(e[l],t[l],s))););}return s.pop(),a}function k(e){return e}function L(e){Ft(Gt(e),function(t){var r=s[t]=e[t];o.prototype[t]=function(){var e=[this._wrapped];return arguments.length&&tt.apply(e,arguments),e=r.apply(s,e),this._chain&&(e=new o(e),e._chain=n),e}})}var n=!0,r=null,i=!1,A,O,M,_,D="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),P=Array.prototype,H=Object.prototype,B=0,j=e._,F=/[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/ -,I=/^';/,q=/^'\+/,R=/(?:__p\+='|\+')$/,U=/\b__p\+='';/g,z=/\b(__p\+?=)''\+/g,W=/(__w?e\(.*?\)|\b__w?t\))\+'';/g,X=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,V=RegExp("^"+(H.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),$=/__token__(\d+)/g,J=/[&<"']/g,K=/['\n\r\t\u2028\u2029\\]/g,Q="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),G="__token__",Y=[],Z=P.concat,et=H.hasOwnProperty,tt=P.push,nt=H -.propertyIsEnumerable,rt=P.slice,it=H.toString,st=V.test(st=rt.bind)&&st,ot=V.test(ot=Array.isArray)&&ot,ut=e.isFinite,at=V.test(at=Object.keys)&&at,ft="[object Array]",lt="[object Boolean]",ct="[object Date]",ht="[object Function]",pt="[object Number]",dt="[object RegExp]",vt="[object String]",mt=e.clearTimeout,gt=e.setTimeout,yt=!nt.call({valueOf:0},"valueOf"),bt="x"!=rt.call("x")[0],wt="xx"!="x"[0]+Object("x")[0],Et=st&&/\n|Opera/.test(st+it.call(e.opera)),St=at&&/^.+$|true/.test(at+!!e.attachEvent -),xt={"&":"&","<":"<",'"':""","'":"'"},Tt={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},Nt={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var Ct={a:"f,d,H",j:"f",q:"if(!d){d=k}else if(H)d=o(d,H)",i:"d(n[l],l,f)"},kt={j:"true",i:"if(!d(n[l],l,f))return!A"},Lt={a:"t",j:"t",q:"for(var D,E=1,p=arguments.length;E-1"},i:"if(n[l]===G)return true"}),Ht=u(Ct,kt),Bt=u(Ct,At),jt=u(Ct,Ot -,{j:"",i:"if(d(n[l],l,f))return n[l]"}),Ft=u(Ct,Ot),It=u(Ct,{j:"{}",q:"var v,m=typeof d=='function';if(m&&H)d=o(d,H)",i:"v=m?d(n[l],l,f):n[l][d];(j.call(A,v)?A[v]:A[v]=[]).push(n[l])"}),qt=u(_t,{a:"f,q",q:"var b=C.call(arguments,2),m=typeof q=='function'",i:{b:"A[l]=(m?q:n[l][q]).apply(n[l],b)",m:"A"+(St?"[w]=":".push")+"((m?q:n[l][q]).apply(n[l],b))"}}),Rt=u(Ct,_t),Ut=u(_t,{a:"f,y",i:{b:"A[l]=n[l][y]",m:"A"+(St?"[w]=":".push")+"(n[l][y])"}}),zt=u({a:"f,d,a,H",j:"a",q:"var s=arguments.length<3;if(H)d=o(d,H)" -,d:{b:"if(s)A=f[++l]"},i:{b:"A=d(A,n[l],l,f)",m:"A=s?(s=false,n[l]):d(A,n[l],l,f)"}}),Wt=u(Ct,At,{i:"!"+At.i}),Xt=u(Ct,kt,{j:"false",i:kt.i.replace("!","")}),Vt=u(Ct,_t,{q:"if(typeof d=='string'){var v=d;d=function(f){return f[v]}}else if(H)d=o(d,H)",i:{b:"A[l]={a:d(n[l],l,f),b:n[l]}",m:"A"+(St?"[w]=":".push")+"({a:d(n[l],l,f),b:n[l]})"},e:"A.sort(g);p=A.length;while(p--){A[p]=A[p].b}"}),$t=u(Lt,{i:"if(A[l]==null)"+Lt.i}),Jt=u(Lt),Kt=u(Ct,Ot,Mt,{r:i}),Qt=u(Ct,Ot,Mt),Gt=u({a:"t",j:"[]",r:i,i:"if(I.call(n[l])==i)A.push(l)" -,e:"A.sort()"});Ft({Arguments:"[object Arguments]",Date:ct,Function:ht,Number:pt,RegExp:dt,String:vt},function(e,t){s["is"+t]=function(t){return it.call(t)==e}}),s.isArguments(arguments)||(s.isArguments=function(e){return!!e&&!!et.call(e,"callee")});var Yt=ot||function(e){return it.call(e)==ft},Zt=u({a:"J",j:"true",q:"var e=I.call(J);if(e==c||e==F)return!J.length",i:{m:"return false"}}),en=at?function(e){return"function"==typeof e&&nt.call(e,"prototype")?Dt(e):at(e)}:Dt,tn=u({a:"t",j:"[]",i:"A.push(n[l])" -});s.VERSION="0.4.0",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=N,s.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Gt(e));for(var r=t.length;nw(i,e[n],r)&&t.push(e[n]);return t},s.escape=function(e){return e==r?"":(e+"").replace(J,c)},s.every=Ht,s.extend=Jt,s.filter=Bt,s.find=jt,s.first=y,s.flatten=b,s.forEach=Ft,s.forIn=Kt,s.forOwn=Qt,s.functions=Gt,s.groupBy=It,s.has=function(e,t){return et.call(e,t)},s.identity=k,s.indexOf=w,s.initial=function(e,t,n){return e?rt.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=[];if(!e)return t;for(var n, -r=-1,i=e.length,s=rt.call(arguments,1);++rw(t,n)&&Ht(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=Rt,s.max=E,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return et.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o= -e.length;if(!t){for(;++s>>0?e.length:en(e).length},s.some=Xt,s.sortBy=Vt,s.sortedIndex=x,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var i,o,u,a,c;i=n.escape,o=n.evaluate,u=n.interpolate;var h=s.templateSettings,n=n.variable;i==r&&(i=h.escape),o==r&&(o=h.evaluate),u==r&&(u=h.interpolate),i&&(e=e.replace(i,d)),u&&(e=e.replace(u,m)),o!=A&&(A=o,_=RegExp((o?o.source:"($^)")+"||","g")),u=Y.length,e= -e.replace(_,v),i=Y.length-1,o=u<=i,!n&&(n=h.variable||O||"obj",c=o)&&(Y[u]="';__with("+n+"){"+Y[u].replace(I,"").replace(q,"__p+="),Y[i]=Y[i].replace(R,"")+"}____p+='"),h="$&"+n+".",e="__p='"+e.replace(K,l).replace($,f)+"';",Y.length=0,c&&(u=e.indexOf("__with"),i=e.indexOf("}__",u+10)),n!=O&&(O=n,M=RegExp("([(\\s])"+n+"\\."+n+"\\b","g")),e=(c?e.slice(0,u):e).replace(X,h).replace(M,"$1__d")+(c?e.slice(u+2,i+1)+e.slice(i+3).replace(X,h).replace(M,"$1__d"):""),e=(o?e.replace(U,""):e).replace(z,"$1") -.replace(W,"$1;"),e="function("+n+"){"+n+"||("+n+"={});var __p,__t,__wt,__d="+n+"."+n+"||"+n+",__e=_.escape,__we=__e"+(o?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+e+"return __p}";try{a=Function("_","return "+e)(s)}catch(p){a=function(){throw p}}return t?a(t):(a.source=e,a)},s.throttle=function(e,t){function n(){a=new Date,u=r,e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(a=r,s=e.apply(o,i)):u||(u=gt(n,f -)),s}},s.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?(bt?it.call(e)==vt:"string"==typeof e)?e.split(""):rt.call(e):tn(e)},s.union=function(){for(var e=-1,t=[],n=Z.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},s.uniq=T,s.uniqueId=function(e){var t=B++;return e?e+t:t},s.values=tn,s.without=function(e){var t=[]; -if(!e)return t;for(var n=-1,r=e.length;++nw(arguments,e[n],1)&&t.push(e[n]);return t},s.wrap=function(e,t){return function(){var n=[e];return arguments.length&&tt.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){if(!e)return[];for(var t=-1,n=E(Ut(arguments,"length")),r=Array(n);++tn;n++)t+="l='"+u.p[n]+"';if(","constructor"==u.p[n]&&(t+="!(h&&h.prototype===n)&&"),t+="j.call(n,l)){"+u.n.i+"}"}u.c&&(t+="}")}return t+=u.e+";return A",Function("c,g,i,j,k,o,u,r,z,C,F,I",'"use strict";return function('+e+"){"+t+"}")(ot,a,ft,G,k,h,Et,st,Z,et,ht,tt)}function a(e,n){return e=e.a,n=n.a,e===t?1:n===t?-1:en?1:0}function f(e,t){return K[t]}function l(e){return"\\"+St[e]}function c( +e){return wt[e]}function h(e,t){return function(n,r,i){return e.call(t,n,r,i)}}function p(){}function d(e,t){if(F.test(t))return"";var n=K.length;return K[n]="'+__e("+t+")+'",J+n}function v(e,t,n,r){return e=K.length,t?K[e]="';"+t+";__p+='":n?K[e]="'+__e("+n+")+'":r&&(K[e]="'+((__t=("+r+"))==null?'':__t)+'"),J+e}function m(e,t){if(F.test(t))return"";var n=K.length;return K[n]="'+((__t=("+t+"))==null?'':__t)+'",J+n}function g(e,t,n,r){if(!e)return n;var i=e.length,s=3>arguments +.length;r&&(t=h(t,r));if(i===i>>>0){var o=gt&&tt.call(e)==ht?e.split(""):e;for(i&&s&&(n=o[--i]);i--;)n=t(n,o[i],i,e);return n}o=Gt(e);for((i=o.length)&&s&&(n=e[o[--i]]);i--;)s=o[i],n=t(n,e[s],s,e);return n}function y(e,t,n){if(e)return t==r||n?e[0]:et.call(e,0,t)}function b(e,t){var n=[];if(!e)return n;for(var r,i=-1,s=e.length;++in?Math.max(0,i+n):n)-1}for(;++ri&&(i=e[s]);return i}for(n&&(t=h(t,n));++sr&&(r=n,i=e[s]);return i}function S(e,t,n){return e?et.call(e,t==r||n?1:t):[]}function x(e,t,n,r){if(!e)return 0;var i=0,s=e.length;if(n){r&&(n=N(n,r));for(t=n(t);i>>1,n(e[r])>>1,e[r]w(a,r))a.push(r),s.push(e[o]);return s}function N(e,t){function n(){var o=arguments,u=t;return i||(e=t[r]),s.length&&(o=o.length?Q.apply(s,o):s),this instanceof n?(p.prototype=e.prototype,u=new p,(o=e.apply(u,o))&&Et[typeof o]?o:u):e.apply(u,o)}var r,i=tt.call(e)==ft;if(i){if(yt||nt&&2++u&&(l=$[u],!G.call(e,l)||!!(a=G.call(t,l +)&&C(e[l],t[l],s))););}return s.pop(),a}function k(e){return e}function L(e){Ht(Jt(e),function(t){var r=s[t]=e[t];o.prototype[t]=function(){var e=[this._wrapped];return arguments.length&&Y.apply(e,arguments),e=r.apply(s,e),this._chain&&(e=new o(e),e._chain=n),e}})}var n=!0,r=null,i=!1,A,O,M,_,D="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(e=global),exports),P=Array.prototype,H=Object.prototype,B=0,j=e._,F=/[-+=!~*%&^<>|{(\/]|\[\D|\b(?:delete|in|instanceof|new|typeof|void)\b/ +,I=/\b__p\+='';/g,q=/\b(__p\+=)''\+/g,R=/(__e\(.*?\)|\b__t\))\+'';/g,U=/(?:__e|__t=)\(\s*(?![\d\s"']|this\.)/g,z=RegExp("^"+(H.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g,".+?")+"$"),W=/__token__(\d+)/g,X=/[&<"']/g,V=/['\n\r\t\u2028\u2029\\]/g,$="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),J="__token__",K=[],Q=P.concat,G=H.hasOwnProperty,Y=P.push,Z=H.propertyIsEnumerable,et=P.slice,tt=H.toString +,nt=z.test(nt=et.bind)&&nt,rt=z.test(rt=Array.isArray)&&rt,it=e.isFinite,st=z.test(st=Object.keys)&&st,ot="[object Array]",ut="[object Boolean]",at="[object Date]",ft="[object Function]",lt="[object Number]",ct="[object RegExp]",ht="[object String]",pt=e.clearTimeout,dt=e.setTimeout,vt=!Z.call({valueOf:0},"valueOf"),mt="x"!=et.call("x")[0],gt="xx"!="x"[0]+Object("x")[0],yt=nt&&/\n|Opera/.test(nt+tt.call(e.opera)),bt=st&&/^.+$|true/.test(st+!!e.attachEvent),wt={"&":"&","<":"<",'"':""","'" +:"'"},Et={"boolean":i,"function":n,object:n,number:i,string:i,"undefined":i},St={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"};s.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var xt={a:"f,d,H",j:"f",q:"if(!d){d=k}else if(H)d=o(d,H)",i:"d(n[l],l,f)"},Tt={j:"true",i:"if(!d(n[l],l,f))return!A"},Nt={a:"t",j:"t",q:"for(var D,E=1,p=arguments.length;E-1"},i:"if(n[l]===G)return true"}),_t=u(xt,Tt),Dt=u(xt,Ct),Pt=u(xt,kt,{j:"",i:"if(d(n[l],l,f))return n[l]" +}),Ht=u(xt,kt),Bt=u(xt,{j:"{}",q:"var v,m=typeof d=='function';if(m&&H)d=o(d,H)",i:"v=m?d(n[l],l,f):n[l][d];(j.call(A,v)?A[v]:A[v]=[]).push(n[l])"}),jt=u(At,{a:"f,q",q:"var b=C.call(arguments,2),m=typeof q=='function'",i:{b:"A[l]=(m?q:n[l][q]).apply(n[l],b)",m:"A"+(bt?"[w]=":".push")+"((m?q:n[l][q]).apply(n[l],b))"}}),Ft=u(xt,At),It=u(At,{a:"f,y",i:{b:"A[l]=n[l][y]",m:"A"+(bt?"[w]=":".push")+"(n[l][y])"}}),qt=u({a:"f,d,a,H",j:"a",q:"var s=arguments.length<3;if(H)d=o(d,H)",d:{b:"if(s)A=f[++l]"},i: +{b:"A=d(A,n[l],l,f)",m:"A=s?(s=false,n[l]):d(A,n[l],l,f)"}}),Rt=u(xt,Ct,{i:"!"+Ct.i}),Ut=u(xt,Tt,{j:"false",i:Tt.i.replace("!","")}),zt=u(xt,At,{q:"if(typeof d=='string'){var v=d;d=function(f){return f[v]}}else if(H)d=o(d,H)",i:{b:"A[l]={a:d(n[l],l,f),b:n[l]}",m:"A"+(bt?"[w]=":".push")+"({a:d(n[l],l,f),b:n[l]})"},e:"A.sort(g);p=A.length;while(p--){A[p]=A[p].b}"}),Wt=u(Nt,{i:"if(A[l]==null)"+Nt.i}),Xt=u(Nt),Vt=u(xt,kt,Lt,{r:i}),$t=u(xt,kt,Lt),Jt=u({a:"t",j:"[]",r:i,i:"if(I.call(n[l])==i)A.push(l)" +,e:"A.sort()"});Ht({Arguments:"[object Arguments]",Date:at,Function:ft,Number:lt,RegExp:ct,String:ht},function(e,t){s["is"+t]=function(t){return tt.call(t)==e}}),s.isArguments(arguments)||(s.isArguments=function(e){return!!e&&!!G.call(e,"callee")});var Kt=rt||function(e){return tt.call(e)==ot},Qt=u({a:"J",j:"true",q:"var e=I.call(J);if(e==c||e==F)return!J.length",i:{m:"return false"}}),Gt=st?function(e){return"function"==typeof e&&Z.call(e,"prototype")?Ot(e):st(e)}:Ot,Yt=u({a:"t",j:"[]",i:"A.push(n[l])" +});s.VERSION="0.4.1",s.after=function(e,t){return 1>e?t():function(){if(1>--e)return t.apply(this,arguments)}},s.bind=N,s.bindAll=function(e){var t=arguments,n=1;1==t.length&&(n=0,t=Jt(e));for(var r=t.length;nw(i,e[n],r)&&t.push(e[n]);return t},s.escape=function(e){return e==r?"":(e+"").replace(X,c)},s.every=_t,s.extend=Xt,s.filter=Dt,s.find=Pt,s.first=y,s.flatten=b,s.forEach=Ht,s.forIn=Vt,s.forOwn=$t,s.functions=Jt,s.groupBy=Bt,s.has=function(e,t){return G.call(e,t)},s.identity=k,s.indexOf=w,s.initial=function(e,t,n){return e?et.call(e,0,-(t==r||n?1:t)):[]},s.intersection=function(e){var t=[];if(!e)return t;for(var n,r=-1 +,i=e.length,s=et.call(arguments,1);++rw(t,n)&&_t(s,function(e){return-1n?Math.max(0,r+n):Math.min(n,r-1))+1);r--;)if(e[r]===t)return r;return-1},s.map=Ft,s.max=E,s.memoize=function(e,t){var n={};return function(){var r=t?t.apply(this,arguments):arguments[0];return G.call(n,r)?n[r]:n[r]=e.apply(this,arguments)}},s.min=function(e,t,n){var r=Infinity,i=r;if(!e)return i;var s=-1,o=e.length +;if(!t){for(;++s>>0?e.length:Gt(e).length},s.some=Ut,s.sortBy=zt,s.sortedIndex=x,s.tap=function(e,t){return t(e),e},s.template=function(e,t,n){n||(n={});var i,o;i=n.escape;var u=n.evaluate,a=n.interpolate,c=s.templateSettings,n=n.variable;i==r&&(i=c.escape),u==r&&(u=c.evaluate),a==r&&(a=c.interpolate),i&&(e=e.replace(i,d)),a&&(e=e.replace(a,m)),u!=A&&(A=u,_=RegExp((u?u.source:"($^)")+"||","g")),i=K.length,e=e.replace(_,v), +i=i!=K.length,e="__p += '"+e.replace(V,l).replace(W,f)+"';",K.length=0,n||(n=c.variable||O||"obj",i?e="with("+n+"){"+e+"}":(n!=O&&(O=n,M=RegExp("(\\(\\s*)"+n+"\\."+n+"\\b","g")),e=e.replace(U,"$&"+n+".").replace(M,"$1__d"))),e=(i?e.replace(I,""):e).replace(q,"$1").replace(R,"$1;"),e="function("+n+"){"+n+"||("+n+"={});var __t,__p='',__e=_.escape"+(i?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":",__d="+n+"."+n+"||"+n+";")+e+"return __p}";try{o=Function("_","return "+e)( +s)}catch(h){o=function(){throw h}}return t?o(t):(o.source=e,o)},s.throttle=function(e,t){function n(){a=new Date,u=r,e.apply(o,i)}var i,s,o,u,a=0;return function(){var r=new Date,f=t-(r-a);return i=arguments,o=this,0>=f?(a=r,s=e.apply(o,i)):u||(u=dt(n,f)),s}},s.times=function(e,t,n){var r=-1;if(n)for(;++r>>0?(mt?tt.call(e)==ht:"string"==typeof +e)?e.split(""):et.call(e):Yt(e)},s.union=function(){for(var e=-1,t=[],n=Q.apply(t,arguments),r=n.length;++ew(t,n[e])&&t.push(n[e]);return t},s.uniq=T,s.uniqueId=function(e){var t=B++;return e?e+t:t},s.values=Yt,s.without=function(e){var t=[];if(!e)return t;for(var n=-1,r=e.length;++nw(arguments,e[n],1)&&t.push(e[n]);return t},s.wrap=function(e,t){return function(){var n=[e];return arguments.length&&Y.apply(n,arguments),t.apply(this,n)}},s.zip=function(e){if(!e)return[];for(var t=-1,n= +E(It(arguments,"length")),r=Array(n);++t