diff --git a/README.md b/README.md
index 9ceba6f9e9..8fd02e0d57 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Lo-Dash v0.2.1
+# Lo-Dash v0.2.2
A drop-in replacement for Underscore.js, from the devs behind [jsPerf.com](http://jsperf.com), that delivers [performance improvements](http://jsperf.com/lodash-underscore#filterby=family), [bug fixes](https://github.com/bestiejs/lodash#closed-underscorejs-issues), and [additional features](https://github.com/bestiejs/lodash#features).
@@ -6,7 +6,7 @@ Lo-Dash’s performance is gained by avoiding slower native methods, instead opt
## Dive in
-We’ve got [API docs](http://lodash.com/docs) and [unit tests](http://lodash.com/tests).
+We’ve got [API docs](http://lodash.com/docs), [benchmarks](http://lodash.com/benchmarks), and [unit tests](http://lodash.com/tests).
For a list of upcoming features, check out our [roadmap](https://github.com/bestiejs/lodash/wiki/Roadmap).
@@ -20,12 +20,12 @@ For more information check out these screencasts over Lo-Dash:
## Features
* AMD loader support
- * [_.bind](http://lodash.com/docs#_bindfunc--arg1-arg2-) supports *"lazy"* binding
- * [_.debounce](http://lodash.com/docs#_debouncefunc-wait-immediate)’ed functions match [_.throttle](http://lodash.com/docs#_throttlefunc-wait)’ed functions’ return value behavior
- * [_.forEach](http://lodash.com/docs#_foreachcollection-callback--thisarg) is chainable
- * [_.groupBy](http://lodash.com/docs#_groupbycollection-callback--thisarg) accepts a third, `thisArg`, argument
- * [_.partial](http://lodash.com/docs#_partialfunc--arg1-arg2-) for more functional fun
- * [_.size](http://lodash.com/docs#_sizecollection) supports returning the `length` of string values
+ * [_.bind](http://lodash.com/docs#bind) supports *"lazy"* binding
+ * [_.debounce](http://lodash.com/docs#debounce)’ed functions match [_.throttle](http://lodash.com/docs#throttle)’ed functions’ return value behavior
+ * [_.forEach](http://lodash.com/docs#forEach) is chainable
+ * [_.groupBy](http://lodash.com/docs#groupBy) accepts a third, `thisArg`, argument
+ * [_.partial](http://lodash.com/docs#partial) for more functional fun
+ * [_.size](http://lodash.com/docs#size) supports returning the `length` of string values
## Support
@@ -36,18 +36,26 @@ Lo-Dash has been tested in at least Chrome 5-19, Firefox 1.5-12, IE 6-9, Opera 9
Custom builds make it easy to create lightweight versions of Lo-Dash containing only the methods you need.
We handle all the method dependency and alias mapping for you.
+Mobile builds, with IE bug fixes and method compilation removed, may be created by using the `mobile` argument.
+
+~~~ bash
+node build mobile
+~~~
+
Custom builds may be created in two ways:
1. Use the`include` argument to pass the names of the methods to include in the build.
~~~ bash
node build include=each,filter,map,noConflict
node build include="each, filter, map, noConflict"
+node build mobile include=each,filter,map,noConflict
~~~
2. Use the `exclude` argument to pass the names of the methods to exclude from the build.
~~~ bash
node build exclude=isNaN,isUndefined,union,zip
node build exclude="isNaN, isUndefined, union, zip"
+node build mobile exclude=isNaN,isUndefined,union,zip
~~~
Custom builds are saved to `lodash.custom.js` and `lodash.custom.min.js`.
@@ -116,6 +124,7 @@ git submodule update --init
## Closed Underscore.js issues
+ * Ensure `_(...)` returns passed wrapper instances [[test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L95-98)]
* Ensure `_.groupBy` adds values to own, not inherited, properties [[test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L229-236)]
* Ensure `_.throttle` works when called in tight loops [[#502](https://github.com/documentcloud/underscore/issues/502), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L436-446)]
* Fix Firefox, IE, Opera, and Safari object iteration bugs [[#376](https://github.com/documentcloud/underscore/issues/376), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L152-172), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L206-213), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L255-257), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L265-267), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L285-292), [test](https://github.com/bestiejs/lodash/blob/32627f45072952df18a64cf5e9f2433d2d32730f/test/test.js#L386-388)]
@@ -184,13 +193,21 @@ git submodule update --init
## Changelog
+### v0.2.2
+
+ * Added mobile build option
+ * Ensured `_.find` returns `undefined` for unmatched values
+ * Ensured `_.templateSettings.variable` is compatible with Underscore.js
+ * Optimized `_.escape`
+ * Reduced dependencies in `_.find`
+
### v0.2.1
-* Adjusted the Lo-Dash export order for r.js
-* Ensured `_.groupBy` values are added to own, not inherited, properties
-* Made `_.bind` follow ES5 spec to support a popular Backbone.js pattern
-* Removed the alias `intersect`
-* Simplified `_.bind`, `_.flatten`, `_.groupBy`, `_.max`, and `_.min`
+ * Adjusted the Lo-Dash export order for r.js
+ * Ensured `_.groupBy` values are added to own, not inherited, properties
+ * Made `_.bind` follow ES5 spec to support a popular Backbone.js pattern
+ * Removed the alias `intersect`
+ * Simplified `_.bind`, `_.flatten`, `_.groupBy`, `_.max`, and `_.min`
### v0.2.0
@@ -203,6 +220,7 @@ git submodule update --init
* Added whitespace to compiled strings
* Added `_.partial` method
* Commented the `iterationFactory` options object
+ * Ensured `_(...)` returns passed wrapper instances
* Ensured `_.max` and `_.min` support extremely large arrays
* Ensured `_.throttle` works in tight loops
* Fixed IE < 9 `[DontEnum]` bug and Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1’s prototype property iteration bug
diff --git a/build.js b/build.js
index a2f37d863d..f570f7bdd9 100755
--- a/build.js
+++ b/build.js
@@ -10,8 +10,8 @@
var lodash = require(path.join(__dirname, 'lodash')),
minify = require(path.join(__dirname, 'build', 'minify'));
- /** Flag used to specify a custom build */
- var isCustom = false;
+ /** Flag used to specify a mobile build */
+ var isMobile = process.argv.indexOf('mobile') > -1;
/** Shortcut used to convert array-like objects to arrays */
var slice = [].slice;
@@ -75,7 +75,7 @@
'every': ['bind', 'createIterator', 'identity'],
'extend': ['createIterator'],
'filter': ['bind', 'createIterator', 'identity'],
- 'find': ['createIterator'],
+ 'find': ['bind', 'createIterator'],
'first': [],
'flatten': ['isArray'],
'forEach': ['bind', 'createIterator'],
@@ -141,6 +141,20 @@
'zip': ['max', 'pluck']
};
+ /** Names of methods to filter for the build */
+ var filterMethods = Object.keys(dependencyMap);
+
+ /** Used to specify if `filterMethods` should be used for exclusion or inclusion */
+ var filterType = process.argv.reduce(function(result, value) {
+ if (!result) {
+ var pair = value.match(/^(exclude|include)=(.*)$/);
+ if (pair) {
+ filterMethods = lodash.intersection(filterMethods, pair[2].split(/, */).map(getRealName));
+ return pair[1];
+ }
+ }
+ }, '');
+
/*--------------------------------------------------------------------------*/
/**
@@ -328,56 +342,30 @@
return removeFromCreateIterator(source, varName);
}
- /*--------------------------------------------------------------------------*/
-
- // inline `iteratorTemplate`
- (function() {
- var iteratorTemplate = lodash._iteratorTemplate,
- code = /^function[^{]+{([\s\S]+?)}$/.exec(iteratorTemplate)[1];
-
- // remove whitespace from template
- code = code.replace(/\[object |else if|function | in |return\s+[\w']|throw |typeof |var |\\\\n|\\n|\s+/g, function(match) {
+ /**
+ * Removes non-syntax critical whitespace from a string.
+ *
+ * @private
+ * @param {String} source The source to process.
+ * @returns {String} Returns the source with whitespace removed.
+ */
+ function removeWhitespace(source) {
+ return source.replace(/\[object |else if|function | in |return\s+[\w']|throw |typeof |var |\\\\n|\\n|\s+/g, function(match) {
return match == false || match == '\\n' ? '' : match;
});
-
- // remove unnecessary code
- code = code
- .replace(/\|\|\{\}|,__t,__j=Array.prototype.join|function print[^}]+}|\+''/g, '')
- .replace(/(\{);|;(\})/g, '$1$2')
- .replace(/\(\(__t=\(([^)]+)\)\)==null\?'':__t\)/g, '$1');
-
- // ensure escaped characters are interpreted correctly inside the `Function()` string
- code = code.replace(/\\/g, '\\\\');
-
- // add `code` to `Function()`
- code = '$1Function(\'object\',\n$2 "' + code + '"\n$2);\n';
-
- // replace `template()` with `Function()`
- source = source.replace(/(( +)var iteratorTemplate *= *)([\s\S]+?\n\2.+?);\n/, code);
-
- // remove pseudo private property `_iteratorTemplate`
- source = source.replace(/(?:\s*\/\/.*)*\s*lodash\._iteratorTemplate\b.+\n/, '\n');
- }());
+ }
/*--------------------------------------------------------------------------*/
// custom build
- process.argv.some(function(arg) {
- // exit early if not the "exclude" or "include" command option
- var pair = arg.match(/^(exclude|include)=(.*)$/);
- if (!pair) {
- return false;
+ (function() {
+ // exit early if "exclude" or "include" options aren't specified
+ if (!filterType) {
+ return;
}
-
- var filterType = pair[1],
- filterNames = lodash.intersection(Object.keys(dependencyMap), pair[2].split(/, */).map(getRealName));
-
- // set custom build flag
- isCustom = true;
-
// remove the specified functions and their dependants
if (filterType == 'exclude') {
- filterNames.forEach(function(funcName) {
+ filterMethods.forEach(function(funcName) {
getDependants(funcName).concat(funcName).forEach(function(otherName) {
source = removeFunction(source, otherName);
});
@@ -385,13 +373,13 @@
}
// else remove all but the specified functions and their dependencies
else {
- filterNames = lodash.uniq(filterNames.reduce(function(result, funcName) {
+ filterMethods = lodash.uniq(filterMethods.reduce(function(result, funcName) {
result.push.apply(result, getDependencies(funcName).concat(funcName));
return result;
}, []));
lodash.each(dependencyMap, function(dependencies, otherName) {
- if (filterNames.indexOf(otherName) < 0) {
+ if (filterMethods.indexOf(otherName) < 0) {
source = removeFunction(source, otherName);
}
});
@@ -420,10 +408,22 @@
if (isRemoved(source, 'bind', 'functions', 'groupBy', 'invoke', 'isEqual', 'isFunction', 'result', 'sortBy', 'toArray')) {
source = removeVar(source, 'funcClass');
}
+ if (isRemoved(source, 'bind')) {
+ source = removeVar(source, 'nativeBind');
+ }
+ if (isRemoved(source, 'isArray')) {
+ source = removeVar(source, 'nativeIsArray');
+ }
+ if (isRemoved(source, 'keys')) {
+ source = removeVar(source, 'nativeKeys');
+ }
if (isRemoved(source, 'clone', 'isObject', 'keys')) {
source = removeVar(source, 'objectTypes');
source = removeFromCreateIterator(source, 'objectTypes');
}
+ if (isRemoved(source, 'bind', 'isArray', 'keys')) {
+ source = removeVar(source, 'reNative');
+ }
if (isRemoved(source, 'isEmpty', 'isEqual', 'isString', 'size')) {
source = removeVar(source, 'stringClass');
}
@@ -432,12 +432,70 @@
source = source.replace(/(?:\s*\/\*-+\*\/\s*){2,}/g, function(separators) {
return separators.match(/^\s*/)[0] + separators.slice(separators.lastIndexOf('/*'));
});
+ }());
+
+ /*--------------------------------------------------------------------------*/
- return true;
- });
+ if (isMobile) {
+ // inline functions defined with `createIterator`
+ lodash.functions(lodash).forEach(function(funcName) {
+ var reFunc = RegExp('( +var ' + funcName + ' *= *)((?:[a-zA-Z]+ *\\|\\| *)?)createIterator\\(((?:{|[a-zA-Z])[\\s\\S]+?)\\);\\n'),
+ parts = source.match(reFunc);
+
+ // skip if not defined with `createIterator`
+ if (!parts) {
+ return;
+ }
+ // extract function's code
+ var code = funcName == 'keys'
+ ? '$1$2' + lodash._createIterator(Function('return ' + parts[3])())
+ : '$1' + lodash[funcName];
+
+ // format code
+ code = code.replace(/\n(?:.*)/g, function(match) {
+ match = match.slice(1);
+ return (match == '}' ? '\n ' : '\n ') + match;
+ }) + ';\n';
+
+ source = source.replace(reFunc, code);
+ });
+
+ // remove `iteratorTemplate`
+ source = removeVar(source, 'iteratorTemplate');
+
+ // remove JScript [[DontEnum]] fix from `isEqual`
+ source = source.replace(/(?:\s*\/\/.*\n)*( +)if *\(result *&& *hasDontEnumBug[\s\S]+?\n\1}\n/, '\n');
+
+ // remove IE `shift` and `splice` fix
+ source = source.replace(/(?:\s*\/\/.*\n)*( +)if *\(value.length *=== *0[\s\S]+?\n\1}\n/, '\n');
+ }
+ else {
+ // inline `iteratorTemplate` template
+ source = source.replace(/(( +)var iteratorTemplate *= *)([\s\S]+?\n\2.+?);\n/, (function() {
+ // extract `iteratorTemplate` code
+ var code = /^function[^{]+{([\s\S]+?)}$/.exec(lodash._iteratorTemplate)[1];
+
+ code = removeWhitespace(code)
+ // remove unnecessary code
+ .replace(/\|\|\{\}|,__t,__j=Array.prototype.join|function print[^}]+}|\+''/g, '')
+ .replace(/(\{);|;(\})/g, '$1$2')
+ .replace(/\(\(__t=\(([^)]+)\)\)==null\?'':__t\)/g, '$1')
+ // ensure escaped characters are interpreted correctly in the string literal
+ .replace(/\\/g, '\\\\');
+
+ // add `code` to `Function()` as a string literal to avoid strict mode
+ // errors caused by the required with-statement
+ return '$1Function(\'obj\',\n$2 "' + code + '"\n$2);\n';
+ }()));
+ }
+
+ // remove pseudo private properties
+ source = source.replace(/(?:\s*\/\/.*)*\s*lodash\._(?:createIterator|iteratorTemplate)\b.+\n/g, '\n');
+
+ /*--------------------------------------------------------------------------*/
// begin the minification process
- if (isCustom) {
+ if (filterType || isMobile) {
fs.writeFileSync(path.join(__dirname, 'lodash.custom.js'), source);
minify(source, 'lodash.custom.min', function(result) {
fs.writeFileSync(path.join(__dirname, 'lodash.custom.min.js'), result);
diff --git a/build/pre-compile.js b/build/pre-compile.js
index 24781f09be..7270bebc06 100644
--- a/build/pre-compile.js
+++ b/build/pre-compile.js
@@ -62,9 +62,10 @@
/** Used to minify variables and string values to a single character */
var minNames = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
- /** Used protect the specified properties from getting minified */
+ /** Used to protect the specified properties from getting minified */
var propWhitelist = [
'_',
+ '_chain',
'_wrapped',
'after',
'all',
diff --git a/doc/README.md b/doc/README.md
index 513b834b59..ad24053066 100644
--- a/doc/README.md
+++ b/doc/README.md
@@ -1,4 +1,4 @@
-# Lo-Dash v0.2.1
+# Lo-Dash v0.2.2
@@ -145,7 +145,7 @@ The `lodash` function.
### `_.VERSION`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3089 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3092 "View in source") [Ⓣ][1]
*(String)*: The semantic version number.
@@ -157,7 +157,7 @@ The `lodash` function.
### `_.after(n, func)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1618 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1622 "View in source") [Ⓣ][1]
Creates a new function that is restricted to executing only after it is called `n` times.
@@ -185,7 +185,7 @@ _.forEach(notes, function(note) {
### `_.bind(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1669 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1673 "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`.
@@ -232,7 +232,7 @@ func();
### `_.bindAll(object [, methodName1, methodName2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1740 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1744 "View in source") [Ⓣ][1]
Binds methods on the `object` to the object, overwriting the non-bound method. If no method names are provided, all the function properties of the `object` will be bound.
@@ -264,7 +264,7 @@ jQuery('#lodash_button').on('click', buttonView.onClick);
### `_.chain(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3041 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3044 "View in source") [Ⓣ][1]
Wraps the value in a `lodash` chainable object.
@@ -298,7 +298,7 @@ var youngest = _.chain(stooges)
### `_.clone(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2066 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2070 "View in source") [Ⓣ][1]
Create a shallow clone of the `value`. Any nested objects or arrays will be assigned by reference and not cloned.
@@ -322,7 +322,7 @@ _.clone({ 'name': 'moe' });
### `_.compact(array)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L879 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L883 "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.
@@ -346,7 +346,7 @@ _.compact([0, 1, false, 2, '', 3]);
### `_.compose([func1, func2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1772 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1776 "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 thefunctions `f()`, `g()`, and `h()` produces `f(g(h()))`.
@@ -373,7 +373,7 @@ welcome('moe');
### `_.contains(collection, target)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L520 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L525 "View in source") [Ⓣ][1]
Checks if a given `target` value is present in a `collection` using strict equality for comparisons, i.e. `===`.
@@ -398,7 +398,7 @@ _.contains([1, 2, 3], 3);
### `_.debounce(func, wait, immediate)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1805 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1809 "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.
@@ -424,7 +424,7 @@ jQuery(window).on('resize', lazyLayout);
### `_.defaults(object [, defaults1, defaults2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2089 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2093 "View in source") [Ⓣ][1]
Assigns missing properties in `object` with default values from the defaults objects. As soon as a property is set, additional defaults of the same property will be ignored.
@@ -450,7 +450,7 @@ _.defaults(iceCream, { 'flavor': 'vanilla', 'sprinkles': 'lots' });
### `_.defer(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1870 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1874 "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.
@@ -475,7 +475,7 @@ _.defer(function() { alert('deferred'); });
### `_.delay(func, wait [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1850 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1854 "View in source") [Ⓣ][1]
Executes the `func` function after `wait` milliseconds. Additional arguments are passed to `func` when it is invoked.
@@ -502,7 +502,7 @@ _.delay(log, 1000, 'logged later');
### `_.difference(array [, array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L908 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L912 "View in source") [Ⓣ][1]
Produces a new array of `array` values not present in the other arrays using strict equality for comparisons, i.e. `===`.
@@ -527,7 +527,7 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
### `_.escape(string)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2737 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2741 "View in source") [Ⓣ][1]
Escapes a string for insertion into HTML, replacing `&`, `<`, `"`, `'`, and `/` characters.
@@ -551,7 +551,7 @@ _.escape('Curly, Larry & Moe');
### `_.every(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L544 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L549 "View in source") [Ⓣ][1]
Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -577,7 +577,7 @@ _.every([true, 1, null, 'yes'], Boolean);
### `_.extend(object [, source1, source2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2108 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2112 "View in source") [Ⓣ][1]
Copies enumerable properties from the source objects to the `destination` object. Subsequent sources will overwrite propery assignments of previous sources.
@@ -602,7 +602,7 @@ _.extend({ 'name': 'moe' }, { 'age': 40 });
### `_.filter(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L565 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L570 "View in source") [Ⓣ][1]
Examines each value in a `collection`, returning an array of all values the `callback` returns truthy for. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -628,7 +628,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#L587 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L592 "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 invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -654,7 +654,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#L941 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L945 "View in source") [Ⓣ][1]
Gets the first value of the `array`. Pass `n` to return the first `n` values of the `array`.
@@ -680,7 +680,7 @@ _.first([5, 4, 3, 2, 1]);
### `_.flatten(array, shallow)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L963 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L967 "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.
@@ -708,7 +708,7 @@ _.flatten([1, [2], [3, [[4]]]], true);
### `_.forEach(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L613 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L619 "View in source") [Ⓣ][1]
Iterates over a `collection`, executing the `callback` for each value in the `collection`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -737,7 +737,7 @@ _([1, 2, 3]).forEach(function(num) { alert(num); }).join(',');
### `_.functions(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2125 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2129 "View in source") [Ⓣ][1]
Produces a sorted array of the properties, own and inherited, of `object` that have function values.
@@ -761,7 +761,7 @@ _.functions(_);
### `_.groupBy(array, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1005 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1009 "View in source") [Ⓣ][1]
Splits a `collection` into sets, grouped by the result of running each value through `callback`. The `callback` is invoked with `3` arguments; *(value, index, array)*. The `callback` argument may also be the name of a property to group by.
@@ -793,7 +793,7 @@ _.groupBy(['one', 'two', 'three'], 'length');
### `_.has(object, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2148 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2152 "View in source") [Ⓣ][1]
Checks if the specified object `property` exists and is a direct property, instead of an inherited property.
@@ -818,7 +818,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
### `_.identity(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2764 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2767 "View in source") [Ⓣ][1]
This function returns the first argument passed to it. Note: It is used throughout Lo-Dash as a default callback.
@@ -843,7 +843,7 @@ moe === _.identity(moe);
### `_.indexOf(array, value [, isSorted=false])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1090 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1094 "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.
@@ -869,7 +869,7 @@ _.indexOf([1, 2, 3], 2);
### `_.initial(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1124 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1128 "View in source") [Ⓣ][1]
Gets all but the last value of the `array`. Pass `n` to exclude the last `n` values from the result.
@@ -895,7 +895,7 @@ _.initial([5, 4, 3, 2, 1]);
### `_.intersection([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1142 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1146 "View in source") [Ⓣ][1]
Computes the intersection of all the passed-in arrays.
@@ -919,7 +919,7 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
### `_.invoke(array, methodName [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1175 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1179 "View in source") [Ⓣ][1]
Calls the method named by `methodName` for each value of the `collection`. Additional arguments will be passed to each invoked method.
@@ -945,7 +945,7 @@ _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
### `_.isArguments(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2168 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2172 "View in source") [Ⓣ][1]
Checks if a `value` is an `arguments` object.
@@ -972,7 +972,7 @@ _.isArguments([1, 2, 3]);
### `_.isArray(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2194 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2198 "View in source") [Ⓣ][1]
Checks if a `value` is an array.
@@ -999,7 +999,7 @@ _.isArray([1, 2, 3]);
### `_.isBoolean(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2211 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2215 "View in source") [Ⓣ][1]
Checks if a `value` is a boolean *(`true` or `false`)* value.
@@ -1023,7 +1023,7 @@ _.isBoolean(null);
### `_.isDate(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2228 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2232 "View in source") [Ⓣ][1]
Checks if a `value` is a date.
@@ -1047,7 +1047,7 @@ _.isDate(new Date);
### `_.isElement(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2245 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2249 "View in source") [Ⓣ][1]
Checks if a `value` is a DOM element.
@@ -1071,7 +1071,7 @@ _.isElement(document.body);
### `_.isEmpty(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2266 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2270 "View in source") [Ⓣ][1]
Checks if a `value` is empty. Arrays or strings with a length of `0` and objects with no enumerable own properties are considered "empty".
@@ -1098,7 +1098,7 @@ _.isEmpty({});
### `_.isEqual(a, b [, stack])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2300 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2304 "View in source") [Ⓣ][1]
Performs a deep comparison between two values to determine if they are equivalent to each other.
@@ -1130,7 +1130,7 @@ _.isEqual(moe, clone);
### `_.isFinite(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2452 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2456 "View in source") [Ⓣ][1]
Checks if a `value` is a finite number.
@@ -1160,7 +1160,7 @@ _.isFinite(Infinity);
### `_.isFunction(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2469 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2473 "View in source") [Ⓣ][1]
Checks if a `value` is a function.
@@ -1184,7 +1184,7 @@ _.isFunction(''.concat);
### `_.isNaN(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2520 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2524 "View in source") [Ⓣ][1]
Checks if a `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.
@@ -1217,7 +1217,7 @@ _.isNaN(undefined);
### `_.isNull(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2542 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2546 "View in source") [Ⓣ][1]
Checks if a `value` is `null`.
@@ -1244,7 +1244,7 @@ _.isNull(undefined);
### `_.isNumber(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2559 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2563 "View in source") [Ⓣ][1]
Checks if a `value` is a number.
@@ -1268,7 +1268,7 @@ _.isNumber(8.4 * 5;
### `_.isObject(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2490 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2494 "View in source") [Ⓣ][1]
Checks if a `value` is the language type of Object. *(e.g. arrays, functions, objects, regexps, `new Number(0)*`, and `new String('')`)
@@ -1295,7 +1295,7 @@ _.isObject(1);
### `_.isRegExp(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2576 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2580 "View in source") [Ⓣ][1]
Checks if a `value` is a regular expression.
@@ -1319,7 +1319,7 @@ _.isRegExp(/moe/);
### `_.isString(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2593 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2597 "View in source") [Ⓣ][1]
Checks if a `value` is a string.
@@ -1343,7 +1343,7 @@ _.isString('moe');
### `_.isUndefined(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2610 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2614 "View in source") [Ⓣ][1]
Checks if a `value` is `undefined`.
@@ -1367,7 +1367,7 @@ _.isUndefined(void 0);
### `_.keys(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2627 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2631 "View in source") [Ⓣ][1]
Produces an array of the `object`'s enumerable own property names.
@@ -1391,7 +1391,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 });
### `_.last(array [, n, guard])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1205 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1209 "View in source") [Ⓣ][1]
Gets the last value of the `array`. Pass `n` to return the lasy `n` values of the `array`.
@@ -1417,7 +1417,7 @@ _.last([5, 4, 3, 2, 1]);
### `_.lastIndexOf(array, value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1225 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1229 "View in source") [Ⓣ][1]
Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`.
@@ -1442,7 +1442,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
### `_.map(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L639 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L643 "View in source") [Ⓣ][1]
Produces a new array of values by mapping each value in the `collection` through a transformation `callback`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -1471,7 +1471,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#L1262 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1266 "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 invoked with `3` arguments; *(value, index, array)*.
@@ -1503,7 +1503,7 @@ _.max(stooges, function(stooge) { return stooge.age; });
### `_.memoize(func [, resolver])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1893 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1897 "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.
@@ -1529,7 +1529,7 @@ var fibonacci = _.memoize(function(n) {
### `_.min(array [, 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#L1312 "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 invoked with `3` arguments; *(value, index, array)*.
@@ -1555,7 +1555,7 @@ _.min([10, 5, 100, 2, 1000]);
### `_.mixin(object)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2790 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2793 "View in source") [Ⓣ][1]
Adds functions properties of `object` to the `lodash` function and chainable wrapper.
@@ -1585,7 +1585,7 @@ _('larry').capitalize();
### `_.noConflict()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2821 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2824 "View in source") [Ⓣ][1]
Reverts the '_' variable to its previous value and returns a reference to the `lodash` function.
@@ -1605,7 +1605,7 @@ var lodash = _.noConflict();
### `_.once(func)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1919 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1923 "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.
@@ -1631,7 +1631,7 @@ initialize();
### `_.partial(func [, arg1, arg2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1952 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1956 "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.
@@ -1658,7 +1658,7 @@ hi('moe');
### `_.pick(object [, prop1, prop2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2649 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2653 "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.
@@ -1683,7 +1683,7 @@ _.pick({ 'name': 'moe', 'age': 40, 'userid': 'moe1' }, 'name', 'age');
### `_.pluck(collection, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L661 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L665 "View in source") [Ⓣ][1]
Retrieves the value of a specified property from all values in a `collection`.
@@ -1714,7 +1714,7 @@ _.pluck(stooges, 'name');
### `_.range([start=0], end [, step=1])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1365 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1369 "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.
@@ -1752,7 +1752,7 @@ _.range(0);
### `_.reduce(collection, callback [, accumulator, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L691 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L695 "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 the `thisArg` value, if one is passed. The `callback` is invoked with `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*.
@@ -1779,7 +1779,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#L731 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L735 "View in source") [Ⓣ][1]
The right-associative version of `_.reduce`. The `callback` is bound to the `thisArg` value, if one is passed. The `callback` is invoked with `4` arguments; for arrays they are *(accumulator, value, index, array)* and for objects they are *(accumulator, value, key, object)*.
@@ -1807,7 +1807,7 @@ var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []);
### `_.reject(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L784 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L788 "View in source") [Ⓣ][1]
The opposite of `_.filter`, this method returns the values of a `collection` that `callback` does **not** return truthy for. The `callback` is invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -1833,7 +1833,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#L1401 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1405 "View in source") [Ⓣ][1]
The opposite of `_.initial`, this method gets all but the first value of the `array`. Pass `n` to exclude the first `n` values from the result.
@@ -1859,7 +1859,7 @@ _.rest([5, 4, 3, 2, 1]);
### `_.result(object, property)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2851 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2854 "View in source") [Ⓣ][1]
Resolves the value of `property` on `object`. If the property is a function it will be invoked and its result returned, else the property value is returned.
@@ -1894,7 +1894,7 @@ _.result(object, 'stuff');
### `_.shuffle(array)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1419 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1423 "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.
@@ -1918,7 +1918,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]);
### `_.size(value)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2688 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2692 "View in source") [Ⓣ][1]
Gets the size of a `value` by returning `value.length` if `value` is a string or array, or the number of own enumerable properties if `value` is an object.
@@ -1948,7 +1948,7 @@ _.size('curly');
### `_.some(collection, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L808 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L812 "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 invoked with `3` arguments; for arrays they are *(value, index, array)* and for objects they are *(value, key, object)*.
@@ -1974,7 +1974,7 @@ _.some([null, 0, 'yes', false]);
### `_.sortBy(array, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1047 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1051 "View in source") [Ⓣ][1]
Produces a new sorted array, ranked in ascending order by the results of running each value of a `collection` through `callback`. The `callback` is 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')*.
@@ -2003,7 +2003,7 @@ _.sortBy([1, 2, 3, 4, 5, 6], function(num) { return this.sin(num); }, Math);
### `_.sortedIndex(array, value [, callback])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1453 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1457 "View in source") [Ⓣ][1]
Uses a binary search to determine the smallest index at which the `value` should be inserted into the `collection` in order to maintain the sort order of the `collection`. If `callback` is passed, it will be executed for each value in the `collection` to compute their sort ranking. The `callback` is invoked with `1` argument; *(value)*.
@@ -2029,7 +2029,7 @@ _.sortedIndex([10, 20, 30, 40, 50], 35);
### `_.tap(value, interceptor)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2716 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2720 "View in source") [Ⓣ][1]
Invokes `interceptor` with the `value` as the first argument, and then returns `value`. The primary purpose of this method is to "tap into" a method chain, in order to performoperations on intermediate results within the chain.
@@ -2059,7 +2059,7 @@ _.chain([1,2,3,200])
### `_.template(text, data, options)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2911 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2914 "View in source") [Ⓣ][1]
A JavaScript micro-templating method, similar to John Resig's implementation. Lo-Dash templating handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code.
@@ -2119,7 +2119,7 @@ _.template('<%= data.hasWith %>', { 'hasWith': 'no' }, { 'variable': 'data' });
### `_.throttle(func, wait)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1988 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1992 "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, `func` will also be called on the trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call.
@@ -2144,7 +2144,7 @@ jQuery(window).on('scroll', throttled);
### `_.times(n, callback [, thisArg])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2988 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2991 "View in source") [Ⓣ][1]
Executes the `callback` function `n` times. The `callback` is invoked with `1` argument; *(index)*.
@@ -2166,7 +2166,7 @@ _.times(3, function() { genie.grantWish(); });
### `_.toArray(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L827 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L831 "View in source") [Ⓣ][1]
Converts the `collection`, into an array. Useful for converting the `arguments` object.
@@ -2190,7 +2190,7 @@ Converts the `collection`, into an array. Useful for converting the `arguments`
### `_.union([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1486 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1490 "View in source") [Ⓣ][1]
Computes the union of the passed-in arrays.
@@ -2214,7 +2214,7 @@ _.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
### `_.uniq(array [, isSorted=false, callback])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1521 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1525 "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 invoked with `3` arguments; *(value, index, array)*.
@@ -2240,7 +2240,7 @@ _.uniq([1, 2, 1, 3, 1, 4]);
### `_.uniqueId([prefix])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3011 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3014 "View in source") [Ⓣ][1]
Generates a unique id. If `prefix` is passed, the id will be appended to it.
@@ -2264,7 +2264,7 @@ _.uniqueId('contact_');
### `_.values(collection)`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L855 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L859 "View in source") [Ⓣ][1]
Produces an array of enumerable own property values of the `collection`.
@@ -2288,7 +2288,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 });
### `_.without(array [, value1, value2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1556 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1560 "View in source") [Ⓣ][1]
Produces a new array with all occurrences of the passed values removed using strict equality for comparisons, i.e. `===`.
@@ -2313,7 +2313,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#L2040 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2044 "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.
@@ -2343,7 +2343,7 @@ hello();
### `_.zip([array1, array2, ...])`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1586 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1590 "View in source") [Ⓣ][1]
Merges together the values of each of the arrays with the value at the corresponding position. 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.
@@ -2374,7 +2374,7 @@ _.zip(['moe', 'larry', 'curly'], [30, 40, 50], [true, false, false]);
### `_.prototype.chain()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3059 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3062 "View in source") [Ⓣ][1]
Extracts the value from a wrapped chainable object.
@@ -2395,7 +2395,7 @@ _([1, 2, 3]).value();
### `_.prototype.value()`
-# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3076 "View in source") [Ⓣ][1]
+# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3079 "View in source") [Ⓣ][1]
Extracts the value from a wrapped chainable object.
diff --git a/doc/parse.php b/doc/parse.php
index 48e5a55dde..bcb7b8c064 100644
--- a/doc/parse.php
+++ b/doc/parse.php
@@ -21,7 +21,7 @@
// generate Markdown
$markdown = docdown(array(
'path' => '../' . $file,
- 'title' => 'Lo-Dash v0.2.1',
+ 'title' => 'Lo-Dash v0.2.2',
'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js'
));
diff --git a/lodash.js b/lodash.js
index cc73224bd0..3a8e1b7dcd 100644
--- a/lodash.js
+++ b/lodash.js
@@ -1,5 +1,5 @@
/*!
- * Lo-Dash v0.2.1
+ * Lo-Dash v0.2.2
* Copyright 2012 John-David Dalton
* Based on Underscore.js 1.3.3, copyright 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
*
@@ -176,7 +176,7 @@
* @memberOf _.templateSettings
* @type String
*/
- 'variable': 'object'
+ 'variable': 'obj'
};
/*--------------------------------------------------------------------------*/
@@ -302,6 +302,11 @@
'inLoop': 'callback(collection[index], index, collection) && result.push(collection[index])'
};
+ /** Reusable iterator options for `find` and `forEach` */
+ var forEachIteratorOptions = {
+ 'top': 'if (thisArg) callback = bind(callback, thisArg)'
+ };
+
/** Reusable iterator options for `map`, `pluck`, and `values` */
var mapIteratorOptions = {
'init': '',
@@ -584,7 +589,8 @@
* var even = _.find([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
* // => 2
*/
- var find = createIterator(baseIteratorOptions, {
+ var find = createIterator(baseIteratorOptions, forEachIteratorOptions, {
+ 'init': '',
'inLoop': 'if (callback(collection[index], index, collection)) return collection[index]'
});
@@ -610,9 +616,7 @@
* _([1, 2, 3]).forEach(function(num) { alert(num); }).join(',');
* // => alerts each number in turn and returns '1,2,3'
*/
- var forEach = createIterator(baseIteratorOptions, {
- 'top': 'if (thisArg) callback = bind(callback, thisArg)'
- });
+ var forEach = createIterator(baseIteratorOptions, forEachIteratorOptions);
/**
* Produces a new array of values by mapping each value in the `collection`
@@ -2742,8 +2746,7 @@
.replace(/&/g, '&')
.replace(/arguments.length;j&&(c=v(c,j));if(b===+b){for(b&&e&&(d=a[--b]);b--;)d=c(d,a[b],b,a);return d}var g=T(a);for((b=g.length)&&e&&(d=a[g[--b]]);b--;)e=g[b],d=c(d,a[e],e,a);return d}function U(a,c,d){return c==n||d?a[0]:l.call(a,0,c)}function ga(a,c){for(var d,b=-1,f=a.length,e=[];++barguments.length;j&&(c=v(c,j));if(b===+b){for(b&&e&&(d=a[--b]);b--;)d=c(d,a[b],b,a);return d}var g=U(a);for((b=g.length)&&e&&(d=a[g[--b]]);b--;)e=g[b],d=c(d,a[e],e,a);return d}function V(a,c,d){return c==n||d?a[0]:l.call(a,0,c)}function ga(a,c){for(var d,b=-1,f=a.length,e=[];++bg&&(g=a[f]);return g}for(d&&(c=v(c,d));++fb&&(b=d,g=a[f]);return g}function ja(a,c,d){return l.call(a,c==n||d?1:c)}function ha(a,c,d){var b,f=0,e=a.length;for(d&&(c=d(c));f>1,(d?d(a[b]):a[b])x(h,b))h.push(b),
-g.push(a[f]);return g}function v(a,c){function d(){var g=arguments,h=c;return f||(a=c[b]),e.length&&(g=g.length?L.apply(e,g):e),this instanceof d?(ea.prototype=a.prototype,h=new ea,g=a.apply(h,g),I[typeof g]&&g!==o?g:h):a.apply(h,g)}var b,f=i.call(a)==r;if(f){if(y)return y.call.apply(y,arguments)}else b=c,c=a;var e=l.call(arguments,2);return d}function M(a,c,d){d||(d=[]);if(a===c)return 0!==a||1/a==1/c;if(a==n||c==n)return a===c;a.s&&(a=a._wrapped),c.s&&(c=c._wrapped);if(a.isEqual&&i.call(a.isEqual
-)==r)return a.isEqual(c);if(c.isEqual&&i.call(c.isEqual)==r)return c.isEqual(a);var b=i.call(a);if(b!=i.call(c))return q;switch(b){case J:return a==""+c;case N:return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case la:case ma:return+a==+c;case na:return a.source==c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return q;for(var f=d.length;f--;)if(d[f]==a)return m;var f=-1,e=m,g=0;d.push(a);if(b==H){if(g=a.length,e=g==c.length)for(;g--&&
-(e=M(a[g],c[g],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return q;for(var h in a)if(s.call(a,h)&&(g++,!(e=s.call(c,h)&&M(a[h],c[h],d))))break;if(e){for(h in c)if(s.call(c,h)&&!(g--))break;e=!g}if(e&&G)for(;7>++f&&(h=ca[f],!s.call(a,h)||!!(e=s.call(c,h)&&M(a[h],c[h],d))););}return d.pop(),e}function da(a){return a}function oa(a){B(O(a),function(c){var d=b[c]=a[c];p.prototype[c]=function(){var a=[this._wrapped];return arguments.length&&K.apply(a,arguments),a=1==
-a.length?d.call(b,a[0]):d.apply(b,a),this.s&&(a=new p(a),a.s=m),a}})}var m=!0,o=null,q=!1,W="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(u=global),exports),va={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},G=!{valueOf:0}.propertyIsEnumerable("valueOf"),za=0,I={"boolean":q,"function":m,object:m,number:q,string:q,"undefined":q},Aa=u._,z=RegExp("^"+({}.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&").replace(/valueOf|for [^\]]+/g
-,".+?")+"$"),Ba=/__token__(\d+)/g,Ca=/['\n\r\t\u2028\u2029\\]/g,ca="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),S="__token__",w=[],H="[object Array]",la="[object Boolean]",ma="[object Date]",r="[object Function]",N="[object Number]",na="[object RegExp]",J="[object String]",A=Array.prototype,C=Object.prototype,L=A.concat,s=C.hasOwnProperty,K=A.push,l=A.slice,i=C.toString,y=z.test(y=l.bind)&&/\n|Opera/.test(y+i.call(u.opera))&&y,D=z.test
-(D=Array.isArray)&&D,Da=u.isFinite,X=z.test(X=Object.keys)&&X,Ea=u.clearTimeout,P=u.setTimeout;b.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"object"};var sa=Function("n","var __p;with(n){__p='var l,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;l=-1;';if(o){__p+='if(m===+m){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&l==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var g='+l+'.constructor;';for(var k=0;k<7;k++){__p+='l=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(g&&g.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p"
-),t={a:"f,d,x",k:"f",q:"if(!d){d=k}else if(x){d=c(d,x)}",j:"d(f[l],l,f)"},Y={k:"z",j:"if(!d(f[l],l,f))return!r"},Z={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ua?c():function(){if(1>--a)return c.apply(this,arguments)}},b.bind=v,b.bindAll=function(a){var c=arguments,d=1;1==c.length&&(d=0,c=O(a));for(var b=c.length;dx(f,a[c])&&b.push(a[c]);return b},b.escape=function(a){return(a+"").replace(/&/g,"&").replace(/x(e,c)&&$(f,function(a){return-1++f&&(h=ca[f],!s.call(a,h)||!!(e=s.call(c,h)&&N(a[h],c[h],d))););}return d.pop(),e}function da(a){return a}function oa(a){C(P(a),function(c){var d=b[c]=a[c];p.prototype[c]=function(){var a=[this._wrapped];return arguments.length&&L.apply(a,arguments
+),a=1==a.length?d.call(b,a[0]):d.apply(b,a),this._chain&&(a=new p(a),a._chain=m),a}})}var m=!0,o=null,q=!1,X="object"==typeof exports&&exports&&("object"==typeof global&&global&&global==global.global&&(u=global),exports),va={"\\":"\\","'":"'","\n":"n","\r":"r"," ":"t","\u2028":"u2028","\u2029":"u2029"},H=!{valueOf:0}.propertyIsEnumerable("valueOf"),za=0,J={"boolean":q,"function":m,object:m,number:q,string:q,"undefined":q},Aa=u._,z=RegExp("^"+({}.valueOf+"").replace(/[.*+?^=!:${}()|[\]\/\\]/g,"\\$&"
+).replace(/valueOf|for [^\]]+/g,".+?")+"$"),Ba=/__token__(\d+)/g,Ca=/['\n\r\t\u2028\u2029\\]/g,ca="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),T="__token__",w=[],I="[object Array]",la="[object Boolean]",ma="[object Date]",r="[object Function]",O="[object Number]",na="[object RegExp]",K="[object String]",A=Array.prototype,D=Object.prototype,M=A.concat,s=D.hasOwnProperty,L=A.push,l=A.slice,i=D.toString,y=z.test(y=l.bind)&&/\n|Opera/.test
+(y+i.call(u.opera))&&y,E=z.test(E=Array.isArray)&&E,Da=u.isFinite,Y=z.test(Y=Object.keys)&&Y,Ea=u.clearTimeout,Q=u.setTimeout;b.templateSettings={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,variable:"obj"};var sa=Function("obj","var __p;with(obj){__p='var l,r';if(k){__p+='='+k};__p+=';'+f+';'+q+';';if(c){__p+='var m='+g+'.length;l=-1;';if(o){__p+='if(m===+m){'};__p+=''+c['d']+';while('+c['m']+'){'+c['j']+'}';if(o){__p+='}'}}if(o){if(c){__p+='else{'}if(!i){__p+='var s=typeof '+l+'==\\'function\\';'};__p+=''+o['d']+';for('+o['m']+'){';if(i){if(r){__p+='if('+h+'){'};__p+=''+o['j']+';';if(r){__p+='}'}}else{__p+='if(!(s&&l==\\'prototype\\')';if(r){__p+='&&'+h};__p+='){'+o['j']+'}'};__p+='}';if(i){__p+='var g='+l+'.constructor;';for(var k=0;k<7;k++){__p+='l=\\''+p[k]+'\\';if(';if(p[k]=='constructor'){__p+='!(g&&g.prototype==='+l+')&&'};__p+=''+h+'){'+o['j']+'}'}}if(c){__p+='}'}};__p+=''+e+';return r'}return __p"
+),t={a:"f,d,x",k:"f",q:"if(!d){d=k}else if(x){d=c(d,x)}",j:"d(f[l],l,f)"},Z={k:"z",j:"if(!d(f[l],l,f))return!r"},$={a:"n",k:"n",q:"for(var t,u=1,m=arguments.length;ua?c():function(){if(1>--a)return c.apply(this,arguments)}},b.bind=v,b.bindAll=function(a){var c=arguments,d=1;1==c.length&&(d=0,c=P(a));for(var b=c.length;dx(f,a[c])&&b.push(a[c]);return b},b.escape=function(a){return(a+"").replace(/&/g,"&").replace(/x(e,c)&&aa(f,function(a){return-1arguments.length&&(c=a||0,a=0);for(var b=-1,f=Math.max(Math.ceil((c-a)/d),0),e=Array(f);++bd?1:0}),"b")},b.sortedIndex=ha,b.tap=function(a,c){return c(a),a}
-,b.template=function(a,c,d){d||(d={});var j;j=b.templateSettings;var f=d.escape,e=d.evaluate,g=d.interpolate,d=d.variable;return f==o&&(f=j.escape),e==o&&(e=j.evaluate),g==o&&(g=j.interpolate),f&&(a=a.replace(f,wa)),g&&(a=a.replace(g,xa)),e&&(a=a.replace(e,ya)),a="__p='"+a.replace(Ca,ua).replace(Ba,ta)+"';\n",w.length=0,d||(d=j.variable,a="with("+d+"||{}){"+a+"}"),a="function("+d+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}",j=Function("_","return "+
-a)(b),c?j(c):(j.source=a,j)},b.throttle=function(a,c){function b(){h=new Date,g=n,a.apply(e,j)}var j,f,e,g,h=0;return function(){var i=new Date,k=c-(i-h);return j=arguments,e=this,0>=k?(h=i,f=a.apply(e,j)):g||(g=P(b,k)),f}},b.times=function(a,c,b){b&&(c=v(c,b));for(b=0;bx(b,d[a])&&
-b.push(d[a]);return b},b.uniq=ka,b.uniqueId=function(a){var b=za++;return a?a+b:b},b.values=qa,b.without=function(a){for(var b=l.call(arguments,1),d=-1,i=a.length,f=[];++dx(b,a[d])&&f.push(a[d]);return f},b.wrap=function(a,b){return function(){var d=[a];return arguments.length&&K.apply(d,arguments),b.apply(this,d)}},b.zip=function(){for(var a=-1,b=ia(Q(arguments,"length")),d=Array(b);++aarguments.length&&(c=a||0,a=0);for(var b=-1,f=Math.max(Math.ceil((c-a)/d),0),e=Array(f);++bd?1:0}),"b")},b.sortedIndex=ha,b.tap=function(a,c){return c(a),a},
+b.template=function(a,c,d){d||(d={});var j;j=b.templateSettings;var f=d.escape,e=d.evaluate,g=d.interpolate,d=d.variable;return f==o&&(f=j.escape),e==o&&(e=j.evaluate),g==o&&(g=j.interpolate),f&&(a=a.replace(f,wa)),g&&(a=a.replace(g,xa)),e&&(a=a.replace(e,ya)),a="__p='"+a.replace(Ca,ua).replace(Ba,ta)+"';\n",w.length=0,d||(d=j.variable,a="with("+d+"||{}){"+a+"}"),a="function("+d+"){var __p,__t,__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}"+a+"return __p}",j=Function("_","return "+
+a)(b),c?j(c):(j.source=a,j)},b.throttle=function(a,c){function b(){h=new Date,g=n,a.apply(e,j)}var j,f,e,g,h=0;return function(){var i=new Date,k=c-(i-h);return j=arguments,e=this,0>=k?(h=i,f=a.apply(e,j)):g||(g=Q(b,k)),f}},b.times=function(a,c,b){b&&(c=v(c,b));for(b=0;bx(b,d[a])&&
+b.push(d[a]);return b},b.uniq=ka,b.uniqueId=function(a){var b=za++;return a?a+b:b},b.values=qa,b.without=function(a){for(var b=l.call(arguments,1),d=-1,i=a.length,f=[];++dx(b,a[d])&&f.push(a[d]);return f},b.wrap=function(a,b){return function(){var d=[a];return arguments.length&&L.apply(d,arguments),b.apply(this,d)}},b.zip=function(){for(var a=-1,b=ia(R(arguments,"length")),d=Array(b);++a= score.underscore) {
- console.log('\nLo-Dash is ' + (score.lodash / score.underscore).toFixed(2) + 'x faster than Underscore.');
+ console.log('\nLo-Dash' + message + 'Underscore.');
} else {
- console.log('\nUnderscore is ' + (score.underscore / score.lodash).toFixed(2) + 'x faster than Lo-Dash.');
+ console.log('\nUnderscore' + message + 'Lo-Dash.');
}
}
}
@@ -205,6 +211,22 @@
/*--------------------------------------------------------------------------*/
+ suites.push(
+ Benchmark.Suite('find')
+ .add('Lo-Dash', function() {
+ lodash.find(numbers, function(num) {
+ return num === 19;
+ });
+ })
+ .add('Underscore', function() {
+ _.find(numbers, function(num) {
+ return num === 19;
+ });
+ })
+ );
+
+ /*--------------------------------------------------------------------------*/
+
suites.push(
Benchmark.Suite('flatten deep')
.add('Lo-Dash', function() {
diff --git a/test/test.js b/test/test.js
index 2036fa49b5..e98c8ab091 100644
--- a/test/test.js
+++ b/test/test.js
@@ -92,7 +92,7 @@
ok(_() instanceof _);
});
- test('should pass through LoDash instances', function() {
+ test('should return passed LoDash instances', function() {
var wrapped = _([]);
equal(_(wrapped), wrapped);
});
@@ -174,6 +174,22 @@
/*--------------------------------------------------------------------------*/
+ QUnit.module('lodash.find');
+
+ (function() {
+ var array = [1, 2, 3, 4];
+
+ test('should return found `value`', function() {
+ equal(_.find(array, function(n) { return n > 2; }), 3);
+ });
+
+ test('should return `undefined` if `value` is not found', function() {
+ equal(_.find(array, function(n) { return n == 5; }), undefined);
+ });
+ }());
+
+ /*--------------------------------------------------------------------------*/
+
QUnit.module('lodash.flatten');
(function() {
@@ -386,7 +402,7 @@
(function() {
test('supports recursive calls', function() {
- var compiled = _.template('<%= a %><% a = _.template(c, object) %><%= a %>'),
+ var compiled = _.template('<%= a %><% a = _.template(c, obj) %><%= a %>'),
data = { 'a': 'A', 'b': 'B', 'c': '<%= b %>' };
equal(compiled(data), 'AB');
diff --git a/vendor/backbone b/vendor/backbone
index 3c7c8d2f1a..5509e13842 160000
--- a/vendor/backbone
+++ b/vendor/backbone
@@ -1 +1 @@
-Subproject commit 3c7c8d2f1af5ded3067324579ca6ff0f5dcb2893
+Subproject commit 5509e13842a4d8e9c2c2fd59d86492bbf6c0b596
diff --git a/vendor/underscore b/vendor/underscore
index 0da7b393b0..7229edc46e 160000
--- a/vendor/underscore
+++ b/vendor/underscore
@@ -1 +1 @@
-Subproject commit 0da7b393b08c2459bc302f4ccb6401587b1fb1da
+Subproject commit 7229edc46ef9a11c6bae2fe9b748022d3e56c19f