diff --git a/README.md b/README.md index 8b773b3c5..a76f16f74 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ For a list of upcoming features, check out our [roadmap](https://github.com/best * [_.isPlainObject](http://lodash.com/docs#isPlainObject) for checking if values are created by `Object` * [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend) * [_.parseInt](http://lodash.com/docs#parseInt) for consistent behavior - * [_.partialRight](http://lodash.com/docs#partialRight) & [friends](http://lodash.com/docs#partial) for partial application without binding + * [_.partialRight](http://lodash.com/docs#partialRight) for [partial application](http://lodash.com/docs#partial) from the right * [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking * [_.support](http://lodash.com/docs#support) for flagging environment features * [_.template](http://lodash.com/docs#template) supports [*“imports”*](http://lodash.com/docs#templateSettings_imports) options & [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-7.8.6) diff --git a/dist/lodash.compat.js b/dist/lodash.compat.js index 7cde04a9d..2609b026a 100644 --- a/dist/lodash.compat.js +++ b/dist/lodash.compat.js @@ -132,7 +132,7 @@ /** Detect free variable `module` */ var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module; - /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ + /** Detect free variable `global` from Node.js or Browserified code and use it as `window` */ var freeGlobal = objectTypes[typeof global] && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { window = freeGlobal; @@ -217,8 +217,8 @@ } /** - * Used by `_.max` and `_.min` as the default `callback` when a given - * `collection` is a string value. + * Used by `_.max` and `_.min` as the default callback when a given + * collection is a string value. * * @private * @param {String} value The character to inspect. @@ -371,7 +371,7 @@ } /** - * Releases the given `array` back to the array pool. + * Releases the given array back to the array pool. * * @private * @param {Array} [array] The array to release. @@ -384,7 +384,7 @@ } /** - * Releases the given `object` back to the object pool. + * Releases the given object back to the object pool. * * @private * @param {Object} [object] The object to release. @@ -404,7 +404,7 @@ * Slices the `collection` from the `start` index up to, but not including, * the `end` index. * - * Note: This function is used, instead of `Array#slice`, to support node lists + * Note: This function is used instead of `Array#slice` to support node lists * in IE < 9 and to ensure dense arrays are returned. * * @private @@ -547,7 +547,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a `lodash` object, which wraps the given `value`, to enable method + * Creates a `lodash` object which wraps the given value to enable method * chaining. * * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: @@ -1049,7 +1049,7 @@ } /** - * The base implementation of `_.flatten` without support for `callback` + * The base implementation of `_.flatten` without support for callback * shorthands or `thisArg` binding. * * @private @@ -1087,7 +1087,7 @@ * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. * @param {Array} [stackA=[]] Tracks traversed `a` objects. * @param {Array} [stackB=[]] Tracks traversed `b` objects. - * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`. + * @returns {Boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { // used to indicate that when comparing objects, `a` has at least the properties of `b` @@ -1111,7 +1111,7 @@ !(b && objectTypes[otherType])) { return false; } - // exit early for `null` and `undefined`, avoiding ES3's Function#call behavior + // exit early for `null` and `undefined` avoiding ES3's Function#call behavior // http://es5.github.io/#x15.3.4.4 if (a == null || b == null) { return a === b; @@ -1133,7 +1133,7 @@ case boolClass: case dateClass: // coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0`, treating invalid dates coerced to `NaN` as not equal + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal return +a == +b; case numberClass: @@ -1311,12 +1311,12 @@ } /** - * The base implementation of `_.uniq` without support for `callback` shorthands + * The base implementation of `_.uniq` without support for callback shorthands * or `thisArg` binding. * * @private * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. + * @param {Boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function} [callback] The function called per iteration. * @returns {Array} Returns a duplicate-value-free array. */ @@ -1559,14 +1559,14 @@ }; /** - * A fallback implementation of `isPlainObject` which checks if a given `value` + * A fallback implementation of `isPlainObject` which checks if a given value * is an object created by the `Object` constructor, assuming objects created * by the `Object` constructor have no inherited enumerable properties and that * there are no `Object.prototype` extensions. * * @private * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. + * @returns {Boolean} Returns `true` if `value` is a plain object, else `false`. */ function shimIsPlainObject(value) { var ctor, @@ -1618,7 +1618,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an `arguments` object, else `false`. * @example * * (function() { return _.isArguments(arguments); })(1, 2, 3); @@ -1645,7 +1645,7 @@ * @type Function * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an array, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an array, else `false`. * @example * * (function() { return _.isArray(arguments); })(); @@ -1675,7 +1675,7 @@ }); /** - * Creates an array composed of the own enumerable property names of `object`. + * Creates an array composed of the own enumerable property names of an object. * * @static * @memberOf _ @@ -1753,8 +1753,8 @@ /** * A function compiled to iterate `arguments` objects, arrays, objects, and - * strings consistenly across environments, executing the `callback` for each - * element in the `collection`. The `callback` is bound to `thisArg` and invoked + * strings consistenly across environments, executing the callback for each + * element in the collection. The callback is bound to `thisArg` and invoked * with three arguments; (value, index|key, collection). Callbacks may exit * iteration early by explicitly returning `false`. * @@ -1772,9 +1772,9 @@ /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources will overwrite property assignments of previous - * sources. If a `callback` function is provided, it will be executed to produce - * the assigned values. The `callback` is bound to `thisArg` and invoked with - * two arguments; (objectValue, sourceValue). + * sources. If a callback is provided it will be executed to produce the + * assigned values. The callback is bound to `thisArg` and invoked with two + * arguments; (objectValue, sourceValue). * * @static * @memberOf _ @@ -1813,11 +1813,11 @@ }); /** - * Creates a clone of `value`. If `deep` is `true`, nested objects will also - * be cloned, otherwise they will be assigned by reference. If a `callback` - * function is provided, it will be executed to produce the cloned values. If - * `callback` returns `undefined`, cloning will be handled by the method instead. - * The `callback` is bound to `thisArg` and invoked with one argument; (value). + * Creates a clone of `value`. If `deep` is `true` nested objects will also + * be cloned, otherwise they will be assigned by reference. If a callback + * is provided it will be executed to produce the cloned values. If the + * callback returns `undefined` cloning will be handled by the method instead. + * The callback is bound to `thisArg` and invoked with one argument; (value). * * @static * @memberOf _ @@ -1864,10 +1864,10 @@ } /** - * Creates a deep clone of `value`. If a `callback` function is provided, - * it will be executed to produce the cloned values. If `callback` returns - * `undefined`, cloning will be handled by the method instead. The `callback` - * is bound to `thisArg` and invoked with one argument; (value). + * Creates a deep clone of `value`. If a callback is provided it will be + * executed to produce the cloned values. If the callback returns `undefined` + * cloning will be handled by the method instead. The callback is bound to + * `thisArg` and invoked with one argument; (value). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and @@ -1931,7 +1931,7 @@ var defaults = createIterator(defaultsIteratorOptions); /** - * This method is like `_.findIndex`, except that it returns the key of the + * This method is like `_.findIndex` except that it returns the key of the * first element that passes the callback check, instead of the element itself. * * @static @@ -1939,7 +1939,7 @@ * @category Objects * @param {Object} object The object to search. * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is provided, it will be used to + * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the key of the found element, else `undefined`. @@ -1963,7 +1963,7 @@ } /** - * This method is like `_.findKey`, except that it iterates over elements + * This method is like `_.findKey` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -1971,7 +1971,7 @@ * @category Objects * @param {Object} object The object to search. * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is provided, it will be used to + * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the key of the found element, else `undefined`. @@ -1995,10 +1995,10 @@ } /** - * Iterates over own and inherited enumerable properties of a given `object`, - * executing the `callback` for each property. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. + * Iterates over own and inherited enumerable properties of an object, + * executing the callback for each property. The callback is bound to `thisArg` + * and invoked with three arguments; (value, key, object). Callbacks may exit + * iteration early by explicitly returning `false`. * * @static * @memberOf _ @@ -2028,7 +2028,7 @@ }); /** - * This method is like `_.forIn`, except that it iterates over elements + * This method is like `_.forIn` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -2071,10 +2071,10 @@ } /** - * Iterates over own enumerable properties of a given `object`, executing the - * `callback` for each property. The `callback` is bound to `thisArg` and - * invoked with three arguments; (value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. + * Iterates over own enumerable properties of an object, executing the callback + * for each property. The callback is bound to `thisArg` and invoked with three + * arguments; (value, key, object). Callbacks may exit iteration early by + * explicitly returning `false`. * * @static * @memberOf _ @@ -2094,7 +2094,7 @@ var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions); /** - * This method is like `_.forOwn`, except that it iterates over elements + * This method is like `_.forOwn` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -2170,7 +2170,7 @@ } /** - * Creates an object composed of the inverted keys and values of the given `object`. + * Creates an object composed of the inverted keys and values of the given object. * * @static * @memberOf _ @@ -2202,7 +2202,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a boolean value, else `false`. * @example * * _.isBoolean(null); @@ -2219,7 +2219,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a date, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a date, else `false`. * @example * * _.isDate(new Date); @@ -2236,7 +2236,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); @@ -2255,7 +2255,7 @@ * @memberOf _ * @category Objects * @param {Array|Object|String} value The value to inspect. - * @returns {Boolean} Returns `true`, if the `value` is empty, else `false`. + * @returns {Boolean} Returns `true` if the `value` is empty, else `false`. * @example * * _.isEmpty([1, 2, 3]); @@ -2288,10 +2288,10 @@ /** * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If `callback` is provided, it will be executed to - * compare values. If `callback` returns `undefined`, comparisons will be handled - * by the method instead. The `callback` is bound to `thisArg` and invoked with - * two arguments; (a, b). + * equivalent to each other. If a callback is provided it will be executed + * to compare values. If the callback returns `undefined` comparisons will + * be handled by the method instead. The callback is bound to `thisArg` and + * invoked with two arguments; (a, b). * * @static * @memberOf _ @@ -2300,7 +2300,7 @@ * @param {Mixed} b The other value to compare. * @param {Function} [callback] The function to customize comparing values. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`. + * @returns {Boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var moe = { 'name': 'moe', 'age': 40 }; @@ -2331,14 +2331,14 @@ /** * Checks if `value` is, or can be coerced to, a finite number. * - * Note: This is not the same as native `isFinite`, which will return true for + * Note: This is not the same as native `isFinite` which will return true for * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is finite, else `false`. + * @returns {Boolean} Returns `true` if the `value` is finite, else `false`. * @example * * _.isFinite(-101); @@ -2367,7 +2367,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a function, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -2391,7 +2391,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an object, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an object, else `false`. * @example * * _.isObject({}); @@ -2414,14 +2414,14 @@ /** * Checks if `value` is `NaN`. * - * Note: This is not the same as native `isNaN`, which will return `true` for + * Note: This is not the same as native `isNaN` which will return `true` for * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); @@ -2449,7 +2449,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `null`, else `false`. * @example * * _.isNull(null); @@ -2471,7 +2471,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a number, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a number, else `false`. * @example * * _.isNumber(8.4 * 5); @@ -2482,13 +2482,13 @@ } /** - * Checks if a given `value` is an object created by the `Object` constructor. + * Checks if `value` is an object created by the `Object` constructor. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. + * @returns {Boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Stooge(name, age) { @@ -2524,7 +2524,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a regular expression, else `false`. * @example * * _.isRegExp(/moe/); @@ -2541,7 +2541,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a string, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a string, else `false`. * @example * * _.isString('moe'); @@ -2558,7 +2558,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); @@ -2570,11 +2570,11 @@ /** * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined`, into the destination object. Subsequent sources - * will overwrite property assignments of previous sources. If a `callback` function - * is provided, it will be executed to produce the merged values of the destination - * and source properties. If `callback` returns `undefined`, merging will be - * handled by the method instead. The `callback` is bound to `thisArg` and + * don't resolve to `undefined` into the destination object. Subsequent sources + * will overwrite property assignments of previous sources. If a callback is + * provided it will be executed to produce the merged values of the destination + * and source properties. If the callback returns `undefined` merging will + * be handled by the method instead. The callback is bound to `thisArg` and * invoked with two arguments; (objectValue, sourceValue). * * @static @@ -2652,10 +2652,10 @@ /** * Creates a shallow clone of `object` excluding the specified properties. * Property names may be specified as individual arguments or as arrays of - * property names. If a `callback` function is provided, it will be executed - * for each property in the `object`, omitting the properties `callback` - * returns truthy for. The `callback` is bound to `thisArg` and invoked - * with three arguments; (value, key, object). + * property names. If a callback is provided it will be executed for each + * property of `object` omitting the properties the callback returns truthy + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). * * @static * @memberOf _ @@ -2697,7 +2697,7 @@ } /** - * Creates a two dimensional array of the given object's key-value pairs, + * Creates a two dimensional array of an object's key-value pairs, * i.e. `[[key1, value1], [key2, value2]]`. * * @static @@ -2725,10 +2725,11 @@ /** * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of property - * names. If `callback` is provided, it will be executed for each property in the - * `object`, picking the properties `callback` returns truthy for. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, key, object). + * Property names may be specified as individual arguments or as arrays of + * property names. If a callback is provided it will be executed for each + * property of `object` picking the properties the callback returns truthy + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). * * @static * @memberOf _ @@ -2774,10 +2775,10 @@ } /** - * An alternative to `_.reduce`, this method transforms an `object` to a new + * An alternative to `_.reduce` this method transforms `object` to a new * `accumulator` object which is the result of running each of its elements - * through the `callback`, with each `callback` execution potentially mutating - * the `accumulator` object. The `callback` is bound to `thisArg` and invoked + * through a callback, with each callback execution potentially mutating + * the `accumulator` object. The callback is bound to `thisArg` and invoked * with four arguments; (accumulator, value, key, object). Callbacks may exit * iteration early by explicitly returning `false`. * @@ -2888,9 +2889,9 @@ } /** - * Checks if a given `target` element is present in a `collection` using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. + * Checks if a given value is present in a collection using strict equality + * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the + * offset from the end of the collection. * * @static * @memberOf _ @@ -2938,15 +2939,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the given `callback`. The corresponding - * value of each key is the number of times the key was returned by the `callback`. - * The `callback` is bound to `thisArg` and invoked with three arguments; + * each element of `collection` through the callback. The corresponding value + * of each key is the number of times the key was returned by the callback. + * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2955,7 +2956,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -2975,14 +2976,14 @@ }); /** - * Checks if the `callback` returns a truthy value for **all** elements of a - * `collection`. The `callback` is bound to `thisArg` and invoked with three + * Checks if the given callback returns truthy value for **all** elements of + * a collection. The callback is bound to `thisArg` and invoked with three * arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2992,7 +2993,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Boolean} Returns `true` if all elements passed the callback check, @@ -3037,14 +3038,14 @@ } /** - * Iterates over elements of a `collection`, returning an array of all elements - * the `callback` returns truthy for. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index|key, collection). + * Iterates over elements of a collection, returning an array of all elements + * the callback returns truthy for. The callback is bound to `thisArg` and + * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3054,7 +3055,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of elements that passed the callback check. @@ -3101,14 +3102,14 @@ } /** - * Iterates over elements of a `collection`, returning the first that the - * `callback` returns truthy for. The `callback` is bound to `thisArg` and + * Iterates over elements of a collection, returning the first element that + * the callback returns truthy for. The callback is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3118,7 +3119,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the found element, else `undefined`. @@ -3169,7 +3170,7 @@ } /** - * This method is like `_.find`, except that it iterates over elements + * This method is like `_.find` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -3177,7 +3178,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the found element, else `undefined`. @@ -3201,10 +3202,10 @@ } /** - * Iterates over elements of a `collection`, executing the `callback` for - * each element. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). Callbacks may exit iteration - * early by explicitly returning `false`. + * Iterates over elements of a collection, executing the callback for each + * element. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). Callbacks may exit iteration early by + * explicitly returning `false`. * * @static * @memberOf _ @@ -3239,7 +3240,7 @@ } /** - * This method is like `_.forEach`, except that it iterates over elements + * This method is like `_.forEach` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -3275,15 +3276,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the `callback`. The corresponding - * value of each key is an array of the elements responsible for generating - * the key. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). + * each element of a collection through the callback. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false` * @@ -3292,7 +3293,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -3314,15 +3315,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the given `callback`. The corresponding + * each element of the collection through the given callback. The corresponding * value of each key is the last element responsible for generating the key. - * The `callback` is bound to `thisArg` and invoked with three arguments; + * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3331,7 +3332,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -3356,10 +3357,10 @@ }); /** - * Invokes the method named by `methodName` on each element in the `collection`, + * Invokes the method named by `methodName` on each element in the `collection` * returning an array of the results of each invoked method. Additional arguments - * will be provided to each invoked method. If `methodName` is a function, it will - * be invoked for, and `this` bound to, each element in the `collection`. + * will be provided to each invoked method. If `methodName` is a function it + * will be invoked for, and `this` bound to, each element in the `collection`. * * @static * @memberOf _ @@ -3391,14 +3392,14 @@ } /** - * Creates an array of values by running each element in the `collection` - * through the `callback`. The `callback` is bound to `thisArg` and invoked with + * Creates an array of values by running each element in the collection + * through the callback. The callback is bound to `thisArg` and invoked with * three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3408,7 +3409,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of the results of each `callback` execution. @@ -3448,15 +3449,15 @@ } /** - * Retrieves the maximum value of an `array`. If `callback` is provided, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, collection). + * Retrieves the maximum value of an array. If a callback is provided it + * will be executed for each value in the array to generate the criterion by + * which the value is ranked. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3465,7 +3466,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the maximum value. @@ -3517,15 +3518,15 @@ } /** - * Retrieves the minimum value of an `array`. If `callback` is provided, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index, collection). + * Retrieves the minimum value of an array. If a callback is provided it + * will be executed for each value in the array to generate the criterion by + * which the value is ranked. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3534,7 +3535,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the minimum value. @@ -3608,11 +3609,11 @@ var pluck = map; /** - * Reduces a `collection` to a value which is the accumulated result of running - * each element in the `collection` through the `callback`, where each successive - * `callback` execution consumes the return value of the previous execution. - * If `accumulator` is not provided, the first element of the `collection` will be - * used as the initial `accumulator` value. The `callback` is bound to `thisArg` + * Reduces a collection to a value which is the accumulated result of running + * each element in the collection through the callback, where each successive + * callback execution consumes the return value of the previous execution. If + * `accumulator` is not provided the first element of the collection will be + * used as the initial `accumulator` value. The callback is bound to `thisArg` * and invoked with four arguments; (accumulator, value, index|key, collection). * * @static @@ -3662,7 +3663,7 @@ } /** - * This method is like `_.reduce`, except that it iterates over elements + * This method is like `_.reduce` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -3692,13 +3693,13 @@ } /** - * The opposite of `_.filter`, this method returns the elements of a - * `collection` that `callback` does **not** return truthy for. + * The opposite of `_.filter` this method returns the elements of a + * collection that the callback does **not** return truthy for. * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3707,11 +3708,10 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that did **not** pass the - * callback check. + * @returns {Array} Returns a new array of elements that failed the callback check. * @example * * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); @@ -3738,67 +3738,8 @@ } /** - * Removes all elements from the `collection` that thw `callback` returns truthy - * for and returns an array of removed elements. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback`, the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to modify. - * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4, 5, 6]; - * var evens = _.remove(array, function(num) { return num % 2 == 0; }); - * - * console.log(array); - * // => [1, 3, 5] - * - * console.log(evens); - * // => [2, 4, 6] - */ - function remove(collection, callback, thisArg) { - var result = []; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - result.push(value); - splice.call(collection, index--, 1); - length--; - } - } - } else { - baseEach(collection, function(value, key, collection) { - if (callback(value, key, collection)) { - result.push(value); - delete collection[key]; - } - }); - } - return result; - } - - /** - * Creates an array of shuffled `array` values, using a version of the - * Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. + * Creates an array of shuffled values, using a version of the Fisher-Yates + * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. * * @static * @memberOf _ @@ -3849,15 +3790,15 @@ } /** - * 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 + * Checks if the callback returns a truthy value for **any** element of a + * collection. The function returns as soon as it finds a passing value and + * does not iterate over the entire collection. The callback is bound to * `thisArg` and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3867,7 +3808,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Boolean} Returns `true` if any element passed the callback check, @@ -3913,15 +3854,15 @@ /** * Creates an array of elements, sorted in ascending order by the results of - * running each element in the `collection` through the `callback`. This method - * performs a stable sort, that is, it will preserve the original sort order of - * equal elements. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). + * running each element in a collection through the callback. This method + * performs a stable sort, that is, it will preserve the original sort order + * of equal elements. The callback is bound to `thisArg` and invoked with + * three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3930,7 +3871,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of sorted elements. @@ -4021,8 +3962,8 @@ /*--------------------------------------------------------------------------*/ /** - * Creates an array with all falsey values of `array` removed. The values - * `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are all falsey. * * @static * @memberOf _ @@ -4094,7 +4035,7 @@ } /** - * This method is like `_.find`, except that it returns the index of the first + * This method is like `_.find` except that it returns the index of the first * element that passes the callback check, instead of the element itself. * * @static @@ -4102,7 +4043,7 @@ * @category Arrays * @param {Array} array The array to search. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the index of the found element, else `-1`. @@ -4127,7 +4068,7 @@ } /** - * This method is like `_.findIndex`, except that it iterates over elements + * This method is like `_.findIndex` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -4135,7 +4076,7 @@ * @category Arrays * @param {Array} array The array to search. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the index of the found element, else `-1`. @@ -4158,16 +4099,16 @@ } /** - * Gets the first element of the `array`. If a number `n` is provided, the first - * `n` elements of the `array` are returned. If a `callback` function is provided, - * elements at the beginning of the array are returned as long as the `callback` - * returns truthy. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index, array). + * Gets the first element of an array. If a number `n` is provided the first + * `n` elements of the array are returned. If a callback is provided elements + * at the beginning of the array are returned as long as the callback returns + * truthy. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4178,7 +4119,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n] The function called * per element or the number of elements to return. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the first element(s) of `array`. @@ -4237,15 +4178,15 @@ /** * Flattens a nested array (the nesting can be to any depth). If `isShallow` - * is truthy, `array` will only be flattened a single level. If `callback` - * is provided, each element of `array` is provided through a `callback` before - * flattening. The `callback` is bound to `thisArg` and invoked with three + * is truthy, the array will only be flattened a single level. If a callback + * is provided each element of the array is passed through the callback before + * flattening. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4255,7 +4196,7 @@ * @param {Array} array The array to flatten. * @param {Boolean} [isShallow=false] A flag to restrict flattening to a single level. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new flattened array. @@ -4291,16 +4232,16 @@ /** * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the `array` is already - * sorted, passing `true` for `fromIndex` will run a faster binary search. + * strict equality for comparisons, i.e. `===`. If the array is already sorted + * providing `true` for `fromIndex` will run a faster binary search. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to search. * @param {Mixed} value The value to search for. - * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` to - * perform a binary search on a sorted `array`. + * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. * @returns {Number} Returns the index of the matched value or `-1`. * @example * @@ -4325,16 +4266,16 @@ } /** - * Gets all but the last element of `array`. If a number `n` is provided, the - * last `n` elements are excluded from the result. If a `callback` function - * is provided, elements at the end of the array are excluded from the result - * as long as the `callback` returns truthy. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, array). + * Gets all but the last element of an array. If a number `n` is provided + * the last `n` elements are excluded from the result. If a callback is + * provided elements at the end of the array are excluded from the result + * as long as the callback returns truthy. The callback is bound to `thisArg` + * and invoked with three arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4344,7 +4285,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n=1] The function called * per element or the number of elements to exclude. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. @@ -4459,17 +4400,17 @@ } /** - * Gets the last element of the `array`. If a number `n` is provided, the - * last `n` elements of the `array` are returned. If a `callback` function - * is provided, elements at the end of the array are returned as long as the - * `callback` returns truthy. The `callback` is bound to `thisArg` and - * invoked with three arguments;(value, index, array). + * Gets the last element of an array. If a number `n` is provided the last + * `n` elements of the array are returned. If a callback is provided elements + * at the end of the array are returned as long as the callback returns truthy. + * The callback is bound to `thisArg` and invoked with three arguments; + * (value, index, array). * * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4479,7 +4420,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n] The function called * per element or the number of elements to return. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the last element(s) of `array`. @@ -4659,17 +4600,66 @@ } /** - * The opposite of `_.initial`, this method gets all but the first value of - * `array`. If a number `n` is provided, the first `n` values are excluded from - * the result. If a `callback` function is provided, elements at the beginning - * of the array are excluded from the result as long as the `callback` returns - * truthy. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index, array). + * Removes all elements from an array that the callback returns truthy for + * and returns an array of removed elements. The callback is bound to `thisArg` + * and invoked with three arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback + * will return `true` for elements that have the properties of the given object, + * else `false`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to modify. + * @param {Function|Object|String} [callback=identity] The function called + * per iteration. If a property name or object is provided it will be used + * to create a "_.pluck" or "_.where" style callback, respectively. + * @param {Mixed} [thisArg] The `this` binding of `callback`. + * @returns {Array} Returns a new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4, 5, 6]; + * var evens = _.remove(array, function(num) { return num % 2 == 0; }); + * + * console.log(array); + * // => [1, 3, 5] + * + * console.log(evens); + * // => [2, 4, 6] + */ + function remove(array, callback, thisArg) { + var index = -1, + length = array ? array.length : 0, + result = []; + + callback = lodash.createCallback(callback, thisArg, 3); + while (++index < length) { + var value = array[index]; + if (callback(value, index, array)) { + result.push(value); + splice.call(array, index--, 1); + length--; + } + } + return result; + } + + /** + * The opposite of `_.initial` this method gets all but the first value of + * an array. If a number `n` is provided the first `n` values are excluded + * from the result. If a callback function is provided elements at the beginning + * of the array are excluded from the result as long as the callback returns + * truthy. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index, array). + * + * If a property name is provided for `callback` the created "_.pluck" style + * callback will return the property value of the given element. + * + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4680,7 +4670,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n=1] The function called * per element or the number of elements to exclude. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. @@ -4733,16 +4723,16 @@ } /** - * 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 provided, it will be executed for `value` - * and each element in `array` to compute their sort ranking. The `callback` - * is bound to `thisArg` and invoked with one argument; (value). + * Uses a binary search to determine the smallest index at which a value + * should be inserted into a given sorted array in order to maintain the sort + * order of the array. If a callback is provided it will be executed for + * `value` and each element of `array` to compute their sort ranking. The + * callback is bound to `thisArg` and invoked with one argument; (value). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4752,10 +4742,10 @@ * @param {Array} array The array to inspect. * @param {Mixed} value The value to evaluate. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Number} Returns the index at which the value should be inserted + * @returns {Number} Returns the index at which `value` should be inserted * into `array`. * @example * @@ -4816,17 +4806,17 @@ } /** - * Creates a duplicate-value-free version of the `array` using strict equality - * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` - * for `isSorted` will run a faster algorithm. If `callback` is provided, each - * element of `array` is provided through the `callback` before uniqueness is - * computed. The `callback` is bound to `thisArg` and invoked with three arguments; - * (value, index, array). + * Creates a duplicate-value-free version of an array using strict equality + * for comparisons, i.e. `===`. If the array is sorted, providing + * `true` for `isSorted` will use a faster algorithm. If a callback is provided + * each element of `array` is passed through the callback before uniqueness + * is computed. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4835,9 +4825,9 @@ * @alias unique * @category Arrays * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. + * @param {Boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a duplicate-value-free array. @@ -4920,9 +4910,9 @@ } /** - * Creates an object composed from arrays of `keys` and `values`. Pass either - * a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or - * two arrays, one of `keys` and one of corresponding `values`. + * Creates an object composed from arrays of `keys` and `values`. Provide + * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` + * or two arrays, one of `keys` and one of corresponding `values`. * * @static * @memberOf _ @@ -4956,7 +4946,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a function this is restricted to executing `func`, with the `this` + * Creates a function this is restricted to executing `func` with the `this` * binding and arguments of the created function, only after it is called `n` times. * * @static @@ -5009,10 +4999,10 @@ } /** - * Binds methods on `object` to `object`, overwriting the existing method. - * Method names may be specified as individual arguments or as arrays of method - * names. If no method names are provided, all the function properties of `object` - * will be bound. + * Binds methods of an object to the object itself, overwriting the existing + * method. Method names may be specified as individual arguments or as arrays + * of method names. If no method names are provided all the function properties + * of `object` will be bound. * * @static * @memberOf _ @@ -5127,8 +5117,8 @@ /** * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name, the created callback will return the property value for a given element. - * If `func` is an object, the created callback will return `true` for elements + * name the created callback will return the property value for a given element. + * If `func` is an object the created callback will return `true` for elements * that contain the equivalent object properties, otherwise it will return `false`. * * @static @@ -5173,7 +5163,7 @@ // handle "_.where" style callback shorthands if (props.length == 1 && a === a && !isObject(a)) { - // fast path the common case of passing an object with a single + // fast path the common case of providing an object with a single // property containing a primitive value return function(object) { var b = object[key]; @@ -5195,12 +5185,12 @@ /** * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. Pass - * an `options` object to indicate that `func` should be invoked on the leading - * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced - * function will return the result of the last `func` call. + * `wait` milliseconds have elapsed since the last time it was invoked. + * Provide an options object to indicate that `func` should be invoked on + * the leading and/or trailing edge of the `wait` timeout. Subsequent calls + * to the debounced function will return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true`, `func` will be called + * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * @@ -5362,7 +5352,7 @@ /** * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it will be used to determine the cache key for storing the result + * provided it will be used to determine the cache key for storing the result * based on the arguments provided to the memoized function. By default, the * first argument provided to the memoized function is used as the cache key. * The `func` is executed with the `this` binding of the memoized function. @@ -5430,7 +5420,7 @@ /** * Creates a function that, when called, invokes `func` with any additional * `partial` arguments prepended to those provided to the new function. This - * method is similar to `_.bind`, except it does **not** alter the `this` binding. + * method is similar to `_.bind` except it does **not** alter the `this` binding. * * @static * @memberOf _ @@ -5450,7 +5440,7 @@ } /** - * This method is like `_.partial`, except that `partial` arguments are + * This method is like `_.partial` except that `partial` arguments are * appended to those provided to the new function. * * @static @@ -5482,12 +5472,12 @@ /** * Creates a function that, when executed, will only call the `func` function - * at most once per every `wait` milliseconds. Pass an `options` object to + * at most once per every `wait` milliseconds. Provide an options object to * indicate that `func` should be invoked on the leading and/or trailing edge * of the `wait` timeout. Subsequent calls to the throttled function will * return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true`, `func` will be called + * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * @@ -5532,9 +5522,9 @@ } /** - * Creates a function that passes `value` to the `wrapper` function as its + * Creates a function that provides `value` to the wrapper function as its * first argument. Additional arguments provided to the function are appended - * to those provided to the `wrapper` function. The `wrapper` is executed with + * to those provided to the wrapper function. The wrapper is executed with * the `this` binding of the created function. * * @static @@ -5599,13 +5589,14 @@ } /** - * Adds functions properties of `object` to the `lodash` function and chainable - * wrapper. + * Adds function properties of a source object to the `lodash` function and + * chainable wrapper. * * @static * @memberOf _ * @category Utilities * @param {Object} object The object of function properties to add to `lodash`. + * @param {Object} object The object of function properties to add to `lodash`. * @example * * _.mixin({ @@ -5665,7 +5656,7 @@ /** * Converts the given `value` into an integer of the specified `radix`. - * If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the + * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the * `value` is a hexadecimal, in which case a `radix` of `16` is used. * * Note: This method avoids differences in native ES3 and ES5 `parseInt` @@ -5689,7 +5680,7 @@ /** * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided, a number between `0` and the given number will be + * argument is provided a number between `0` and the given number will be * returned. * * @static @@ -5724,9 +5715,9 @@ } /** - * Resolves the value of `property` on `object`. If `property` is a function, + * Resolves the value of `property` on `object`. If `property` is a function * it will be invoked with the `this` binding of `object` and its result returned, - * else the property value is returned. If `object` is falsey, then `undefined` + * else the property value is returned. If `object` is falsey then `undefined` * is returned. * * @static @@ -5944,8 +5935,8 @@ } /** - * Executes the `callback` function `n` times, returning an array of the results - * of each `callback` execution. The `callback` is bound to `thisArg` and invoked + * Executes the callback `n` times, returning an array of the results + * of each callback execution. The callback is bound to `thisArg` and invoked * with one argument; (index). * * @static @@ -5979,7 +5970,7 @@ } /** - * The inverse of `_.escape`, this method converts the HTML entities + * The inverse of `_.escape` this method converts the HTML entities * `&`, `<`, `>`, `"`, and `'` in `string` to their * corresponding characters. * @@ -5998,7 +5989,7 @@ } /** - * Generates a unique ID. If `prefix` is provided, the ID will be appended to it. + * Generates a unique ID. If `prefix` is provided the ID will be appended to it. * * @static * @memberOf _ @@ -6049,14 +6040,15 @@ } /** - * 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. + * Invokes `interceptor` with the `value` as the first argument and then + * returns `value`. The purpose of this method is to "tap into" a method + * chain in order to perform operations on intermediate results within + * the chain. * * @static * @memberOf _ * @category Chaining - * @param {Mixed} value The value to pass to `interceptor`. + * @param {Mixed} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {Mixed} Returns `value`. * @example diff --git a/dist/lodash.compat.min.js b/dist/lodash.compat.min.js index 444be3d29..707e20af1 100644 --- a/dist/lodash.compat.min.js +++ b/dist/lodash.compat.min.js @@ -12,8 +12,8 @@ if(i!=H||!$e.nodeClass&&(l(n)||l(t)))return b;var i=!$e.argsObject&>(n)?Zt:n.constructor,p=!$e.argsObject&>(t)?Zt:t.constructor;if(i!=p&&(!mt(i)||!(i instanceof i&&mt(p)&&p instanceof p)))return b}for(p=!u,u||(u=f()),o||(o=f()),i=u.length;i--;)if(u[i]==n)return o[i]==t;var g=0,a=m;if(u.push(n),o.push(t),c){if(i=n.length,g=t.length,a=g==n.length,!a&&!r)return a;for(;g--;)if(c=i,p=t[g],r)for(;c--&&!(a=tt(n[c],p,e,r,u,o)););else if(!(a=tt(n[g],p,e,r,u,o)))break;return a}return Xe(t,function(t,i,f){return ve.call(f,i)?(g++,a=ve.call(n,i)&&tt(n[i],t,e,r,u,o)):void 0 }),a&&!r&&Xe(n,function(n,t,e){return ve.call(e,t)?a=-1<--g:void 0}),p&&(s(u),s(o)),a}function rt(n,t,e,r,u){(ze(t)?Et:Ye)(t,function(t,o){var a,i,f=t,c=n[o];if(t&&((i=ze(t))||Ze(t))){for(f=r.length;f--;)if(a=r[f]==t){c=u[f];break}if(!a){var l;e&&(f=e(c,t),l=typeof f!="undefined")&&(c=f),l||(c=i?ze(c)?c:[]:Ze(c)?c:{}),r.push(t),u.push(c),l||rt(c,t,e,r,u)}}else e&&(f=e(c,t),typeof f=="undefined"&&(f=t)),typeof f!="undefined"&&(c=f);n[o]=c})}function ut(n,r,u){var o=-1,i=lt(),c=n?n.length:0,l=[],p=!r&&c>=E&&i===t,v=u||p?f():l; if(p){var h=a(v);h?(i=e,v=h):(p=b,v=u?v:(s(v),l))}for(;++oi(v,y))&&((u||p)&&v.push(y),l.push(h))}return p?(s(v.b),g(v)):u&&s(v),l}function ot(n){return function(t,e,r){var u={};return e=_.createCallback(e,r,3),Et(t,function(t,r,o){r=te(e(t,r,o)),n(u,t,r,o)}),u}}function at(n,t,e,r,u,o){var a=o&&!u;if(!mt(n)&&!a)throw new ee;if(u||o||r.length||!($e.fastBind||we&&e.length))i=function(){var o=arguments,c=u?this:t;return a&&(n=t[f]),(e.length||r.length)&&(je.apply(o,e),he.apply(o,r)),this instanceof i?(c=ft(n.prototype),o=n.apply(c,o),dt(o)?o:c):n.apply(c,o) -};else{o=[n,t],he.apply(o,e);var i=we.call.apply(we,o)}if(a){var f=t;t=n}return i}function it(){var n=c();n.h=L,n.b=n.c=n.g=n.i="",n.e="t",n.j=m;for(var t,e=0;t=arguments[e];e++)for(var r in t)n[r]=t[r];e=n.a,n.d=/^[^,]+/.exec(e)[0],t=Qt,e="return function("+e+"){",r="var n,t="+n.d+",E="+n.e+";if(!t)return E;"+n.i+";",n.b?(r+="var u=t.length;n=-1;if("+n.b+"){",$e.unindexedChars&&(r+="if(s(t)){t=t.split('')}"),r+="while(++nk;k++)r+="n='"+n.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",n.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+n.g+"}"; +};else{o=[n,t],he.apply(o,e);var i=we.call.apply(we,o)}if(a){var f=t;t=n}return i}function it(){var n=c();n.h=L,n.b=n.c=n.g=n.i="",n.e="t",n.j=m;for(var t,e=0;t=arguments[e];e++)for(var r in t)n[r]=t[r];e=n.a,n.d=/^[^,]+/.exec(e)[0],t=Qt,e="return function("+e+"){",r="var n,t="+n.d+",E="+n.e+";if(!t)return E;"+n.i+";",n.b?(r+="var u=t.length;n=-1;if("+n.b+"){",$e.unindexedChars&&(r+="if(s(t)){t=t.split('')}"),r+="while(++nk;k++)r+="n='"+n.h[k]+"';if((!(r&&x[n])&&m.call(t,n))",n.j||(r+="||(!x[n]&&t[n]!==A[n])"),r+="){"+n.g+"}"; r+="}"}return(n.b||$e.nonEnumArgs)&&(r+="}"),r+=n.c+";return E",t=t("d,j,k,m,o,p,q,s,v,A,B,y,I,J,L",e+r+"}"),g(n),t(Y,G,ue,ve,x,gt,ze,_t,n.f,oe,X,De,V,ae,_e)}function ft(n){return dt(n)?ke(n):{}}function ct(n){return Ge[n]}function lt(){var n=(n=_.indexOf)===Rt?t:n;return n}function pt(n){var t,e;return!n||_e.call(n)!=H||(t=n.constructor,mt(t)&&!(t instanceof t))||!$e.argsClass&>(n)||!$e.nodeClass&&l(n)?b:$e.ownLast?(Xe(n,function(n,t,r){return e=ve.call(r,t),b}),e!==false):(Xe(n,function(n,t){e=t }),e===y||ve.call(n,e))}function st(n){return Je[n]}function gt(n){return n&&typeof n=="object"?_e.call(n)==T:b}function vt(n,t,e){var r=Te(n),u=r.length;for(t=Y(t,e,3);u--&&(e=r[u],!(t(n[e],e,n)===false)););return n}function ht(n){var t=[];return Xe(n,function(n,e){mt(n)&&t.push(e)}),t.sort()}function yt(n){for(var t=-1,e=Te(n),r=e.length,u={};++te?Se(0,o+e):e)||0,o&&typeof o=="number"?a=-1<(_t(n)?n.indexOf(t,e):u(n,t,e)):Ue(n,function(n){return++rr(a,e))&&(o[e]=n)}),o},_.once=function(n){var t,e;return function(){return t?e:(t=m,e=n.apply(this,arguments),n=d,e)}},_.pairs=function(n){for(var t=-1,e=Te(n),r=e.length,u=Ht(r);++te?Se(0,r+e):Ae(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},_.mixin=Jt,_.noConflict=function(){return r._=ie,this},_.parseInt=ur,_.random=function(n,t){n==d&&t==d&&(t=1),n=+n||0,t==d?(t=n,n=0):t=+t||0;var e=Be();return n%1||t%1?n+Ae(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+se(e*(t-n+1))},_.reduce=It,_.reduceRight=Bt,_.result=function(n,t){var e=n?n[t]:y; -return mt(e)?n[t]():e},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Te(n).length},_.some=Pt,_.sortedIndex=$t,_.template=function(n,t,e){var r=_.templateSettings;n||(n=""),e=Qe({},e,r);var u,o=Qe({},e.imports,r.imports),r=Te(o),o=jt(o),a=0,f=e.interpolate||D,c="__p+='",f=ne((e.escape||D).source+"|"+f.source+"|"+(f===F?P:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(f,function(t,e,r,o,f,l){return r||(r=o),c+=n.slice(a,l).replace($,i),e&&(c+="'+__e("+e+")+'"),f&&(u=m,c+="';"+f+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),a=l+t.length,t -}),c+="';\n",f=e=e.variable,f||(e="obj",c="with("+e+"){"+c+"}"),c=(u?c.replace(A,""):c).replace(I,"$1").replace(B,"$1;"),c="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var l=Qt(r,"return "+c).apply(y,o)}catch(p){throw p.source=c,p}return t?l(t):(l.source=c,l)},_.unescape=function(n){return n==d?"":te(n).replace(Me,st)},_.uniqueId=function(n){var t=++w;return te(n==d?"":n)+t -},_.all=kt,_.any=Pt,_.detect=Ct,_.findWhere=Ct,_.foldl=It,_.foldr=Bt,_.include=wt,_.inject=It,Ye(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return he.apply(t,arguments),t=n.apply(_,t),e?new j(t,e):t})}),_.first=Ft,_.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=d){var o=u;for(t=_.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,r==d||e)return n[u-1];return v(n,Se(0,u-r))}},_.take=Ft,_.head=Ft,Ye(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,e){var r=this.__chain__,u=n(this.__wrapped__,t,e); -return!r&&(t==d||e&&typeof t!="function")?u:new j(u,r)})}),_.VERSION="1.3.1",_.prototype.chain=function(){return this.__chain__=m,this},_.prototype.toString=function(){return te(this.__wrapped__)},_.prototype.value=Mt,_.prototype.valueOf=Mt,Ue(["join","pop","shift"],function(n){var t=re[n];_.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new j(e,n):e}}),Ue(["push","reverse","sort","unshift"],function(n){var t=re[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this -}}),Ue(["concat","slice","splice"],function(n){var t=re[n];_.prototype[n]=function(){return new j(t.apply(this.__wrapped__,arguments),this.__chain__)}}),$e.spliceObjects||Ue(["pop","shift","splice"],function(n){var t=re[n],e="splice"==n;_.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments);return 0===r.length&&delete r[0],n||e?new j(u,n):u}}),_}var y,m=!0,d=null,b=!1,_=[],j=[],w=0,x={},C=+new Date+"",E=75,O=40,S=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",A=/\b__p\+='';/g,I=/\b(__p\+=)''\+/g,B=/(__e\(.*?\)|\b__t\))\+'';/g,P=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,N=/\w*$/,F=/<%=([\s\S]+?)%>/g,R=RegExp("^["+S+"]*0+(?=.$)"),D=/($^)/,$=/['\n\r\t\u2028\u2029\\]/g,z="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),T="[object Arguments]",q="[object Array]",K="[object Boolean]",W="[object Date]",G="[object Error]",J="[object Function]",M="[object Number]",H="[object Object]",U="[object RegExp]",V="[object String]",Q={}; +})},_.remove=function(n,t,e){var r=-1,u=n?n.length:0,o=[];for(t=_.createCallback(t,e,3);++re?Se(0,r+e):Ae(e,r-1))+1);r--;)if(n[r]===t)return r; +return-1},_.mixin=Jt,_.noConflict=function(){return r._=ie,this},_.parseInt=ur,_.random=function(n,t){n==d&&t==d&&(t=1),n=+n||0,t==d?(t=n,n=0):t=+t||0;var e=Be();return n%1||t%1?n+Ae(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+se(e*(t-n+1))},_.reduce=It,_.reduceRight=Bt,_.result=function(n,t){var e=n?n[t]:y;return mt(e)?n[t]():e},_.runInContext=h,_.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:Te(n).length},_.some=Pt,_.sortedIndex=$t,_.template=function(n,t,e){var r=_.templateSettings; +n||(n=""),e=Qe({},e,r);var u,o=Qe({},e.imports,r.imports),r=Te(o),o=jt(o),a=0,f=e.interpolate||D,c="__p+='",f=ne((e.escape||D).source+"|"+f.source+"|"+(f===F?P:D).source+"|"+(e.evaluate||D).source+"|$","g");n.replace(f,function(t,e,r,o,f,l){return r||(r=o),c+=n.slice(a,l).replace($,i),e&&(c+="'+__e("+e+")+'"),f&&(u=m,c+="';"+f+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),a=l+t.length,t}),c+="';\n",f=e=e.variable,f||(e="obj",c="with("+e+"){"+c+"}"),c=(u?c.replace(A,""):c).replace(I,"$1").replace(B,"$1;"),c="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}"; +try{var l=Qt(r,"return "+c).apply(y,o)}catch(p){throw p.source=c,p}return t?l(t):(l.source=c,l)},_.unescape=function(n){return n==d?"":te(n).replace(Me,st)},_.uniqueId=function(n){var t=++w;return te(n==d?"":n)+t},_.all=kt,_.any=Pt,_.detect=Ct,_.findWhere=Ct,_.foldl=It,_.foldr=Bt,_.include=wt,_.inject=It,Ye(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return he.apply(t,arguments),t=n.apply(_,t),e?new j(t,e):t})}),_.first=Ft,_.last=function(n,t,e){if(n){var r=0,u=n.length; +if(typeof t!="number"&&t!=d){var o=u;for(t=_.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,r==d||e)return n[u-1];return v(n,Se(0,u-r))}},_.take=Ft,_.head=Ft,Ye(_,function(n,t){_.prototype[t]||(_.prototype[t]=function(t,e){var r=this.__chain__,u=n(this.__wrapped__,t,e);return!r&&(t==d||e&&typeof t!="function")?u:new j(u,r)})}),_.VERSION="1.3.1",_.prototype.chain=function(){return this.__chain__=m,this},_.prototype.toString=function(){return te(this.__wrapped__)},_.prototype.value=Mt,_.prototype.valueOf=Mt,Ue(["join","pop","shift"],function(n){var t=re[n]; +_.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new j(e,n):e}}),Ue(["push","reverse","sort","unshift"],function(n){var t=re[n];_.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ue(["concat","slice","splice"],function(n){var t=re[n];_.prototype[n]=function(){return new j(t.apply(this.__wrapped__,arguments),this.__chain__)}}),$e.spliceObjects||Ue(["pop","shift","splice"],function(n){var t=re[n],e="splice"==n;_.prototype[n]=function(){var n=this.__chain__,r=this.__wrapped__,u=t.apply(r,arguments); +return 0===r.length&&delete r[0],n||e?new j(u,n):u}}),_}var y,m=!0,d=null,b=!1,_=[],j=[],w=0,x={},C=+new Date+"",E=75,O=40,S=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",A=/\b__p\+='';/g,I=/\b(__p\+=)''\+/g,B=/(__e\(.*?\)|\b__t\))\+'';/g,P=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,N=/\w*$/,F=/<%=([\s\S]+?)%>/g,R=RegExp("^["+S+"]*0+(?=.$)"),D=/($^)/,$=/['\n\r\t\u2028\u2029\\]/g,z="Array Boolean Date Error Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),L="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),T="[object Arguments]",q="[object Array]",K="[object Boolean]",W="[object Date]",G="[object Error]",J="[object Function]",M="[object Number]",H="[object Object]",U="[object RegExp]",V="[object String]",Q={}; Q[J]=b,Q[T]=Q[q]=Q[K]=Q[W]=Q[M]=Q[H]=Q[U]=Q[V]=m;var X={"boolean":b,"function":m,object:m,number:b,string:b,undefined:b},Y={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},Z=X[typeof exports]&&exports,nt=X[typeof module]&&module&&module.exports==Z&&module,tt=X[typeof global]&&global;!tt||tt.global!==tt&&tt.window!==tt||(n=tt);var et=h();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=et, define(function(){return et})):Z&&!Z.nodeType?nt?(nt.exports=et)._=et:Z._=et:n._=et }(this); \ No newline at end of file diff --git a/dist/lodash.js b/dist/lodash.js index ea8f2e21c..5280188bb 100644 --- a/dist/lodash.js +++ b/dist/lodash.js @@ -125,7 +125,7 @@ /** Detect free variable `module` */ var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module; - /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ + /** Detect free variable `global` from Node.js or Browserified code and use it as `window` */ var freeGlobal = objectTypes[typeof global] && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { window = freeGlobal; @@ -210,8 +210,8 @@ } /** - * Used by `_.max` and `_.min` as the default `callback` when a given - * `collection` is a string value. + * Used by `_.max` and `_.min` as the default callback when a given + * collection is a string value. * * @private * @param {String} value The character to inspect. @@ -342,7 +342,7 @@ } /** - * Releases the given `array` back to the array pool. + * Releases the given array back to the array pool. * * @private * @param {Array} [array] The array to release. @@ -355,7 +355,7 @@ } /** - * Releases the given `object` back to the object pool. + * Releases the given object back to the object pool. * * @private * @param {Object} [object] The object to release. @@ -375,7 +375,7 @@ * Slices the `collection` from the `start` index up to, but not including, * the `end` index. * - * Note: This function is used, instead of `Array#slice`, to support node lists + * Note: This function is used instead of `Array#slice` to support node lists * in IE < 9 and to ensure dense arrays are returned. * * @private @@ -496,7 +496,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a `lodash` object, which wraps the given `value`, to enable method + * Creates a `lodash` object which wraps the given value to enable method * chaining. * * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: @@ -793,7 +793,7 @@ } /** - * The base implementation of `_.flatten` without support for `callback` + * The base implementation of `_.flatten` without support for callback * shorthands or `thisArg` binding. * * @private @@ -831,7 +831,7 @@ * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. * @param {Array} [stackA=[]] Tracks traversed `a` objects. * @param {Array} [stackB=[]] Tracks traversed `b` objects. - * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`. + * @returns {Boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { // used to indicate that when comparing objects, `a` has at least the properties of `b` @@ -855,7 +855,7 @@ !(b && objectTypes[otherType])) { return false; } - // exit early for `null` and `undefined`, avoiding ES3's Function#call behavior + // exit early for `null` and `undefined` avoiding ES3's Function#call behavior // http://es5.github.io/#x15.3.4.4 if (a == null || b == null) { return a === b; @@ -877,7 +877,7 @@ case boolClass: case dateClass: // coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0`, treating invalid dates coerced to `NaN` as not equal + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal return +a == +b; case numberClass: @@ -1055,12 +1055,12 @@ } /** - * The base implementation of `_.uniq` without support for `callback` shorthands + * The base implementation of `_.uniq` without support for callback shorthands * or `thisArg` binding. * * @private * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. + * @param {Boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function} [callback] The function called per iteration. * @returns {Array} Returns a duplicate-value-free array. */ @@ -1256,14 +1256,14 @@ }; /** - * A fallback implementation of `isPlainObject` which checks if a given `value` + * A fallback implementation of `isPlainObject` which checks if a given value * is an object created by the `Object` constructor, assuming objects created * by the `Object` constructor have no inherited enumerable properties and that * there are no `Object.prototype` extensions. * * @private * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. + * @returns {Boolean} Returns `true` if `value` is a plain object, else `false`. */ function shimIsPlainObject(value) { var ctor, @@ -1303,7 +1303,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an `arguments` object, else `false`. * @example * * (function() { return _.isArguments(arguments); })(1, 2, 3); @@ -1324,7 +1324,7 @@ * @type Function * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an array, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an array, else `false`. * @example * * (function() { return _.isArray(arguments); })(); @@ -1357,7 +1357,7 @@ }; /** - * Creates an array composed of the own enumerable property names of `object`. + * Creates an array composed of the own enumerable property names of an object. * * @static * @memberOf _ @@ -1404,9 +1404,9 @@ /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources will overwrite property assignments of previous - * sources. If a `callback` function is provided, it will be executed to produce - * the assigned values. The `callback` is bound to `thisArg` and invoked with - * two arguments; (objectValue, sourceValue). + * sources. If a callback is provided it will be executed to produce the + * assigned values. The callback is bound to `thisArg` and invoked with two + * arguments; (objectValue, sourceValue). * * @static * @memberOf _ @@ -1459,11 +1459,11 @@ }; /** - * Creates a clone of `value`. If `deep` is `true`, nested objects will also - * be cloned, otherwise they will be assigned by reference. If a `callback` - * function is provided, it will be executed to produce the cloned values. If - * `callback` returns `undefined`, cloning will be handled by the method instead. - * The `callback` is bound to `thisArg` and invoked with one argument; (value). + * Creates a clone of `value`. If `deep` is `true` nested objects will also + * be cloned, otherwise they will be assigned by reference. If a callback + * is provided it will be executed to produce the cloned values. If the + * callback returns `undefined` cloning will be handled by the method instead. + * The callback is bound to `thisArg` and invoked with one argument; (value). * * @static * @memberOf _ @@ -1510,10 +1510,10 @@ } /** - * Creates a deep clone of `value`. If a `callback` function is provided, - * it will be executed to produce the cloned values. If `callback` returns - * `undefined`, cloning will be handled by the method instead. The `callback` - * is bound to `thisArg` and invoked with one argument; (value). + * Creates a deep clone of `value`. If a callback is provided it will be + * executed to produce the cloned values. If the callback returns `undefined` + * cloning will be handled by the method instead. The callback is bound to + * `thisArg` and invoked with one argument; (value). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and @@ -1597,7 +1597,7 @@ }; /** - * This method is like `_.findIndex`, except that it returns the key of the + * This method is like `_.findIndex` except that it returns the key of the * first element that passes the callback check, instead of the element itself. * * @static @@ -1605,7 +1605,7 @@ * @category Objects * @param {Object} object The object to search. * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is provided, it will be used to + * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the key of the found element, else `undefined`. @@ -1629,7 +1629,7 @@ } /** - * This method is like `_.findKey`, except that it iterates over elements + * This method is like `_.findKey` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -1637,7 +1637,7 @@ * @category Objects * @param {Object} object The object to search. * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is provided, it will be used to + * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the key of the found element, else `undefined`. @@ -1661,10 +1661,10 @@ } /** - * Iterates over own and inherited enumerable properties of a given `object`, - * executing the `callback` for each property. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. + * Iterates over own and inherited enumerable properties of an object, + * executing the callback for each property. The callback is bound to `thisArg` + * and invoked with three arguments; (value, key, object). Callbacks may exit + * iteration early by explicitly returning `false`. * * @static * @memberOf _ @@ -1701,7 +1701,7 @@ }; /** - * This method is like `_.forIn`, except that it iterates over elements + * This method is like `_.forIn` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -1744,10 +1744,10 @@ } /** - * Iterates over own enumerable properties of a given `object`, executing the - * `callback` for each property. The `callback` is bound to `thisArg` and - * invoked with three arguments; (value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. + * Iterates over own enumerable properties of an object, executing the callback + * for each property. The callback is bound to `thisArg` and invoked with three + * arguments; (value, key, object). Callbacks may exit iteration early by + * explicitly returning `false`. * * @static * @memberOf _ @@ -1781,7 +1781,7 @@ }; /** - * This method is like `_.forOwn`, except that it iterates over elements + * This method is like `_.forOwn` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -1857,7 +1857,7 @@ } /** - * Creates an object composed of the inverted keys and values of the given `object`. + * Creates an object composed of the inverted keys and values of the given object. * * @static * @memberOf _ @@ -1889,7 +1889,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a boolean value, else `false`. * @example * * _.isBoolean(null); @@ -1906,7 +1906,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a date, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a date, else `false`. * @example * * _.isDate(new Date); @@ -1923,7 +1923,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); @@ -1942,7 +1942,7 @@ * @memberOf _ * @category Objects * @param {Array|Object|String} value The value to inspect. - * @returns {Boolean} Returns `true`, if the `value` is empty, else `false`. + * @returns {Boolean} Returns `true` if the `value` is empty, else `false`. * @example * * _.isEmpty([1, 2, 3]); @@ -1974,10 +1974,10 @@ /** * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If `callback` is provided, it will be executed to - * compare values. If `callback` returns `undefined`, comparisons will be handled - * by the method instead. The `callback` is bound to `thisArg` and invoked with - * two arguments; (a, b). + * equivalent to each other. If a callback is provided it will be executed + * to compare values. If the callback returns `undefined` comparisons will + * be handled by the method instead. The callback is bound to `thisArg` and + * invoked with two arguments; (a, b). * * @static * @memberOf _ @@ -1986,7 +1986,7 @@ * @param {Mixed} b The other value to compare. * @param {Function} [callback] The function to customize comparing values. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`. + * @returns {Boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var moe = { 'name': 'moe', 'age': 40 }; @@ -2017,14 +2017,14 @@ /** * Checks if `value` is, or can be coerced to, a finite number. * - * Note: This is not the same as native `isFinite`, which will return true for + * Note: This is not the same as native `isFinite` which will return true for * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is finite, else `false`. + * @returns {Boolean} Returns `true` if the `value` is finite, else `false`. * @example * * _.isFinite(-101); @@ -2053,7 +2053,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a function, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -2071,7 +2071,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an object, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an object, else `false`. * @example * * _.isObject({}); @@ -2094,14 +2094,14 @@ /** * Checks if `value` is `NaN`. * - * Note: This is not the same as native `isNaN`, which will return `true` for + * Note: This is not the same as native `isNaN` which will return `true` for * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); @@ -2129,7 +2129,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `null`, else `false`. * @example * * _.isNull(null); @@ -2151,7 +2151,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a number, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a number, else `false`. * @example * * _.isNumber(8.4 * 5); @@ -2162,13 +2162,13 @@ } /** - * Checks if a given `value` is an object created by the `Object` constructor. + * Checks if `value` is an object created by the `Object` constructor. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. + * @returns {Boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Stooge(name, age) { @@ -2204,7 +2204,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a regular expression, else `false`. * @example * * _.isRegExp(/moe/); @@ -2221,7 +2221,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a string, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a string, else `false`. * @example * * _.isString('moe'); @@ -2238,7 +2238,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); @@ -2250,11 +2250,11 @@ /** * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined`, into the destination object. Subsequent sources - * will overwrite property assignments of previous sources. If a `callback` function - * is provided, it will be executed to produce the merged values of the destination - * and source properties. If `callback` returns `undefined`, merging will be - * handled by the method instead. The `callback` is bound to `thisArg` and + * don't resolve to `undefined` into the destination object. Subsequent sources + * will overwrite property assignments of previous sources. If a callback is + * provided it will be executed to produce the merged values of the destination + * and source properties. If the callback returns `undefined` merging will + * be handled by the method instead. The callback is bound to `thisArg` and * invoked with two arguments; (objectValue, sourceValue). * * @static @@ -2332,10 +2332,10 @@ /** * Creates a shallow clone of `object` excluding the specified properties. * Property names may be specified as individual arguments or as arrays of - * property names. If a `callback` function is provided, it will be executed - * for each property in the `object`, omitting the properties `callback` - * returns truthy for. The `callback` is bound to `thisArg` and invoked - * with three arguments; (value, key, object). + * property names. If a callback is provided it will be executed for each + * property of `object` omitting the properties the callback returns truthy + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). * * @static * @memberOf _ @@ -2377,7 +2377,7 @@ } /** - * Creates a two dimensional array of the given object's key-value pairs, + * Creates a two dimensional array of an object's key-value pairs, * i.e. `[[key1, value1], [key2, value2]]`. * * @static @@ -2405,10 +2405,11 @@ /** * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of property - * names. If `callback` is provided, it will be executed for each property in the - * `object`, picking the properties `callback` returns truthy for. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, key, object). + * Property names may be specified as individual arguments or as arrays of + * property names. If a callback is provided it will be executed for each + * property of `object` picking the properties the callback returns truthy + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). * * @static * @memberOf _ @@ -2454,10 +2455,10 @@ } /** - * An alternative to `_.reduce`, this method transforms an `object` to a new + * An alternative to `_.reduce` this method transforms `object` to a new * `accumulator` object which is the result of running each of its elements - * through the `callback`, with each `callback` execution potentially mutating - * the `accumulator` object. The `callback` is bound to `thisArg` and invoked + * through a callback, with each callback execution potentially mutating + * the `accumulator` object. The callback is bound to `thisArg` and invoked * with four arguments; (accumulator, value, key, object). Callbacks may exit * iteration early by explicitly returning `false`. * @@ -2565,9 +2566,9 @@ } /** - * Checks if a given `target` element is present in a `collection` using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. + * Checks if a given value is present in a collection using strict equality + * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the + * offset from the end of the collection. * * @static * @memberOf _ @@ -2615,15 +2616,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the given `callback`. The corresponding - * value of each key is the number of times the key was returned by the `callback`. - * The `callback` is bound to `thisArg` and invoked with three arguments; + * each element of `collection` through the callback. The corresponding value + * of each key is the number of times the key was returned by the callback. + * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2632,7 +2633,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -2652,14 +2653,14 @@ }); /** - * Checks if the `callback` returns a truthy value for **all** elements of a - * `collection`. The `callback` is bound to `thisArg` and invoked with three + * Checks if the given callback returns truthy value for **all** elements of + * a collection. The callback is bound to `thisArg` and invoked with three * arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2669,7 +2670,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Boolean} Returns `true` if all elements passed the callback check, @@ -2714,14 +2715,14 @@ } /** - * Iterates over elements of a `collection`, returning an array of all elements - * the `callback` returns truthy for. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index|key, collection). + * Iterates over elements of a collection, returning an array of all elements + * the callback returns truthy for. The callback is bound to `thisArg` and + * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2731,7 +2732,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of elements that passed the callback check. @@ -2778,14 +2779,14 @@ } /** - * Iterates over elements of a `collection`, returning the first that the - * `callback` returns truthy for. The `callback` is bound to `thisArg` and + * Iterates over elements of a collection, returning the first element that + * the callback returns truthy for. The callback is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2795,7 +2796,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the found element, else `undefined`. @@ -2846,7 +2847,7 @@ } /** - * This method is like `_.find`, except that it iterates over elements + * This method is like `_.find` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -2854,7 +2855,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the found element, else `undefined`. @@ -2878,10 +2879,10 @@ } /** - * Iterates over elements of a `collection`, executing the `callback` for - * each element. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). Callbacks may exit iteration - * early by explicitly returning `false`. + * Iterates over elements of a collection, executing the callback for each + * element. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). Callbacks may exit iteration early by + * explicitly returning `false`. * * @static * @memberOf _ @@ -2917,7 +2918,7 @@ } /** - * This method is like `_.forEach`, except that it iterates over elements + * This method is like `_.forEach` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -2951,15 +2952,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the `callback`. The corresponding - * value of each key is an array of the elements responsible for generating - * the key. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). + * each element of a collection through the callback. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false` * @@ -2968,7 +2969,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -2990,15 +2991,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the given `callback`. The corresponding + * each element of the collection through the given callback. The corresponding * value of each key is the last element responsible for generating the key. - * The `callback` is bound to `thisArg` and invoked with three arguments; + * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3007,7 +3008,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -3032,10 +3033,10 @@ }); /** - * Invokes the method named by `methodName` on each element in the `collection`, + * Invokes the method named by `methodName` on each element in the `collection` * returning an array of the results of each invoked method. Additional arguments - * will be provided to each invoked method. If `methodName` is a function, it will - * be invoked for, and `this` bound to, each element in the `collection`. + * will be provided to each invoked method. If `methodName` is a function it + * will be invoked for, and `this` bound to, each element in the `collection`. * * @static * @memberOf _ @@ -3067,14 +3068,14 @@ } /** - * Creates an array of values by running each element in the `collection` - * through the `callback`. The `callback` is bound to `thisArg` and invoked with + * Creates an array of values by running each element in the collection + * through the callback. The callback is bound to `thisArg` and invoked with * three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3084,7 +3085,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of the results of each `callback` execution. @@ -3125,15 +3126,15 @@ } /** - * Retrieves the maximum value of an `array`. If `callback` is provided, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, collection). + * Retrieves the maximum value of an array. If a callback is provided it + * will be executed for each value in the array to generate the criterion by + * which the value is ranked. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3142,7 +3143,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the maximum value. @@ -3194,15 +3195,15 @@ } /** - * Retrieves the minimum value of an `array`. If `callback` is provided, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index, collection). + * Retrieves the minimum value of an array. If a callback is provided it + * will be executed for each value in the array to generate the criterion by + * which the value is ranked. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3211,7 +3212,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the minimum value. @@ -3296,11 +3297,11 @@ } /** - * Reduces a `collection` to a value which is the accumulated result of running - * each element in the `collection` through the `callback`, where each successive - * `callback` execution consumes the return value of the previous execution. - * If `accumulator` is not provided, the first element of the `collection` will be - * used as the initial `accumulator` value. The `callback` is bound to `thisArg` + * Reduces a collection to a value which is the accumulated result of running + * each element in the collection through the callback, where each successive + * callback execution consumes the return value of the previous execution. If + * `accumulator` is not provided the first element of the collection will be + * used as the initial `accumulator` value. The callback is bound to `thisArg` * and invoked with four arguments; (accumulator, value, index|key, collection). * * @static @@ -3351,7 +3352,7 @@ } /** - * This method is like `_.reduce`, except that it iterates over elements + * This method is like `_.reduce` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -3381,13 +3382,13 @@ } /** - * The opposite of `_.filter`, this method returns the elements of a - * `collection` that `callback` does **not** return truthy for. + * The opposite of `_.filter` this method returns the elements of a + * collection that the callback does **not** return truthy for. * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3396,11 +3397,10 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that did **not** pass the - * callback check. + * @returns {Array} Returns a new array of elements that failed the callback check. * @example * * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); @@ -3427,67 +3427,8 @@ } /** - * Removes all elements from the `collection` that thw `callback` returns truthy - * for and returns an array of removed elements. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback`, the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to modify. - * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4, 5, 6]; - * var evens = _.remove(array, function(num) { return num % 2 == 0; }); - * - * console.log(array); - * // => [1, 3, 5] - * - * console.log(evens); - * // => [2, 4, 6] - */ - function remove(collection, callback, thisArg) { - var result = []; - callback = lodash.createCallback(callback, thisArg, 3); - - var index = -1, - length = collection ? collection.length : 0; - - if (typeof length == 'number') { - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - result.push(value); - splice.call(collection, index--, 1); - length--; - } - } - } else { - forOwn(collection, function(value, key, collection) { - if (callback(value, key, collection)) { - result.push(value); - delete collection[key]; - } - }); - } - return result; - } - - /** - * Creates an array of shuffled `array` values, using a version of the - * Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. + * Creates an array of shuffled values, using a version of the Fisher-Yates + * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. * * @static * @memberOf _ @@ -3538,15 +3479,15 @@ } /** - * 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 + * Checks if the callback returns a truthy value for **any** element of a + * collection. The function returns as soon as it finds a passing value and + * does not iterate over the entire collection. The callback is bound to * `thisArg` and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3556,7 +3497,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Boolean} Returns `true` if any element passed the callback check, @@ -3602,15 +3543,15 @@ /** * Creates an array of elements, sorted in ascending order by the results of - * running each element in the `collection` through the `callback`. This method - * performs a stable sort, that is, it will preserve the original sort order of - * equal elements. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). + * running each element in a collection through the callback. This method + * performs a stable sort, that is, it will preserve the original sort order + * of equal elements. The callback is bound to `thisArg` and invoked with + * three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3619,7 +3560,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of sorted elements. @@ -3708,8 +3649,8 @@ /*--------------------------------------------------------------------------*/ /** - * Creates an array with all falsey values of `array` removed. The values - * `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are all falsey. * * @static * @memberOf _ @@ -3781,7 +3722,7 @@ } /** - * This method is like `_.find`, except that it returns the index of the first + * This method is like `_.find` except that it returns the index of the first * element that passes the callback check, instead of the element itself. * * @static @@ -3789,7 +3730,7 @@ * @category Arrays * @param {Array} array The array to search. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the index of the found element, else `-1`. @@ -3814,7 +3755,7 @@ } /** - * This method is like `_.findIndex`, except that it iterates over elements + * This method is like `_.findIndex` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -3822,7 +3763,7 @@ * @category Arrays * @param {Array} array The array to search. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the index of the found element, else `-1`. @@ -3845,16 +3786,16 @@ } /** - * Gets the first element of the `array`. If a number `n` is provided, the first - * `n` elements of the `array` are returned. If a `callback` function is provided, - * elements at the beginning of the array are returned as long as the `callback` - * returns truthy. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index, array). + * Gets the first element of an array. If a number `n` is provided the first + * `n` elements of the array are returned. If a callback is provided elements + * at the beginning of the array are returned as long as the callback returns + * truthy. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3865,7 +3806,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n] The function called * per element or the number of elements to return. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the first element(s) of `array`. @@ -3924,15 +3865,15 @@ /** * Flattens a nested array (the nesting can be to any depth). If `isShallow` - * is truthy, `array` will only be flattened a single level. If `callback` - * is provided, each element of `array` is provided through a `callback` before - * flattening. The `callback` is bound to `thisArg` and invoked with three + * is truthy, the array will only be flattened a single level. If a callback + * is provided each element of the array is passed through the callback before + * flattening. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3942,7 +3883,7 @@ * @param {Array} array The array to flatten. * @param {Boolean} [isShallow=false] A flag to restrict flattening to a single level. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new flattened array. @@ -3978,16 +3919,16 @@ /** * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the `array` is already - * sorted, passing `true` for `fromIndex` will run a faster binary search. + * strict equality for comparisons, i.e. `===`. If the array is already sorted + * providing `true` for `fromIndex` will run a faster binary search. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to search. * @param {Mixed} value The value to search for. - * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` to - * perform a binary search on a sorted `array`. + * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. * @returns {Number} Returns the index of the matched value or `-1`. * @example * @@ -4012,16 +3953,16 @@ } /** - * Gets all but the last element of `array`. If a number `n` is provided, the - * last `n` elements are excluded from the result. If a `callback` function - * is provided, elements at the end of the array are excluded from the result - * as long as the `callback` returns truthy. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, array). + * Gets all but the last element of an array. If a number `n` is provided + * the last `n` elements are excluded from the result. If a callback is + * provided elements at the end of the array are excluded from the result + * as long as the callback returns truthy. The callback is bound to `thisArg` + * and invoked with three arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4031,7 +3972,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n=1] The function called * per element or the number of elements to exclude. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. @@ -4146,17 +4087,17 @@ } /** - * Gets the last element of the `array`. If a number `n` is provided, the - * last `n` elements of the `array` are returned. If a `callback` function - * is provided, elements at the end of the array are returned as long as the - * `callback` returns truthy. The `callback` is bound to `thisArg` and - * invoked with three arguments;(value, index, array). + * Gets the last element of an array. If a number `n` is provided the last + * `n` elements of the array are returned. If a callback is provided elements + * at the end of the array are returned as long as the callback returns truthy. + * The callback is bound to `thisArg` and invoked with three arguments; + * (value, index, array). * * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4166,7 +4107,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n] The function called * per element or the number of elements to return. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the last element(s) of `array`. @@ -4346,17 +4287,66 @@ } /** - * The opposite of `_.initial`, this method gets all but the first value of - * `array`. If a number `n` is provided, the first `n` values are excluded from - * the result. If a `callback` function is provided, elements at the beginning - * of the array are excluded from the result as long as the `callback` returns - * truthy. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index, array). + * Removes all elements from an array that the callback returns truthy for + * and returns an array of removed elements. The callback is bound to `thisArg` + * and invoked with three arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback + * will return `true` for elements that have the properties of the given object, + * else `false`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to modify. + * @param {Function|Object|String} [callback=identity] The function called + * per iteration. If a property name or object is provided it will be used + * to create a "_.pluck" or "_.where" style callback, respectively. + * @param {Mixed} [thisArg] The `this` binding of `callback`. + * @returns {Array} Returns a new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4, 5, 6]; + * var evens = _.remove(array, function(num) { return num % 2 == 0; }); + * + * console.log(array); + * // => [1, 3, 5] + * + * console.log(evens); + * // => [2, 4, 6] + */ + function remove(array, callback, thisArg) { + var index = -1, + length = array ? array.length : 0, + result = []; + + callback = lodash.createCallback(callback, thisArg, 3); + while (++index < length) { + var value = array[index]; + if (callback(value, index, array)) { + result.push(value); + splice.call(array, index--, 1); + length--; + } + } + return result; + } + + /** + * The opposite of `_.initial` this method gets all but the first value of + * an array. If a number `n` is provided the first `n` values are excluded + * from the result. If a callback function is provided elements at the beginning + * of the array are excluded from the result as long as the callback returns + * truthy. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index, array). + * + * If a property name is provided for `callback` the created "_.pluck" style + * callback will return the property value of the given element. + * + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4367,7 +4357,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n=1] The function called * per element or the number of elements to exclude. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. @@ -4420,16 +4410,16 @@ } /** - * 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 provided, it will be executed for `value` - * and each element in `array` to compute their sort ranking. The `callback` - * is bound to `thisArg` and invoked with one argument; (value). + * Uses a binary search to determine the smallest index at which a value + * should be inserted into a given sorted array in order to maintain the sort + * order of the array. If a callback is provided it will be executed for + * `value` and each element of `array` to compute their sort ranking. The + * callback is bound to `thisArg` and invoked with one argument; (value). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4439,10 +4429,10 @@ * @param {Array} array The array to inspect. * @param {Mixed} value The value to evaluate. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Number} Returns the index at which the value should be inserted + * @returns {Number} Returns the index at which `value` should be inserted * into `array`. * @example * @@ -4503,17 +4493,17 @@ } /** - * Creates a duplicate-value-free version of the `array` using strict equality - * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` - * for `isSorted` will run a faster algorithm. If `callback` is provided, each - * element of `array` is provided through the `callback` before uniqueness is - * computed. The `callback` is bound to `thisArg` and invoked with three arguments; - * (value, index, array). + * Creates a duplicate-value-free version of an array using strict equality + * for comparisons, i.e. `===`. If the array is sorted, providing + * `true` for `isSorted` will use a faster algorithm. If a callback is provided + * each element of `array` is passed through the callback before uniqueness + * is computed. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4522,9 +4512,9 @@ * @alias unique * @category Arrays * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. + * @param {Boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a duplicate-value-free array. @@ -4607,9 +4597,9 @@ } /** - * Creates an object composed from arrays of `keys` and `values`. Pass either - * a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or - * two arrays, one of `keys` and one of corresponding `values`. + * Creates an object composed from arrays of `keys` and `values`. Provide + * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` + * or two arrays, one of `keys` and one of corresponding `values`. * * @static * @memberOf _ @@ -4643,7 +4633,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a function this is restricted to executing `func`, with the `this` + * Creates a function this is restricted to executing `func` with the `this` * binding and arguments of the created function, only after it is called `n` times. * * @static @@ -4696,10 +4686,10 @@ } /** - * Binds methods on `object` to `object`, overwriting the existing method. - * Method names may be specified as individual arguments or as arrays of method - * names. If no method names are provided, all the function properties of `object` - * will be bound. + * Binds methods of an object to the object itself, overwriting the existing + * method. Method names may be specified as individual arguments or as arrays + * of method names. If no method names are provided all the function properties + * of `object` will be bound. * * @static * @memberOf _ @@ -4814,8 +4804,8 @@ /** * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name, the created callback will return the property value for a given element. - * If `func` is an object, the created callback will return `true` for elements + * name the created callback will return the property value for a given element. + * If `func` is an object the created callback will return `true` for elements * that contain the equivalent object properties, otherwise it will return `false`. * * @static @@ -4860,7 +4850,7 @@ // handle "_.where" style callback shorthands if (props.length == 1 && a === a && !isObject(a)) { - // fast path the common case of passing an object with a single + // fast path the common case of providing an object with a single // property containing a primitive value return function(object) { var b = object[key]; @@ -4882,12 +4872,12 @@ /** * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. Pass - * an `options` object to indicate that `func` should be invoked on the leading - * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced - * function will return the result of the last `func` call. + * `wait` milliseconds have elapsed since the last time it was invoked. + * Provide an options object to indicate that `func` should be invoked on + * the leading and/or trailing edge of the `wait` timeout. Subsequent calls + * to the debounced function will return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true`, `func` will be called + * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * @@ -5049,7 +5039,7 @@ /** * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it will be used to determine the cache key for storing the result + * provided it will be used to determine the cache key for storing the result * based on the arguments provided to the memoized function. By default, the * first argument provided to the memoized function is used as the cache key. * The `func` is executed with the `this` binding of the memoized function. @@ -5117,7 +5107,7 @@ /** * Creates a function that, when called, invokes `func` with any additional * `partial` arguments prepended to those provided to the new function. This - * method is similar to `_.bind`, except it does **not** alter the `this` binding. + * method is similar to `_.bind` except it does **not** alter the `this` binding. * * @static * @memberOf _ @@ -5137,7 +5127,7 @@ } /** - * This method is like `_.partial`, except that `partial` arguments are + * This method is like `_.partial` except that `partial` arguments are * appended to those provided to the new function. * * @static @@ -5169,12 +5159,12 @@ /** * Creates a function that, when executed, will only call the `func` function - * at most once per every `wait` milliseconds. Pass an `options` object to + * at most once per every `wait` milliseconds. Provide an options object to * indicate that `func` should be invoked on the leading and/or trailing edge * of the `wait` timeout. Subsequent calls to the throttled function will * return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true`, `func` will be called + * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * @@ -5219,9 +5209,9 @@ } /** - * Creates a function that passes `value` to the `wrapper` function as its + * Creates a function that provides `value` to the wrapper function as its * first argument. Additional arguments provided to the function are appended - * to those provided to the `wrapper` function. The `wrapper` is executed with + * to those provided to the wrapper function. The wrapper is executed with * the `this` binding of the created function. * * @static @@ -5286,13 +5276,14 @@ } /** - * Adds functions properties of `object` to the `lodash` function and chainable - * wrapper. + * Adds function properties of a source object to the `lodash` function and + * chainable wrapper. * * @static * @memberOf _ * @category Utilities * @param {Object} object The object of function properties to add to `lodash`. + * @param {Object} object The object of function properties to add to `lodash`. * @example * * _.mixin({ @@ -5352,7 +5343,7 @@ /** * Converts the given `value` into an integer of the specified `radix`. - * If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the + * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the * `value` is a hexadecimal, in which case a `radix` of `16` is used. * * Note: This method avoids differences in native ES3 and ES5 `parseInt` @@ -5376,7 +5367,7 @@ /** * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided, a number between `0` and the given number will be + * argument is provided a number between `0` and the given number will be * returned. * * @static @@ -5411,9 +5402,9 @@ } /** - * Resolves the value of `property` on `object`. If `property` is a function, + * Resolves the value of `property` on `object`. If `property` is a function * it will be invoked with the `this` binding of `object` and its result returned, - * else the property value is returned. If `object` is falsey, then `undefined` + * else the property value is returned. If `object` is falsey then `undefined` * is returned. * * @static @@ -5631,8 +5622,8 @@ } /** - * Executes the `callback` function `n` times, returning an array of the results - * of each `callback` execution. The `callback` is bound to `thisArg` and invoked + * Executes the callback `n` times, returning an array of the results + * of each callback execution. The callback is bound to `thisArg` and invoked * with one argument; (index). * * @static @@ -5666,7 +5657,7 @@ } /** - * The inverse of `_.escape`, this method converts the HTML entities + * The inverse of `_.escape` this method converts the HTML entities * `&`, `<`, `>`, `"`, and `'` in `string` to their * corresponding characters. * @@ -5685,7 +5676,7 @@ } /** - * Generates a unique ID. If `prefix` is provided, the ID will be appended to it. + * Generates a unique ID. If `prefix` is provided the ID will be appended to it. * * @static * @memberOf _ @@ -5736,14 +5727,15 @@ } /** - * 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. + * Invokes `interceptor` with the `value` as the first argument and then + * returns `value`. The purpose of this method is to "tap into" a method + * chain in order to perform operations on intermediate results within + * the chain. * * @static * @memberOf _ * @category Chaining - * @param {Mixed} value The value to pass to `interceptor`. + * @param {Mixed} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {Mixed} Returns `value`. * @example diff --git a/dist/lodash.min.js b/dist/lodash.min.js index b8028d5ad..08d9c7f2b 100644 --- a/dist/lodash.min.js +++ b/dist/lodash.min.js @@ -3,48 +3,48 @@ * Lo-Dash 1.3.1 (Custom Build) lodash.com/license | Underscore.js 1.5.1 underscorejs.org/LICENSE * Build: `lodash modern -o ./dist/lodash.js` */ -;!function(n){function t(n,t,e){e=(e||0)-1;for(var r=n?n.length:0;++et||typeof n=="undefined")return 1;if(ne?0:e);++r=k&&i===t,g=u||v?f():l;if(v){var h=a(g);h?(i=e,g=h):(v=m,g=u?g:(p(g),l)) -}for(;++oi(g,y))&&((u||v)&&g.push(y),l.push(h))}return v?(p(g.b),s(g)):u&&p(g),l}function it(n){return function(t,e,r){var u={};return e=Z.createCallback(e,r,3),Ot(t,function(t,r,o){r=ee(e(t,r,o)),n(u,t,r,o)}),u}}function ft(n,t,e,r,u,o){var a=o&&!u;if(!_t(n)&&!a)throw new re;var i=n.__bindData__;if(i)return he.apply(i[2],e),he.apply(i[3],r),!u&&i[4]&&(i[1]=t,i[4]=m,i[5]=o),ft.apply(_,i);if(u||o||r.length||!(De.fastBind||we&&e.length))f=function(){var o=arguments,i=u?this:t; -return a&&(n=t[c]),(e.length||r.length)&&(de.apply(o,e),he.apply(o,r)),this instanceof f?(i=mt(n.prototype)?je(n.prototype):{},o=n.apply(i,o),mt(o)?o:i):n.apply(i,o)};else{i=[n,t],he.apply(i,e);var f=we.call.apply(we,i)}if(i=Ne.call(arguments),a){var c=t;t=n}return Fe(f,i),f}function ct(n){return qe[n]}function lt(){var n=(n=Z.indexOf)===Ft?t:n;return n}function pt(n){var t,e;return n&&be.call(n)==L&&(t=n.constructor,!_t(t)||t instanceof t)?(x(n,function(n,t){e=t}),e===h||ge.call(n,e)):m}function st(n){return We[n] -}function vt(n){return n&&typeof n=="object"?be.call(n)==T:m}function gt(n,t,e){var r=ze(n),u=r.length;for(t=et(t,e,3);u--&&(e=r[u],!(t(n[e],e,n)===false)););return n}function ht(n){var t=[];return x(n,function(n,e){_t(n)&&t.push(e)}),t.sort()}function yt(n){for(var t=-1,e=ze(n),r=e.length,u={};++te?Ee(0,o+e):e)||0,o&&typeof o=="number"?a=-1<(dt(n)?n.indexOf(t,e):u(n,t,e)):d(n,function(n){return++ro&&(o=i)}}else t=!t&&dt(n)?u:Z.createCallback(t,e,3),Ot(n,function(n,e,u){e=t(n,e,u),e>r&&(r=e,o=n) -});return o}function At(n,t){var e=-1,r=n?n.length:0;if(typeof r=="number")for(var u=Ht(r);++earguments.length;t=et(t,r,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(e=n[++o]);++oarguments.length;return t=et(t,r,4),Et(n,function(n,r,o){e=u?(u=m,n):t(e,n,r,o)}),e}function Bt(n,t,e){var r;t=Z.createCallback(t,e,3),e=-1; -var u=n?n.length:0;if(typeof u=="number")for(;++e=k&&u===t;if(c){var l=a(i);l?(u=e,i=l):c=m}for(;++ru(i,l)&&f.push(l);return c&&s(i),f}function Dt(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=_){var o=-1;for(t=Z.createCallback(t,e,3);++or?Ee(0,u+r):r||0}else if(r)return r=zt(n,e),n[r]===e?r:-1;return n?t(n,e,r):-1}function Tt(n,t,e){if(typeof t!="number"&&t!=_){var r=0,u=-1,o=n?n.length:0;for(t=Z.createCallback(t,e,3);++u>>1,e(n[r])e?0:e);++tc&&(i=n.apply(f,a));else{var e=new Qt;!s&&!h&&(l=e);var r=p-(e-l);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:Z}};var Fe=le?function(n,t){var e=c();e.value=t,le(n,"__bindData__",e),s(e)}:l,Te=ke,ze=Oe?function(n){return mt(n)?Oe(n):[]}:X,qe={"&":"&","<":"<",">":">",'"':""","'":"'"},We=yt(qe),Pe=te("("+ze(We).join("|")+")","g"),Ke=te("["+ze(qe).join("")+"]","g"),Le=it(function(n,t,e){ge.call(n,e)?n[e]++:n[e]=1 -}),Me=it(function(n,t,e){(ge.call(n,e)?n[e]:n[e]=[]).push(t)}),Ue=it(function(n,t,e){n[e]=t});Be&&Q&&typeof ye=="function"&&(Mt=Kt(ye,r));var Ve=8==Se(C+"08")?Se:function(n,t){return Se(dt(n)?n.replace(R,""):n,t||0)};return Z.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},Z.assign=J,Z.at=function(n){for(var t=-1,e=rt(arguments,y,m,1),r=e.length,u=Ht(r);++t=k&&a(o?r[o]:h) -}n:for(;++c(_?e(_,y):l(h,y))){for(o=u,(_||h).push(y);--o;)if(_=i[o],0>(_?e(_,y):l(r[o],y)))continue n;g.push(y)}}for(;u--;)(_=i[u])&&s(_);return p(i),p(h),g},Z.invert=yt,Z.invoke=function(n,t){var e=Ne.call(arguments,2),r=-1,u=typeof t=="function",o=n?n.length:0,a=Ht(typeof o=="number"?o:0);return Ot(n,function(n){a[++r]=(u?t:n[t]).apply(n,e)}),a},Z.keys=ze,Z.map=It,Z.max=St,Z.memoize=function(n,t){function e(){var r=e.cache,u=j+(t?t.apply(this,arguments):arguments[0]); -return ge.call(r,u)?r[u]:r[u]=n.apply(this,arguments)}return e.cache={},e},Z.merge=function(n){var t=arguments,e=2;if(!mt(n))return n;if("number"!=typeof t[2]&&(e=t.length),3r(a,e))&&(o[e]=n)}),o},Z.once=function(n){var t,e;return function(){return t?e:(t=y,e=n.apply(this,arguments),n=_,e)}},Z.pairs=function(n){for(var t=-1,e=ze(n),r=e.length,u=Ht(r);++te?Ee(0,r+e):Ie(e,r-1))+1);r--;)if(n[r]===t)return r;return-1},Z.mixin=Vt,Z.noConflict=function(){return r._=ae,this},Z.parseInt=Ve,Z.random=function(n,t){n==_&&t==_&&(t=1),n=+n||0,t==_?(t=n,n=0):t=+t||0; -var e=Ae();return n%1||t%1?n+Ie(e*(t-n+parseFloat("1e-"+((e+"").length-1))),t):n+pe(e*(t-n+1))},Z.reduce=Nt,Z.reduceRight=Rt,Z.result=function(n,t){var e=n?n[t]:h;return _t(e)?n[t]():e},Z.runInContext=g,Z.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:ze(n).length},Z.some=Bt,Z.sortedIndex=zt,Z.template=function(n,t,e){var r=Z.templateSettings;n||(n=""),e=H({},e,r);var u,o=H({},e.imports,r.imports),r=ze(o),o=wt(o),a=0,f=e.interpolate||B,c="__p+='",f=te((e.escape||B).source+"|"+f.source+"|"+(f===N?S:B).source+"|"+(e.evaluate||B).source+"|$","g"); -n.replace(f,function(t,e,r,o,f,l){return r||(r=o),c+=n.slice(a,l).replace(D,i),e&&(c+="'+__e("+e+")+'"),f&&(u=y,c+="';"+f+";__p+='"),r&&(c+="'+((__t=("+r+"))==null?'':__t)+'"),a=l+t.length,t}),c+="';\n",f=e=e.variable,f||(e="obj",c="with("+e+"){"+c+"}"),c=(u?c.replace(O,""):c).replace(E,"$1").replace(I,"$1;"),c="function("+e+"){"+(f?"":e+"||("+e+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var l=Xt(r,"return "+c).apply(h,o) -}catch(p){throw p.source=c,p}return t?l(t):(l.source=c,l)},Z.unescape=function(n){return n==_?"":ee(n).replace(Pe,st)},Z.uniqueId=function(n){var t=++w;return ee(n==_?"":n)+t},Z.all=kt,Z.any=Bt,Z.detect=Ct,Z.findWhere=Ct,Z.foldl=Nt,Z.foldr=Rt,Z.include=jt,Z.inject=Nt,d(Z,function(n,t){Z.prototype[t]||(Z.prototype[t]=function(){var t=[this.__wrapped__],e=this.__chain__;return he.apply(t,arguments),t=n.apply(Z,t),e?new nt(t,e):t})}),Z.first=Dt,Z.last=function(n,t,e){if(n){var r=0,u=n.length;if(typeof t!="number"&&t!=_){var o=u; -for(t=Z.createCallback(t,e,3);o--&&t(n[o],o,n);)r++}else if(r=t,r==_||e)return n[u-1];return v(n,Ee(0,u-r))}},Z.take=Dt,Z.head=Dt,d(Z,function(n,t){Z.prototype[t]||(Z.prototype[t]=function(t,e){var r=this.__chain__,u=n(this.__wrapped__,t,e);return!r&&(t==_||e&&typeof t!="function")?u:new nt(u,r)})}),Z.VERSION="1.3.1",Z.prototype.chain=function(){return this.__chain__=y,this},Z.prototype.toString=function(){return ee(this.__wrapped__)},Z.prototype.value=Gt,Z.prototype.valueOf=Gt,Ot(["join","pop","shift"],function(n){var t=ue[n]; -Z.prototype[n]=function(){var n=this.__chain__,e=t.apply(this.__wrapped__,arguments);return n?new nt(e,n):e}}),Ot(["push","reverse","sort","unshift"],function(n){var t=ue[n];Z.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this}}),Ot(["concat","slice","splice"],function(n){var t=ue[n];Z.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Z}var h,y=!0,_=null,m=!1,b=[],d=[],w=0,j=+new Date+"",k=75,x=40,C=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",O=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,I=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,N=/<%=([\s\S]+?)%>/g,R=RegExp("^["+C+"]*0+(?=.$)"),B=/($^)/,$=($=/\bthis\b/)&&$.test(g)&&$,D=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),T="[object Arguments]",z="[object Array]",q="[object Boolean]",W="[object Date]",P="[object Function]",K="[object Number]",L="[object Object]",M="[object RegExp]",U="[object String]",V={}; +;!function(n){function t(n,t,r){r=(r||0)-1;for(var e=n?n.length:0;++rt||typeof n=="undefined")return 1;if(nr?0:r);++e=k&&i===t,g=u||v?f():l;if(v){var h=a(g);h?(i=r,g=h):(v=m,g=u?g:(p(g),l)) +}for(;++oi(g,y))&&((u||v)&&g.push(y),l.push(h))}return v?(p(g.b),s(g)):u&&p(g),l}function it(n){return function(t,r,e){var u={};return r=Z.createCallback(r,e,3),Ot(t,function(t,e,o){e=rr(r(t,e,o)),n(u,t,e,o)}),u}}function ft(n,t,r,e,u,o){var a=o&&!u;if(!_t(n)&&!a)throw new er;var i=n.__bindData__;if(i)return hr.apply(i[2],r),hr.apply(i[3],e),!u&&i[4]&&(i[1]=t,i[4]=m,i[5]=o),ft.apply(_,i);if(u||o||e.length||!(Dr.fastBind||wr&&r.length))f=function(){var o=arguments,i=u?this:t; +return a&&(n=t[c]),(r.length||e.length)&&(dr.apply(o,r),hr.apply(o,e)),this instanceof f?(i=mt(n.prototype)?jr(n.prototype):{},o=n.apply(i,o),mt(o)?o:i):n.apply(i,o)};else{i=[n,t],hr.apply(i,r);var f=wr.call.apply(wr,i)}if(i=Nr.call(arguments),a){var c=t;t=n}return Fr(f,i),f}function ct(n){return qr[n]}function lt(){var n=(n=Z.indexOf)===Ft?t:n;return n}function pt(n){var t,r;return n&&br.call(n)==L&&(t=n.constructor,!_t(t)||t instanceof t)?(x(n,function(n,t){r=t}),r===h||gr.call(n,r)):m}function st(n){return Wr[n] +}function vt(n){return n&&typeof n=="object"?br.call(n)==T:m}function gt(n,t,r){var e=zr(n),u=e.length;for(t=rt(t,r,3);u--&&(r=e[u],!(t(n[r],r,n)===false)););return n}function ht(n){var t=[];return x(n,function(n,r){_t(n)&&t.push(r)}),t.sort()}function yt(n){for(var t=-1,r=zr(n),e=r.length,u={};++tr?Er(0,o+r):r)||0,o&&typeof o=="number"?a=-1<(dt(n)?n.indexOf(t,r):u(n,t,r)):d(n,function(n){return++eo&&(o=i)}}else t=!t&&dt(n)?u:Z.createCallback(t,r,3),Ot(n,function(n,r,u){r=t(n,r,u),r>e&&(e=r,o=n) +});return o}function At(n,t){var r=-1,e=n?n.length:0;if(typeof e=="number")for(var u=Ht(e);++rarguments.length;t=rt(t,e,4);var o=-1,a=n.length;if(typeof a=="number")for(u&&(r=n[++o]);++oarguments.length;return t=rt(t,e,4),Et(n,function(n,e,o){r=u?(u=m,n):t(r,n,e,o)}),r}function Bt(n,t,r){var e;t=Z.createCallback(t,r,3),r=-1; +var u=n?n.length:0;if(typeof u=="number")for(;++r=k&&u===t;if(c){var l=a(i);l?(u=r,i=l):c=m}for(;++eu(i,l)&&f.push(l);return c&&s(i),f}function Dt(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=_){var o=-1;for(t=Z.createCallback(t,r,3);++oe?Er(0,u+e):e||0}else if(e)return e=zt(n,r),n[e]===r?e:-1;return n?t(n,r,e):-1}function Tt(n,t,r){if(typeof t!="number"&&t!=_){var e=0,u=-1,o=n?n.length:0;for(t=Z.createCallback(t,r,3);++u>>1,r(n[e])r?0:r);++tc&&(i=n.apply(f,a));else{var r=new Qt;!s&&!h&&(l=r);var e=p-(r-l);0/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:N,variable:"",imports:{_:Z}};var Fr=lr?function(n,t){var r=c();r.value=t,lr(n,"__bindData__",r),s(r)}:l,Tr=kr,zr=Or?function(n){return mt(n)?Or(n):[]}:X,qr={"&":"&","<":"<",">":">",'"':""","'":"'"},Wr=yt(qr),Pr=tr("("+zr(Wr).join("|")+")","g"),Kr=tr("["+zr(qr).join("")+"]","g"),Lr=it(function(n,t,r){gr.call(n,r)?n[r]++:n[r]=1 +}),Mr=it(function(n,t,r){(gr.call(n,r)?n[r]:n[r]=[]).push(t)}),Ur=it(function(n,t,r){n[r]=t});Br&&Q&&typeof yr=="function"&&(Mt=Kt(yr,e));var Vr=8==Sr(C+"08")?Sr:function(n,t){return Sr(dt(n)?n.replace(R,""):n,t||0)};return Z.after=function(n,t){return function(){return 1>--n?t.apply(this,arguments):void 0}},Z.assign=J,Z.at=function(n){for(var t=-1,r=et(arguments,y,m,1),e=r.length,u=Ht(e);++t=k&&a(o?e[o]:h) +}n:for(;++c(_?r(_,y):l(h,y))){for(o=u,(_||h).push(y);--o;)if(_=i[o],0>(_?r(_,y):l(e[o],y)))continue n;g.push(y)}}for(;u--;)(_=i[u])&&s(_);return p(i),p(h),g},Z.invert=yt,Z.invoke=function(n,t){var r=Nr.call(arguments,2),e=-1,u=typeof t=="function",o=n?n.length:0,a=Ht(typeof o=="number"?o:0);return Ot(n,function(n){a[++e]=(u?t:n[t]).apply(n,r)}),a},Z.keys=zr,Z.map=It,Z.max=St,Z.memoize=function(n,t){function r(){var e=r.cache,u=j+(t?t.apply(this,arguments):arguments[0]); +return gr.call(e,u)?e[u]:e[u]=n.apply(this,arguments)}return r.cache={},r},Z.merge=function(n){var t=arguments,r=2;if(!mt(n))return n;if("number"!=typeof t[2]&&(r=t.length),3e(a,r))&&(o[r]=n)}),o},Z.once=function(n){var t,r;return function(){return t?r:(t=y,r=n.apply(this,arguments),n=_,r)}},Z.pairs=function(n){for(var t=-1,r=zr(n),e=r.length,u=Ht(e);++tr?Er(0,e+r):Ir(r,e-1))+1);e--;)if(n[e]===t)return e;return-1},Z.mixin=Vt,Z.noConflict=function(){return e._=ar,this},Z.parseInt=Vr,Z.random=function(n,t){n==_&&t==_&&(t=1),n=+n||0,t==_?(t=n,n=0):t=+t||0;var r=Ar();return n%1||t%1?n+Ir(r*(t-n+parseFloat("1e-"+((r+"").length-1))),t):n+pr(r*(t-n+1))},Z.reduce=Nt,Z.reduceRight=Rt,Z.result=function(n,t){var r=n?n[t]:h; +return _t(r)?n[t]():r},Z.runInContext=g,Z.size=function(n){var t=n?n.length:0;return typeof t=="number"?t:zr(n).length},Z.some=Bt,Z.sortedIndex=zt,Z.template=function(n,t,r){var e=Z.templateSettings;n||(n=""),r=H({},r,e);var u,o=H({},r.imports,e.imports),e=zr(o),o=wt(o),a=0,f=r.interpolate||B,c="__p+='",f=tr((r.escape||B).source+"|"+f.source+"|"+(f===N?S:B).source+"|"+(r.evaluate||B).source+"|$","g");n.replace(f,function(t,r,e,o,f,l){return e||(e=o),c+=n.slice(a,l).replace(D,i),r&&(c+="'+__e("+r+")+'"),f&&(u=y,c+="';"+f+";__p+='"),e&&(c+="'+((__t=("+e+"))==null?'':__t)+'"),a=l+t.length,t +}),c+="';\n",f=r=r.variable,f||(r="obj",c="with("+r+"){"+c+"}"),c=(u?c.replace(O,""):c).replace(E,"$1").replace(I,"$1;"),c="function("+r+"){"+(f?"":r+"||("+r+"={});")+"var __t,__p='',__e=_.escape"+(u?",__j=Array.prototype.join;function print(){__p+=__j.call(arguments,'')}":";")+c+"return __p}";try{var l=Xt(e,"return "+c).apply(h,o)}catch(p){throw p.source=c,p}return t?l(t):(l.source=c,l)},Z.unescape=function(n){return n==_?"":rr(n).replace(Pr,st)},Z.uniqueId=function(n){var t=++w;return rr(n==_?"":n)+t +},Z.all=kt,Z.any=Bt,Z.detect=Ct,Z.findWhere=Ct,Z.foldl=Nt,Z.foldr=Rt,Z.include=jt,Z.inject=Nt,d(Z,function(n,t){Z.prototype[t]||(Z.prototype[t]=function(){var t=[this.__wrapped__],r=this.__chain__;return hr.apply(t,arguments),t=n.apply(Z,t),r?new nt(t,r):t})}),Z.first=Dt,Z.last=function(n,t,r){if(n){var e=0,u=n.length;if(typeof t!="number"&&t!=_){var o=u;for(t=Z.createCallback(t,r,3);o--&&t(n[o],o,n);)e++}else if(e=t,e==_||r)return n[u-1];return v(n,Er(0,u-e))}},Z.take=Dt,Z.head=Dt,d(Z,function(n,t){Z.prototype[t]||(Z.prototype[t]=function(t,r){var e=this.__chain__,u=n(this.__wrapped__,t,r); +return!e&&(t==_||r&&typeof t!="function")?u:new nt(u,e)})}),Z.VERSION="1.3.1",Z.prototype.chain=function(){return this.__chain__=y,this},Z.prototype.toString=function(){return rr(this.__wrapped__)},Z.prototype.value=Gt,Z.prototype.valueOf=Gt,Ot(["join","pop","shift"],function(n){var t=ur[n];Z.prototype[n]=function(){var n=this.__chain__,r=t.apply(this.__wrapped__,arguments);return n?new nt(r,n):r}}),Ot(["push","reverse","sort","unshift"],function(n){var t=ur[n];Z.prototype[n]=function(){return t.apply(this.__wrapped__,arguments),this +}}),Ot(["concat","slice","splice"],function(n){var t=ur[n];Z.prototype[n]=function(){return new nt(t.apply(this.__wrapped__,arguments),this.__chain__)}}),Z}var h,y=!0,_=null,m=!1,b=[],d=[],w=0,j=+new Date+"",k=75,x=40,C=" \t\x0B\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000",O=/\b__p\+='';/g,E=/\b(__p\+=)''\+/g,I=/(__e\(.*?\)|\b__t\))\+'';/g,S=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,A=/\w*$/,N=/<%=([\s\S]+?)%>/g,R=RegExp("^["+C+"]*0+(?=.$)"),B=/($^)/,$=($=/\bthis\b/)&&$.test(g)&&$,D=/['\n\r\t\u2028\u2029\\]/g,F="Array Boolean Date Function Math Number Object RegExp String _ attachEvent clearTimeout isFinite isNaN parseInt setImmediate setTimeout".split(" "),T="[object Arguments]",z="[object Array]",q="[object Boolean]",W="[object Date]",P="[object Function]",K="[object Number]",L="[object Object]",M="[object RegExp]",U="[object String]",V={}; V[P]=m,V[T]=V[z]=V[q]=V[W]=V[K]=V[L]=V[M]=V[U]=y;var G={"boolean":m,"function":y,object:y,number:m,string:m,undefined:m},H={"\\":"\\","'":"'","\n":"n","\r":"r","\t":"t","\u2028":"u2028","\u2029":"u2029"},J=G[typeof exports]&&exports,Q=G[typeof module]&&module&&module.exports==J&&module,X=G[typeof global]&&global;!X||X.global!==X&&X.window!==X||(n=X);var Y=g();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(n._=Y, define(function(){return Y})):J&&!J.nodeType?Q?(Q.exports=Y)._=Y:J._=Y:n._=Y }(this); \ No newline at end of file diff --git a/dist/lodash.underscore.js b/dist/lodash.underscore.js index d23d1a986..dc1915b04 100644 --- a/dist/lodash.underscore.js +++ b/dist/lodash.underscore.js @@ -68,7 +68,7 @@ /** Detect free variable `module` */ var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module; - /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ + /** Detect free variable `global` from Node.js or Browserified code and use it as `window` */ var freeGlobal = objectTypes[typeof global] && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { window = freeGlobal; @@ -198,7 +198,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a `lodash` object, which wraps the given `value`, to enable method + * Creates a `lodash` object which wraps the given value to enable method * chaining. * * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: @@ -395,7 +395,7 @@ } /** - * The base implementation of `_.flatten` without support for `callback` + * The base implementation of `_.flatten` without support for callback * shorthands or `thisArg` binding. * * @private @@ -433,7 +433,7 @@ * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. * @param {Array} [stackA=[]] Tracks traversed `a` objects. * @param {Array} [stackB=[]] Tracks traversed `b` objects. - * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`. + * @returns {Boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(a, b, stackA, stackB) { if (a === b) { @@ -534,12 +534,12 @@ } /** - * The base implementation of `_.uniq` without support for `callback` shorthands + * The base implementation of `_.uniq` without support for callback shorthands * or `thisArg` binding. * * @private * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. + * @param {Boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function} [callback] The function called per iteration. * @returns {Array} Returns a duplicate-value-free array. */ @@ -717,7 +717,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an `arguments` object, else `false`. * @example * * (function() { return _.isArguments(arguments); })(1, 2, 3); @@ -744,7 +744,7 @@ * @type Function * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an array, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an array, else `false`. * @example * * (function() { return _.isArray(arguments); })(); @@ -779,7 +779,7 @@ }; /** - * Creates an array composed of the own enumerable property names of `object`. + * Creates an array composed of the own enumerable property names of an object. * * @static * @memberOf _ @@ -827,9 +827,9 @@ /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources will overwrite property assignments of previous - * sources. If a `callback` function is provided, it will be executed to produce - * the assigned values. The `callback` is bound to `thisArg` and invoked with - * two arguments; (objectValue, sourceValue). + * sources. If a callback is provided it will be executed to produce the + * assigned values. The callback is bound to `thisArg` and invoked with two + * arguments; (objectValue, sourceValue). * * @static * @memberOf _ @@ -870,11 +870,11 @@ } /** - * Creates a clone of `value`. If `deep` is `true`, nested objects will also - * be cloned, otherwise they will be assigned by reference. If a `callback` - * function is provided, it will be executed to produce the cloned values. If - * `callback` returns `undefined`, cloning will be handled by the method instead. - * The `callback` is bound to `thisArg` and invoked with one argument; (value). + * Creates a clone of `value`. If `deep` is `true` nested objects will also + * be cloned, otherwise they will be assigned by reference. If a callback + * is provided it will be executed to produce the cloned values. If the + * callback returns `undefined` cloning will be handled by the method instead. + * The callback is bound to `thisArg` and invoked with one argument; (value). * * @static * @memberOf _ @@ -953,10 +953,10 @@ } /** - * Iterates over own and inherited enumerable properties of a given `object`, - * executing the `callback` for each property. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. + * Iterates over own and inherited enumerable properties of an object, + * executing the callback for each property. The callback is bound to `thisArg` + * and invoked with three arguments; (value, key, object). Callbacks may exit + * iteration early by explicitly returning `false`. * * @static * @memberOf _ @@ -992,10 +992,10 @@ }; /** - * Iterates over own enumerable properties of a given `object`, executing the - * `callback` for each property. The `callback` is bound to `thisArg` and - * invoked with three arguments; (value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. + * Iterates over own enumerable properties of an object, executing the callback + * for each property. The callback is bound to `thisArg` and invoked with three + * arguments; (value, key, object). Callbacks may exit iteration early by + * explicitly returning `false`. * * @static * @memberOf _ @@ -1069,7 +1069,7 @@ } /** - * Creates an object composed of the inverted keys and values of the given `object`. + * Creates an object composed of the inverted keys and values of the given object. * * @static * @memberOf _ @@ -1101,7 +1101,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a boolean value, else `false`. * @example * * _.isBoolean(null); @@ -1118,7 +1118,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a date, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a date, else `false`. * @example * * _.isDate(new Date); @@ -1135,7 +1135,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); @@ -1154,7 +1154,7 @@ * @memberOf _ * @category Objects * @param {Array|Object|String} value The value to inspect. - * @returns {Boolean} Returns `true`, if the `value` is empty, else `false`. + * @returns {Boolean} Returns `true` if the `value` is empty, else `false`. * @example * * _.isEmpty([1, 2, 3]); @@ -1183,10 +1183,10 @@ /** * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If `callback` is provided, it will be executed to - * compare values. If `callback` returns `undefined`, comparisons will be handled - * by the method instead. The `callback` is bound to `thisArg` and invoked with - * two arguments; (a, b). + * equivalent to each other. If a callback is provided it will be executed + * to compare values. If the callback returns `undefined` comparisons will + * be handled by the method instead. The callback is bound to `thisArg` and + * invoked with two arguments; (a, b). * * @static * @memberOf _ @@ -1195,7 +1195,7 @@ * @param {Mixed} b The other value to compare. * @param {Function} [callback] The function to customize comparing values. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`. + * @returns {Boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var moe = { 'name': 'moe', 'age': 40 }; @@ -1226,14 +1226,14 @@ /** * Checks if `value` is, or can be coerced to, a finite number. * - * Note: This is not the same as native `isFinite`, which will return true for + * Note: This is not the same as native `isFinite` which will return true for * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is finite, else `false`. + * @returns {Boolean} Returns `true` if the `value` is finite, else `false`. * @example * * _.isFinite(-101); @@ -1262,7 +1262,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a function, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -1286,7 +1286,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an object, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an object, else `false`. * @example * * _.isObject({}); @@ -1309,14 +1309,14 @@ /** * Checks if `value` is `NaN`. * - * Note: This is not the same as native `isNaN`, which will return `true` for + * Note: This is not the same as native `isNaN` which will return `true` for * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); @@ -1344,7 +1344,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `null`, else `false`. * @example * * _.isNull(null); @@ -1366,7 +1366,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a number, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a number, else `false`. * @example * * _.isNumber(8.4 * 5); @@ -1383,7 +1383,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a regular expression, else `false`. * @example * * _.isRegExp(/moe/); @@ -1400,7 +1400,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a string, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a string, else `false`. * @example * * _.isString('moe'); @@ -1417,7 +1417,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); @@ -1430,10 +1430,10 @@ /** * Creates a shallow clone of `object` excluding the specified properties. * Property names may be specified as individual arguments or as arrays of - * property names. If a `callback` function is provided, it will be executed - * for each property in the `object`, omitting the properties `callback` - * returns truthy for. The `callback` is bound to `thisArg` and invoked - * with three arguments; (value, key, object). + * property names. If a callback is provided it will be executed for each + * property of `object` omitting the properties the callback returns truthy + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). * * @static * @memberOf _ @@ -1467,7 +1467,7 @@ } /** - * Creates a two dimensional array of the given object's key-value pairs, + * Creates a two dimensional array of an object's key-value pairs, * i.e. `[[key1, value1], [key2, value2]]`. * * @static @@ -1495,10 +1495,11 @@ /** * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of property - * names. If `callback` is provided, it will be executed for each property in the - * `object`, picking the properties `callback` returns truthy for. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, key, object). + * Property names may be specified as individual arguments or as arrays of + * property names. If a callback is provided it will be executed for each + * property of `object` picking the properties the callback returns truthy + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). * * @static * @memberOf _ @@ -1562,9 +1563,9 @@ /*--------------------------------------------------------------------------*/ /** - * Checks if a given `target` element is present in a `collection` using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. + * Checks if a given value is present in a collection using strict equality + * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the + * offset from the end of the collection. * * @static * @memberOf _ @@ -1604,15 +1605,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the given `callback`. The corresponding - * value of each key is the number of times the key was returned by the `callback`. - * The `callback` is bound to `thisArg` and invoked with three arguments; + * each element of `collection` through the callback. The corresponding value + * of each key is the number of times the key was returned by the callback. + * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -1621,7 +1622,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -1641,14 +1642,14 @@ }); /** - * Checks if the `callback` returns a truthy value for **all** elements of a - * `collection`. The `callback` is bound to `thisArg` and invoked with three + * Checks if the given callback returns truthy value for **all** elements of + * a collection. The callback is bound to `thisArg` and invoked with three * arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -1658,7 +1659,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Boolean} Returns `true` if all elements passed the callback check, @@ -1703,14 +1704,14 @@ } /** - * Iterates over elements of a `collection`, returning an array of all elements - * the `callback` returns truthy for. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index|key, collection). + * Iterates over elements of a collection, returning an array of all elements + * the callback returns truthy for. The callback is bound to `thisArg` and + * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -1720,7 +1721,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of elements that passed the callback check. @@ -1767,14 +1768,14 @@ } /** - * Iterates over elements of a `collection`, returning the first that the - * `callback` returns truthy for. The `callback` is bound to `thisArg` and + * Iterates over elements of a collection, returning the first element that + * the callback returns truthy for. The callback is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -1784,7 +1785,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the found element, else `undefined`. @@ -1862,10 +1863,10 @@ } /** - * Iterates over elements of a `collection`, executing the `callback` for - * each element. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). Callbacks may exit iteration - * early by explicitly returning `false`. + * Iterates over elements of a collection, executing the callback for each + * element. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). Callbacks may exit iteration early by + * explicitly returning `false`. * * @static * @memberOf _ @@ -1900,7 +1901,7 @@ } /** - * This method is like `_.forEach`, except that it iterates over elements + * This method is like `_.forEach` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -1932,15 +1933,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the `callback`. The corresponding - * value of each key is an array of the elements responsible for generating - * the key. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). + * each element of a collection through the callback. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false` * @@ -1949,7 +1950,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -1970,10 +1971,10 @@ }); /** - * Invokes the method named by `methodName` on each element in the `collection`, + * Invokes the method named by `methodName` on each element in the `collection` * returning an array of the results of each invoked method. Additional arguments - * will be provided to each invoked method. If `methodName` is a function, it will - * be invoked for, and `this` bound to, each element in the `collection`. + * will be provided to each invoked method. If `methodName` is a function it + * will be invoked for, and `this` bound to, each element in the `collection`. * * @static * @memberOf _ @@ -2005,14 +2006,14 @@ } /** - * Creates an array of values by running each element in the `collection` - * through the `callback`. The `callback` is bound to `thisArg` and invoked with + * Creates an array of values by running each element in the collection + * through the callback. The callback is bound to `thisArg` and invoked with * three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2022,7 +2023,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of the results of each `callback` execution. @@ -2063,15 +2064,15 @@ } /** - * Retrieves the maximum value of an `array`. If `callback` is provided, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, collection). + * Retrieves the maximum value of an array. If a callback is provided it + * will be executed for each value in the array to generate the criterion by + * which the value is ranked. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2080,7 +2081,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the maximum value. @@ -2130,15 +2131,15 @@ } /** - * Retrieves the minimum value of an `array`. If `callback` is provided, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index, collection). + * Retrieves the minimum value of an array. If a callback is provided it + * will be executed for each value in the array to generate the criterion by + * which the value is ranked. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2147,7 +2148,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the minimum value. @@ -2230,11 +2231,11 @@ } /** - * Reduces a `collection` to a value which is the accumulated result of running - * each element in the `collection` through the `callback`, where each successive - * `callback` execution consumes the return value of the previous execution. - * If `accumulator` is not provided, the first element of the `collection` will be - * used as the initial `accumulator` value. The `callback` is bound to `thisArg` + * Reduces a collection to a value which is the accumulated result of running + * each element in the collection through the callback, where each successive + * callback execution consumes the return value of the previous execution. If + * `accumulator` is not provided the first element of the collection will be + * used as the initial `accumulator` value. The callback is bound to `thisArg` * and invoked with four arguments; (accumulator, value, index|key, collection). * * @static @@ -2285,7 +2286,7 @@ } /** - * This method is like `_.reduce`, except that it iterates over elements + * This method is like `_.reduce` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -2315,13 +2316,13 @@ } /** - * The opposite of `_.filter`, this method returns the elements of a - * `collection` that `callback` does **not** return truthy for. + * The opposite of `_.filter` this method returns the elements of a + * collection that the callback does **not** return truthy for. * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2330,11 +2331,10 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that did **not** pass the - * callback check. + * @returns {Array} Returns a new array of elements that failed the callback check. * @example * * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); @@ -2361,8 +2361,8 @@ } /** - * Creates an array of shuffled `array` values, using a version of the - * Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. + * Creates an array of shuffled values, using a version of the Fisher-Yates + * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. * * @static * @memberOf _ @@ -2413,15 +2413,15 @@ } /** - * 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 + * Checks if the callback returns a truthy value for **any** element of a + * collection. The function returns as soon as it finds a passing value and + * does not iterate over the entire collection. The callback is bound to * `thisArg` and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2431,7 +2431,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Boolean} Returns `true` if any element passed the callback check, @@ -2477,15 +2477,15 @@ /** * Creates an array of elements, sorted in ascending order by the results of - * running each element in the `collection` through the `callback`. This method - * performs a stable sort, that is, it will preserve the original sort order of - * equal elements. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). + * running each element in a collection through the callback. This method + * performs a stable sort, that is, it will preserve the original sort order + * of equal elements. The callback is bound to `thisArg` and invoked with + * three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2494,7 +2494,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of sorted elements. @@ -2589,8 +2589,8 @@ /*--------------------------------------------------------------------------*/ /** - * Creates an array with all falsey values of `array` removed. The values - * `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are all falsey. * * @static * @memberOf _ @@ -2648,16 +2648,16 @@ } /** - * Gets the first element of the `array`. If a number `n` is provided, the first - * `n` elements of the `array` are returned. If a `callback` function is provided, - * elements at the beginning of the array are returned as long as the `callback` - * returns truthy. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index, array). + * Gets the first element of an array. If a number `n` is provided the first + * `n` elements of the array are returned. If a callback is provided elements + * at the beginning of the array are returned as long as the callback returns + * truthy. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2668,7 +2668,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n] The function called * per element or the number of elements to return. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the first element(s) of `array`. @@ -2727,15 +2727,15 @@ /** * Flattens a nested array (the nesting can be to any depth). If `isShallow` - * is truthy, `array` will only be flattened a single level. If `callback` - * is provided, each element of `array` is provided through a `callback` before - * flattening. The `callback` is bound to `thisArg` and invoked with three + * is truthy, the array will only be flattened a single level. If a callback + * is provided each element of the array is passed through the callback before + * flattening. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2745,7 +2745,7 @@ * @param {Array} array The array to flatten. * @param {Boolean} [isShallow=false] A flag to restrict flattening to a single level. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new flattened array. @@ -2772,16 +2772,16 @@ /** * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the `array` is already - * sorted, passing `true` for `fromIndex` will run a faster binary search. + * strict equality for comparisons, i.e. `===`. If the array is already sorted + * providing `true` for `fromIndex` will run a faster binary search. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to search. * @param {Mixed} value The value to search for. - * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` to - * perform a binary search on a sorted `array`. + * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. * @returns {Number} Returns the index of the matched value or `-1`. * @example * @@ -2806,16 +2806,16 @@ } /** - * Gets all but the last element of `array`. If a number `n` is provided, the - * last `n` elements are excluded from the result. If a `callback` function - * is provided, elements at the end of the array are excluded from the result - * as long as the `callback` returns truthy. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, array). + * Gets all but the last element of an array. If a number `n` is provided + * the last `n` elements are excluded from the result. If a callback is + * provided elements at the end of the array are excluded from the result + * as long as the callback returns truthy. The callback is bound to `thisArg` + * and invoked with three arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2825,7 +2825,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n=1] The function called * per element or the number of elements to exclude. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. @@ -2919,17 +2919,17 @@ } /** - * Gets the last element of the `array`. If a number `n` is provided, the - * last `n` elements of the `array` are returned. If a `callback` function - * is provided, elements at the end of the array are returned as long as the - * `callback` returns truthy. The `callback` is bound to `thisArg` and - * invoked with three arguments;(value, index, array). + * Gets the last element of an array. If a number `n` is provided the last + * `n` elements of the array are returned. If a callback is provided elements + * at the end of the array are returned as long as the callback returns truthy. + * The callback is bound to `thisArg` and invoked with three arguments; + * (value, index, array). * * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -2939,7 +2939,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n] The function called * per element or the number of elements to return. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the last element(s) of `array`. @@ -3083,17 +3083,17 @@ } /** - * The opposite of `_.initial`, this method gets all but the first value of - * `array`. If a number `n` is provided, the first `n` values are excluded from - * the result. If a `callback` function is provided, elements at the beginning - * of the array are excluded from the result as long as the `callback` returns - * truthy. The `callback` is bound to `thisArg` and invoked with three + * The opposite of `_.initial` this method gets all but the first value of + * an array. If a number `n` is provided the first `n` values are excluded + * from the result. If a callback function is provided elements at the beginning + * of the array are excluded from the result as long as the callback returns + * truthy. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3104,7 +3104,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n=1] The function called * per element or the number of elements to exclude. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. @@ -3157,16 +3157,16 @@ } /** - * 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 provided, it will be executed for `value` - * and each element in `array` to compute their sort ranking. The `callback` - * is bound to `thisArg` and invoked with one argument; (value). + * Uses a binary search to determine the smallest index at which a value + * should be inserted into a given sorted array in order to maintain the sort + * order of the array. If a callback is provided it will be executed for + * `value` and each element of `array` to compute their sort ranking. The + * callback is bound to `thisArg` and invoked with one argument; (value). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3176,10 +3176,10 @@ * @param {Array} array The array to inspect. * @param {Mixed} value The value to evaluate. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Number} Returns the index at which the value should be inserted + * @returns {Number} Returns the index at which `value` should be inserted * into `array`. * @example * @@ -3240,17 +3240,17 @@ } /** - * Creates a duplicate-value-free version of the `array` using strict equality - * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` - * for `isSorted` will run a faster algorithm. If `callback` is provided, each - * element of `array` is provided through the `callback` before uniqueness is - * computed. The `callback` is bound to `thisArg` and invoked with three arguments; - * (value, index, array). + * Creates a duplicate-value-free version of an array using strict equality + * for comparisons, i.e. `===`. If the array is sorted, providing + * `true` for `isSorted` will use a faster algorithm. If a callback is provided + * each element of `array` is passed through the callback before uniqueness + * is computed. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3259,9 +3259,9 @@ * @alias unique * @category Arrays * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. + * @param {Boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a duplicate-value-free array. @@ -3343,9 +3343,9 @@ } /** - * Creates an object composed from arrays of `keys` and `values`. Pass either - * a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or - * two arrays, one of `keys` and one of corresponding `values`. + * Creates an object composed from arrays of `keys` and `values`. Provide + * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` + * or two arrays, one of `keys` and one of corresponding `values`. * * @static * @memberOf _ @@ -3379,7 +3379,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a function this is restricted to executing `func`, with the `this` + * Creates a function this is restricted to executing `func` with the `this` * binding and arguments of the created function, only after it is called `n` times. * * @static @@ -3432,10 +3432,10 @@ } /** - * Binds methods on `object` to `object`, overwriting the existing method. - * Method names may be specified as individual arguments or as arrays of method - * names. If no method names are provided, all the function properties of `object` - * will be bound. + * Binds methods of an object to the object itself, overwriting the existing + * method. Method names may be specified as individual arguments or as arrays + * of method names. If no method names are provided all the function properties + * of `object` will be bound. * * @static * @memberOf _ @@ -3512,8 +3512,8 @@ /** * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name, the created callback will return the property value for a given element. - * If `func` is an object, the created callback will return `true` for elements + * name the created callback will return the property value for a given element. + * If `func` is an object the created callback will return `true` for elements * that contain the equivalent object properties, otherwise it will return `false`. * * @static @@ -3568,12 +3568,12 @@ /** * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. Pass - * an `options` object to indicate that `func` should be invoked on the leading - * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced - * function will return the result of the last `func` call. + * `wait` milliseconds have elapsed since the last time it was invoked. + * Provide an options object to indicate that `func` should be invoked on + * the leading and/or trailing edge of the `wait` timeout. Subsequent calls + * to the debounced function will return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true`, `func` will be called + * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * @@ -3731,7 +3731,7 @@ /** * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it will be used to determine the cache key for storing the result + * provided it will be used to determine the cache key for storing the result * based on the arguments provided to the memoized function. By default, the * first argument provided to the memoized function is used as the cache key. * The `func` is executed with the `this` binding of the memoized function. @@ -3796,7 +3796,7 @@ /** * Creates a function that, when called, invokes `func` with any additional * `partial` arguments prepended to those provided to the new function. This - * method is similar to `_.bind`, except it does **not** alter the `this` binding. + * method is similar to `_.bind` except it does **not** alter the `this` binding. * * @static * @memberOf _ @@ -3817,12 +3817,12 @@ /** * Creates a function that, when executed, will only call the `func` function - * at most once per every `wait` milliseconds. Pass an `options` object to + * at most once per every `wait` milliseconds. Provide an options object to * indicate that `func` should be invoked on the leading and/or trailing edge * of the `wait` timeout. Subsequent calls to the throttled function will * return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true`, `func` will be called + * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * @@ -3865,9 +3865,9 @@ } /** - * Creates a function that passes `value` to the `wrapper` function as its + * Creates a function that provides `value` to the wrapper function as its * first argument. Additional arguments provided to the function are appended - * to those provided to the `wrapper` function. The `wrapper` is executed with + * to those provided to the wrapper function. The wrapper is executed with * the `this` binding of the created function. * * @static @@ -3932,13 +3932,14 @@ } /** - * Adds functions properties of `object` to the `lodash` function and chainable - * wrapper. + * Adds function properties of a source object to the `lodash` function and + * chainable wrapper. * * @static * @memberOf _ * @category Utilities * @param {Object} object The object of function properties to add to `lodash`. + * @param {Object} object The object of function properties to add to `lodash`. * @example * * _.mixin({ @@ -3990,7 +3991,7 @@ /** * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided, a number between `0` and the given number will be + * argument is provided a number between `0` and the given number will be * returned. * * @static @@ -4025,9 +4026,9 @@ } /** - * Resolves the value of `property` on `object`. If `property` is a function, + * Resolves the value of `property` on `object`. If `property` is a function * it will be invoked with the `this` binding of `object` and its result returned, - * else the property value is returned. If `object` is falsey, then `undefined` + * else the property value is returned. If `object` is falsey then `undefined` * is returned. * * @static @@ -4199,8 +4200,8 @@ } /** - * Executes the `callback` function `n` times, returning an array of the results - * of each `callback` execution. The `callback` is bound to `thisArg` and invoked + * Executes the callback `n` times, returning an array of the results + * of each callback execution. The callback is bound to `thisArg` and invoked * with one argument; (index). * * @static @@ -4232,7 +4233,7 @@ } /** - * The inverse of `_.escape`, this method converts the HTML entities + * The inverse of `_.escape` this method converts the HTML entities * `&`, `<`, `>`, `"`, and `'` in `string` to their * corresponding characters. * @@ -4251,7 +4252,7 @@ } /** - * Generates a unique ID. If `prefix` is provided, the ID will be appended to it. + * Generates a unique ID. If `prefix` is provided the ID will be appended to it. * * @static * @memberOf _ @@ -4302,14 +4303,15 @@ } /** - * 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. + * Invokes `interceptor` with the `value` as the first argument and then + * returns `value`. The purpose of this method is to "tap into" a method + * chain in order to perform operations on intermediate results within + * the chain. * * @static * @memberOf _ * @category Chaining - * @param {Mixed} value The value to pass to `interceptor`. + * @param {Mixed} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {Mixed} Returns `value`. * @example diff --git a/doc/README.md b/doc/README.md index c09dcdc3b..a4c758bf5 100644 --- a/doc/README.md +++ b/doc/README.md @@ -1,4 +1,4 @@ -# Lo-Dash v1.3.1 +# Lo-Dash v1.3.1 @@ -22,6 +22,7 @@ * [`_.object`](#_zipobjectkeys--values) * [`_.pull`](#_pullarray--value1-value2-) * [`_.range`](#_rangestart0-end--step1) +* [`_.remove`](#_removearray--callbackidentity-thisarg) * [`_.rest`](#_restarray--callbackn1-thisarg) * [`_.sortedIndex`](#_sortedindexarray-value--callbackidentity-thisarg) * [`_.tail`](#_restarray--callbackn1-thisarg) @@ -84,7 +85,6 @@ * [`_.reduce`](#_reducecollection--callbackidentity-accumulator-thisarg) * [`_.reduceRight`](#_reducerightcollection--callbackidentity-accumulator-thisarg) * [`_.reject`](#_rejectcollection--callbackidentity-thisarg) -* [`_.remove`](#_removecollection--callbackidentity-thisarg) * [`_.select`](#_filtercollection--callbackidentity-thisarg) * [`_.shuffle`](#_shufflecollection) * [`_.size`](#_sizecollection) @@ -169,7 +169,7 @@ ## `Utilities` * [`_.escape`](#_escapestring) * [`_.identity`](#_identityvalue) -* [`_.mixin`](#_mixinobject) +* [`_.mixin`](#_mixinobject-object) * [`_.noConflict`](#_noconflict) * [`_.parseInt`](#_parseintvalue--radix) * [`_.random`](#_randommin0-max1) @@ -229,9 +229,9 @@ ### `_.compact(array)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4085 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4026 "View in source") [Ⓣ][1] -Creates an array with all falsey values of `array` removed. The values `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. +Creates an array with all falsey values removed. The values `false`, `null`, `0`, `""`, `undefined`, and `NaN` are all falsey. #### Arguments 1. `array` *(Array)*: The array to compact. @@ -253,7 +253,7 @@ _.compact([0, 1, false, 2, '', 3]); ### `_.difference(array [, array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4114 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4055 "View in source") [Ⓣ][1] Creates an array excluding all values of the provided arrays using strict equality for comparisons, i.e. `===`. @@ -278,13 +278,13 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]); ### `_.findIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4164 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4105 "View in source") [Ⓣ][1] -This method is like `_.find`, except that it returns the index of the first element that passes the callback check, instead of the element itself. +This method is like `_.find` except that it returns the index of the first element that passes the callback check, instead of the element itself. #### Arguments 1. `array` *(Array)*: The array to search. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -306,13 +306,13 @@ _.findIndex(['apple', 'banana', 'beet'], function(food) { ### `_.findLastIndex(array [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4197 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4138 "View in source") [Ⓣ][1] -This method is like `_.findIndex`, except that it iterates over elements of a `collection` from right to left. +This method is like `_.findIndex` except that it iterates over elements of a `collection` from right to left. #### Arguments 1. `array` *(Array)*: The array to search. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -334,20 +334,20 @@ _.findLastIndex(['apple', 'banana', 'beet'], function(food) { ### `_.first(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4265 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4206 "View in source") [Ⓣ][1] -Gets the first element of the `array`. If a number `n` is provided, the first `n` elements of the `array` are returned. If a `callback` function is provided, elements at the beginning of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. +Gets the first element of an array. If a number `n` is provided the first `n` elements of the array are returned. If a callback is provided elements at the beginning of the array are returned as long as the callback returns truthy. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases *head, take* #### Arguments 1. `array` *(Array)*: The array to query. -2. `[callback|n]` *(Function|Object|Number|String)*: The function called per element or the number of elements to return. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback|n]` *(Function|Object|Number|String)*: The function called per element or the number of elements to return. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -394,18 +394,18 @@ _.first(food, { 'type': 'fruit' }); ### `_.flatten(array [, isShallow=false, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4327 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4268 "View in source") [Ⓣ][1] -Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, `array` will only be flattened a single level. If `callback` is provided, each element of `array` is provided through a `callback` before flattening. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. +Flattens a nested array *(the nesting can be to any depth)*. If `isShallow` is truthy, the array will only be flattened a single level. If a callback is provided each element of the array is passed through the callback before flattening. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `array` *(Array)*: The array to flatten. 2. `[isShallow=false]` *(Boolean)*: A flag to restrict flattening to a single level. -3. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +3. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 4. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -437,14 +437,14 @@ _.flatten(stooges, 'quotes'); ### `_.indexOf(array, value [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4364 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4305 "View in source") [Ⓣ][1] -Gets the index at which the first occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `fromIndex` will run a faster binary search. +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 providing `true` for `fromIndex` will run a faster binary search. #### Arguments 1. `array` *(Array)*: The array to search. 2. `value` *(Mixed)*: The value to search for. -3. `[fromIndex=0]` *(Boolean|Number)*: The index to search from or `true` to perform a binary search on a sorted `array`. +3. `[fromIndex=0]` *(Boolean|Number)*: The index to search from or `true` to perform a binary search on a sorted array. #### Returns *(Number)*: Returns the index of the matched value or `-1`. @@ -469,17 +469,17 @@ _.indexOf([1, 1, 2, 2, 3, 3], 2, true); ### `_.initial(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4431 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4372 "View in source") [Ⓣ][1] -Gets all but the last element of `array`. If a number `n` is provided, the last `n` elements are excluded from the result. If a `callback` function is provided, elements at the end of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. +Gets all but the last element of an array. If a number `n` is provided the last `n` elements are excluded from the result. If a callback is provided elements at the end of the array are excluded from the result as long as the callback returns truthy. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `array` *(Array)*: The array to query. -2. `[callback|n=1]` *(Function|Object|Number|String)*: The function called per element or the number of elements to exclude. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback|n=1]` *(Function|Object|Number|String)*: The function called per element or the number of elements to exclude. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -526,7 +526,7 @@ _.initial(food, { 'type': 'vegetable' }); ### `_.intersection([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4464 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4405 "View in source") [Ⓣ][1] Creates an array of unique values present in all provided arrays using strict equality for comparisons, i.e. `===`. @@ -550,17 +550,17 @@ _.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]); ### `_.last(array [, callback|n, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4566 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4507 "View in source") [Ⓣ][1] -Gets the last element of the `array`. If a number `n` is provided, the last `n` elements of the `array` are returned. If a `callback` function is provided, elements at the end of the array are returned as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments;(value, index, array). +Gets the last element of an array. If a number `n` is provided the last `n` elements of the array are returned. If a callback is provided elements at the end of the array are returned as long as the callback returns truthy. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. - If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. + If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `array` *(Array)*: The array to query. -2. `[callback|n]` *(Function|Object|Number|String)*: The function called per element or the number of elements to return. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback|n]` *(Function|Object|Number|String)*: The function called per element or the number of elements to return. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -607,7 +607,7 @@ _.last(food, { 'type': 'vegetable' }); ### `_.lastIndexOf(array, value [, fromIndex=array.length-1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4607 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4548 "View in source") [Ⓣ][1] Gets the index at which the last occurrence of `value` is found using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. @@ -636,7 +636,7 @@ _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); ### `_.pull(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4637 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4578 "View in source") [Ⓣ][1] Removes all provided values from the given array using strict equality for comparisons, i.e. `===`. @@ -663,7 +663,7 @@ console.log(array); ### `_.range([start=0], end [, step=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4688 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4629 "View in source") [Ⓣ][1] Creates an array of numbers *(positive and/or negative)* progressing from `start` up to but not including `end`. If `start` is less than `stop` a zero-length range is created unless a negative `step` is specified. @@ -701,23 +701,59 @@ _.range(0); + + +### `_.remove(array [, callback=identity, thisArg])` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4682 "View in source") [Ⓣ][1] + +Removes all elements from an array that the callback returns truthy for and returns an array of removed elements. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. + +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. + +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. + +#### Arguments +1. `array` *(Array)*: The array to modify. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. +3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. + +#### Returns +*(Array)*: Returns a new array of removed elements. + +#### Example +```js +var array = [1, 2, 3, 4, 5, 6]; +var evens = _.remove(array, function(num) { return num % 2 == 0; }); + +console.log(array); +// => [1, 3, 5] + +console.log(evens); +// => [2, 4, 6] +``` + +* * * + + + + ### `_.rest(array [, callback|n=1, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4767 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4757 "View in source") [Ⓣ][1] -The opposite of `_.initial`, this method gets all but the first value of `array`. If a number `n` is provided, the first `n` values are excluded from the result. If a `callback` function is provided, elements at the beginning of the array are excluded from the result as long as the `callback` returns truthy. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. +The opposite of `_.initial` this method gets all but the first value of an array. If a number `n` is provided the first `n` values are excluded from the result. If a callback function is provided elements at the beginning of the array are excluded from the result as long as the callback returns truthy. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases *drop, tail* #### Arguments 1. `array` *(Array)*: The array to query. -2. `[callback|n=1]` *(Function|Object|Number|String)*: The function called per element or the number of elements to exclude. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback|n=1]` *(Function|Object|Number|String)*: The function called per element or the number of elements to exclude. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -764,22 +800,22 @@ _.rest(food, { 'type': 'fruit' }); ### `_.sortedIndex(array, value [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4831 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4821 "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 provided, it will be executed for `value` and each element in `array` to compute their sort ranking. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. +Uses a binary search to determine the smallest index at which a value should be inserted into a given sorted array in order to maintain the sort order of the array. If a callback is provided it will be executed for `value` and each element of `array` to compute their sort ranking. The callback is bound to `thisArg` and invoked with one argument; *(value)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `array` *(Array)*: The array to inspect. 2. `value` *(Mixed)*: The value to evaluate. -3. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +3. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 4. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns -*(Number)*: Returns the index at which the value should be inserted into `array`. +*(Number)*: Returns the index at which `value` should be inserted into `array`. #### Example ```js @@ -813,7 +849,7 @@ _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { ### `_.union([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4862 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4852 "View in source") [Ⓣ][1] Creates an array of unique values, in order, of the provided arrays using strict equality for comparisons, i.e. `===`. @@ -837,21 +873,21 @@ _.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#L4910 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4900 "View in source") [Ⓣ][1] -Creates a duplicate-value-free version of the `array` using strict equality for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` for `isSorted` will run a faster algorithm. If `callback` is provided, each element of `array` is provided through the `callback` before uniqueness is computed. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. +Creates a duplicate-value-free version of an array using strict equality for comparisons, i.e. `===`. If the array is sorted, providing `true` for `isSorted` will use a faster algorithm. If a callback is provided each element of `array` is passed through the callback before uniqueness is computed. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, array)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases *unique* #### Arguments 1. `array` *(Array)*: The array to process. -2. `[isSorted=false]` *(Boolean)*: A flag to indicate that the `array` is already sorted. -3. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[isSorted=false]` *(Boolean)*: A flag to indicate that `array` is sorted. +3. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 4. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -884,7 +920,7 @@ _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); ### `_.without(array [, value1, value2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4938 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4928 "View in source") [Ⓣ][1] Creates an array excluding all provided values using strict equality for comparisons, i.e. `===`. @@ -909,7 +945,7 @@ _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); ### `_.zip([array1, array2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4958 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4948 "View in source") [Ⓣ][1] Creates an array of grouped elements, the first of which contains the first elements of the given arrays, the second of which contains the second elements of the given arrays, and so on. @@ -936,9 +972,9 @@ _.zip(['moe', 'larry'], [30, 40], [true, false]); ### `_.zipObject(keys [, values=[]])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4988 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4978 "View in source") [Ⓣ][1] -Creates an object composed from arrays of `keys` and `values`. Pass either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or two arrays, one of `keys` and one of corresponding `values`. +Creates an object composed from arrays of `keys` and `values`. Provide either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` or two arrays, one of `keys` and one of corresponding `values`. #### Aliases *object* @@ -973,7 +1009,7 @@ _.zipObject(['moe', 'larry'], [30, 40]); ### `_(value)` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L613 "View in source") [Ⓣ][1] -Creates a `lodash` object, which wraps the given `value`, to enable method chaining. +Creates a `lodash` object which wraps the given value to enable method chaining. In addition to Lo-Dash methods, wrappers also have the following `Array` methods:
`concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, and `unshift` @@ -1024,7 +1060,7 @@ _.isArray(squares.value()); ### `_.chain(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6093 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6084 "View in source") [Ⓣ][1] Creates a `lodash` object that wraps the given `value`. @@ -1057,12 +1093,12 @@ var youngest = _.chain(stooges) ### `_.tap(value, interceptor)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6120 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6112 "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. +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. #### Arguments -1. `value` *(Mixed)*: The value to pass to `interceptor`. +1. `value` *(Mixed)*: The value to provide to `interceptor`. 2. `interceptor` *(Function)*: The function to invoke. #### Returns @@ -1087,7 +1123,7 @@ _([1, 2, 3, 4]) ### `_.prototype.chain()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6140 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6132 "View in source") [Ⓣ][1] Enables method chaining on the wrapper object. @@ -1111,7 +1147,7 @@ var sum = _([1, 2, 3]) ### `_.prototype.toString()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6157 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6149 "View in source") [Ⓣ][1] Produces the `toString` result of the wrapped value. @@ -1132,7 +1168,7 @@ _([1, 2, 3]).toString(); ### `_.prototype.valueOf()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6174 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6166 "View in source") [Ⓣ][1] Extracts the wrapped value. @@ -1163,7 +1199,7 @@ _([1, 2, 3]).valueOf(); ### `_.at(collection [, index1, index2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2923 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2924 "View in source") [Ⓣ][1] Creates an array of elements from the specified indexes, or keys, of the `collection`. Indexes may be specified as individual arguments or as arrays of indexes. @@ -1191,9 +1227,9 @@ _.at(['moe', 'larry', 'curly'], 0, 2); ### `_.contains(collection, target [, fromIndex=0])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2965 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2966 "View in source") [Ⓣ][1] -Checks if a given `target` element is present in a `collection` using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. +Checks if a given value is present in a collection using strict equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the offset from the end of the collection. #### Aliases *include* @@ -1229,17 +1265,17 @@ _.contains('curly', 'ur'); ### `_.countBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3021 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3022 "View in source") [Ⓣ][1] -Creates an object composed of keys generated from the results of running each element of the `collection` through the given `callback`. The corresponding value of each key is the number of times the key was returned by the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Creates an object composed of keys generated from the results of running each element of `collection` through the callback. The corresponding value of each key is the number of times the key was returned by the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1265,20 +1301,20 @@ _.countBy(['one', 'two', 'three'], 'length'); ### `_.every(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3066 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3067 "View in source") [Ⓣ][1] -Checks if the `callback` returns a truthy value for **all** elements of a `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Checks if the given callback returns truthy value for **all** elements of a collection. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases *all* #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1311,20 +1347,20 @@ _.every(stooges, { 'age': 50 }); ### `_.filter(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3127 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3128 "View in source") [Ⓣ][1] -Iterates over elements of a `collection`, returning an array of all elements the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Iterates over elements of a collection, returning an array of all elements the callback returns truthy for. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases *select* #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1357,20 +1393,20 @@ _.filter(food, { 'type': 'fruit' }); ### `_.find(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3194 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3195 "View in source") [Ⓣ][1] -Iterates over elements of a `collection`, returning the first that the `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Iterates over elements of a collection, returning the first element that the callback returns truthy for. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases *detect, findWhere* #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1406,13 +1442,13 @@ _.find(food, 'organic'); ### `_.findLast(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3239 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3240 "View in source") [Ⓣ][1] -This method is like `_.find`, except that it iterates over elements of a `collection` from right to left. +This method is like `_.find` except that it iterates over elements of a `collection` from right to left. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1434,9 +1470,9 @@ _.findLast([1, 2, 3, 4], function(num) { ### `_.forEach(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3273 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3274 "View in source") [Ⓣ][1] -Iterates over elements of a `collection`, executing the `callback` for each element. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. +Iterates over elements of a collection, executing the callback for each element. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. Callbacks may exit iteration early by explicitly returning `false`. #### Aliases *each* @@ -1466,9 +1502,9 @@ _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); ### `_.forEachRight(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3306 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3307 "View in source") [Ⓣ][1] -This method is like `_.forEach`, except that it iterates over elements of a `collection` from right to left. +This method is like `_.forEach` except that it iterates over elements of a `collection` from right to left. #### Aliases *each* @@ -1495,17 +1531,17 @@ _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); ### `_.groupBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3359 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3360 "View in source") [Ⓣ][1] -Creates an object composed of keys generated from the results of running each element of the `collection` through the `callback`. The corresponding value of each key is an array of the elements responsible for generating the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Creates an object composed of keys generated from the results of running each element of a collection through the callback. The corresponding value of each key is an array of the elements responsible for generating the key. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false` +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false` #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1532,17 +1568,17 @@ _.groupBy(['one', 'two', 'three'], 'length'); ### `_.indexBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3402 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3403 "View in source") [Ⓣ][1] -Creates an object composed of keys generated from the results of running each element of the `collection` through the given `callback`. The corresponding value of each key is the last element responsible for generating the key. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Creates an object composed of keys generated from the results of running each element of the collection through the given callback. The corresponding value of each key is the last element responsible for generating the key. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1573,9 +1609,9 @@ _.indexBy(stooges, function(key) { this.fromCharCode(key.code); }, String); ### `_.invoke(collection, methodName [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3428 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3429 "View in source") [Ⓣ][1] -Invokes the method named by `methodName` on each element in the `collection`, returning an array of the results of each invoked method. Additional arguments will be provided to each invoked method. If `methodName` is a function, it will be invoked for, and `this` bound to, each element in the `collection`. +Invokes the method named by `methodName` on each element in the `collection` returning an array of the results of each invoked method. Additional arguments will be provided to each invoked method. If `methodName` is a function it will be invoked for, and `this` bound to, each element in the `collection`. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. @@ -1602,20 +1638,20 @@ _.invoke([123, 456], String.prototype.split, ''); ### `_.map(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3480 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3481 "View in source") [Ⓣ][1] -Creates an array of values by running each element in the `collection` through the `callback`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Creates an array of values by running each element in the collection through the callback. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases *collect* #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1647,17 +1683,17 @@ _.map(stooges, 'name'); ### `_.max(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3537 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3538 "View in source") [Ⓣ][1] -Retrieves the maximum value of an `array`. If `callback` is provided, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. +Retrieves the maximum value of an array. If a callback is provided it will be executed for each value in the array to generate the criterion by which the value is ranked. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1689,17 +1725,17 @@ _.max(stooges, 'age'); ### `_.min(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3606 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3607 "View in source") [Ⓣ][1] -Retrieves the minimum value of an `array`. If `callback` is provided, it will be executed for each value in the `array` to generate the criterion by which the value is ranked. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. +Retrieves the minimum value of an array. If a callback is provided it will be executed for each value in the array to generate the criterion by which the value is ranked. The callback is bound to `thisArg` and invoked with three arguments; *(value, index, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -1731,7 +1767,7 @@ _.min(stooges, 'age'); ### `_.pluck(collection, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3656 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3657 "View in source") [Ⓣ][1] Retrieves the value of a specified property from all elements in the `collection`. @@ -1761,9 +1797,9 @@ _.pluck(stooges, 'name'); ### `_.reduce(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3688 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3689 "View in source") [Ⓣ][1] -Reduces a `collection` to a value which is the accumulated result of running each element in the `collection` through the `callback`, where each successive `callback` execution consumes the return value of the previous execution. If `accumulator` is not provided, the first element of the `collection` will be used as the initial `accumulator` value. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. +Reduces a collection to a value which is the accumulated result of running each element in the collection through the callback, where each successive callback execution consumes the return value of the previous execution. If `accumulator` is not provided the first element of the collection will be used as the initial `accumulator` value. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, index|key, collection)*. #### Aliases *foldl, inject* @@ -1799,9 +1835,9 @@ var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { ### `_.reduceRight(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3731 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3732 "View in source") [Ⓣ][1] -This method is like `_.reduce`, except that it iterates over elements of a `collection` from right to left. +This method is like `_.reduce` except that it iterates over elements of a `collection` from right to left. #### Aliases *foldr* @@ -1832,19 +1868,19 @@ 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#L3781 "View in source") [Ⓣ][1] -The opposite of `_.filter`, this method returns the elements of a `collection` that `callback` does **not** return truthy for. +The opposite of `_.filter` this method returns the elements of a collection that the callback does **not** return truthy for. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns -*(Array)*: Returns a new array of elements that did **not** pass the callback check. +*(Array)*: Returns a new array of elements that failed the callback check. #### Example ```js @@ -1870,48 +1906,12 @@ _.reject(food, { 'type': 'fruit' }); - - -### `_.remove(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3820 "View in source") [Ⓣ][1] - -Removes all elements from the `collection` that thw `callback` returns truthy for and returns an array of removed elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. - -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. - -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. - -#### Arguments -1. `collection` *(Array|Object|String)*: The collection to modify. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. -3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. - -#### Returns -*(Array)*: Returns a new array of removed elements. - -#### Example -```js -var array = [1, 2, 3, 4, 5, 6]; -var evens = _.remove(array, function(num) { return num % 2 == 0; }); - -console.log(array); -// => [1, 3, 5] - -console.log(evens); -// => [2, 4, 6] -``` - -* * * - - - - ### `_.shuffle(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3861 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3802 "View in source") [Ⓣ][1] -Creates an array of shuffled `array` values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. +Creates an array of shuffled values, using a version of the Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to shuffle. @@ -1933,7 +1933,7 @@ _.shuffle([1, 2, 3, 4, 5, 6]); ### `_.size(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3894 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3835 "View in source") [Ⓣ][1] Gets the size of the `collection` by returning `collection.length` for arrays and array-like objects or the number of own enumerable properties for objects. @@ -1963,20 +1963,20 @@ _.size('curly'); ### `_.some(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3941 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3882 "View in source") [Ⓣ][1] -Checks if the `callback` returns a truthy value for **any** element of a `collection`. The function returns as soon as it finds passing value, and does not iterate over the entire `collection`. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Checks if the callback returns a truthy value for **any** element of a collection. The function returns as soon as it finds a passing value and does not iterate over the entire collection. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Aliases *any* #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -2009,17 +2009,17 @@ _.some(food, { 'type': 'meat' }); ### `_.sortBy(collection [, callback=identity, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3997 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3938 "View in source") [Ⓣ][1] -Creates an array of elements, sorted in ascending order by the results of running each element in the `collection` through the `callback`. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. +Creates an array of elements, sorted in ascending order by the results of running each element in a collection through the callback. This method performs a stable sort, that is, it will preserve the original sort order of equal elements. The callback is bound to `thisArg` and invoked with three arguments; *(value, index|key, collection)*. -If a property name is provided for `callback`, the created "_.pluck" style callback will return the property value of the given element. +If a property name is provided for `callback` the created "_.pluck" style callback will return the property value of the given element. -If an object is provided for `callback`, the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. +If an object is provided for `callback` the created "_.where" style callback will return `true` for elements that have the properties of the given object, else `false`. #### Arguments 1. `collection` *(Array|Object|String)*: The collection to iterate over. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -2046,7 +2046,7 @@ _.sortBy(['banana', 'strawberry', 'apple'], 'length'); ### `_.toArray(collection)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4033 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L3974 "View in source") [Ⓣ][1] Converts the `collection` to an array. @@ -2070,7 +2070,7 @@ Converts the `collection` to an array. ### `_.where(collection, properties)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4067 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L4008 "View in source") [Ⓣ][1] Performs a deep comparison of each element in a `collection` to the given `properties` object, returning an array of all elements that have equivalent property values. @@ -2110,9 +2110,9 @@ _.where(stooges, { 'quotes': ['Poifect!'] }); ### `_.after(n, func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5025 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5015 "View in source") [Ⓣ][1] -Creates a function this is restricted to executing `func`, with the `this` binding and arguments of the created function, only after it is called `n` times. +Creates a function this is restricted to executing `func` with the `this` binding and arguments of the created function, only after it is called `n` times. #### Arguments 1. `n` *(Number)*: The number of times the function must be called before `func` is executed. @@ -2138,7 +2138,7 @@ _.forEach(notes, function(note) { ### `_.bind(func [, thisArg, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5055 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5045 "View in source") [Ⓣ][1] Creates a function that, when called, invokes `func` with the `this` binding of `thisArg` and prepends any additional `bind` arguments to those provided to the bound function. @@ -2169,9 +2169,9 @@ func(); ### `_.bindAll(object [, methodName1, methodName2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5083 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5073 "View in source") [Ⓣ][1] -Binds methods on `object` to `object`, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided, all the function properties of `object` will be bound. +Binds methods of an object to the object itself, overwriting the existing method. Method names may be specified as individual arguments or as arrays of method names. If no method names are provided all the function properties of `object` will be bound. #### Arguments 1. `object` *(Object)*: The object to bind and assign the bound methods to. @@ -2200,7 +2200,7 @@ jQuery('#docs').on('click', view.onClick); ### `_.bindKey(object, key [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5129 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5119 "View in source") [Ⓣ][1] Creates a function that, when called, invokes the method at `object[key]` and prepends any additional `bindKey` arguments to those provided to the bound function. This method differs from `_.bind` by allowing bound functions to reference methods that will be redefined or don't yet exist. See http://michaux.ca/articles/lazy-function-definition-pattern. @@ -2241,7 +2241,7 @@ func(); ### `_.compose([func1, func2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5163 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5153 "View in source") [Ⓣ][1] Creates a function that is the composition of the provided functions, where each function consumes the return value of the function that follows. For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. Each function is executed with the `this` binding of the composed function. @@ -2279,9 +2279,9 @@ welcome('curly'); ### `_.createCallback([func=identity, thisArg, argCount])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5207 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5197 "View in source") [Ⓣ][1] -Produces a callback bound to an optional `thisArg`. If `func` is a property name, the created callback will return the property value for a given element. If `func` is an object, the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. +Produces a callback bound to an optional `thisArg`. If `func` is a property name the created callback will return the property value for a given element. If `func` is an object the created callback will return `true` for elements that contain the equivalent object properties, otherwise it will return `false`. #### Arguments 1. `[func=identity]` *(Mixed)*: The value to convert to a callback. @@ -2318,11 +2318,11 @@ _.filter(stooges, 'age__gt45'); ### `_.debounce(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5283 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5273 "View in source") [Ⓣ][1] -Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. +Creates a function that will delay the execution of `func` until after `wait` milliseconds have elapsed since the last time it was invoked. Provide an options object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced function will return the result of the last `func` call. -Note: If `leading` and `trailing` options are `true`, `func` will be called on the trailing edge of the timeout only if the the debounced function is invoked more than once during the `wait` timeout. +Note: If `leading` and `trailing` options are `true` `func` will be called on the trailing edge of the timeout only if the the debounced function is invoked more than once during the `wait` timeout. #### Arguments 1. `func` *(Function)*: The function to debounce. @@ -2359,7 +2359,7 @@ source.addEventListener('message', _.debounce(batchLog, 250, { ### `_.defer(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5380 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5370 "View in source") [Ⓣ][1] Defers executing the `func` function until the current call stack has cleared. Additional arguments will be provided to `func` when it is invoked. @@ -2384,7 +2384,7 @@ _.defer(function() { console.log('deferred'); }); ### `_.delay(func, wait [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5406 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5396 "View in source") [Ⓣ][1] Executes the `func` function after `wait` milliseconds. Additional arguments will be provided to `func` when it is invoked. @@ -2411,9 +2411,9 @@ _.delay(log, 1000, 'logged later'); ### `_.memoize(func [, resolver])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5431 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5421 "View in source") [Ⓣ][1] -Creates a function that memoizes the result of `func`. If `resolver` is provided, it will be used to determine the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. +Creates a function that memoizes the result of `func`. If `resolver` is provided it will be used to determine the cache key for storing the result based on the arguments provided to the memoized function. By default, the first argument provided to the memoized function is used as the cache key. The `func` is executed with the `this` binding of the memoized function. The result cache is exposed as the `cache` property on the memoized function. #### Arguments 1. `func` *(Function)*: The function to have its output memoized. @@ -2437,7 +2437,7 @@ var fibonacci = _.memoize(function(n) { ### `_.once(func)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5461 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5451 "View in source") [Ⓣ][1] Creates a function that is restricted to execute `func` once. Repeat calls to the function will return the value of the first call. The `func` is executed with the `this` binding of the created function. @@ -2463,9 +2463,9 @@ initialize(); ### `_.partial(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5496 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5486 "View in source") [Ⓣ][1] -Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those provided to the new function. This method is similar to `_.bind`, except it does **not** alter the `this` binding. +Creates a function that, when called, invokes `func` with any additional `partial` arguments prepended to those provided to the new function. This method is similar to `_.bind` except it does **not** alter the `this` binding. #### Arguments 1. `func` *(Function)*: The function to partially apply arguments to. @@ -2490,9 +2490,9 @@ hi('moe'); ### `_.partialRight(func [, arg1, arg2, ...])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5527 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5517 "View in source") [Ⓣ][1] -This method is like `_.partial`, except that `partial` arguments are appended to those provided to the new function. +This method is like `_.partial` except that `partial` arguments are appended to those provided to the new function. #### Arguments 1. `func` *(Function)*: The function to partially apply arguments to. @@ -2527,11 +2527,11 @@ options.imports ### `_.throttle(func, wait, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5562 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5552 "View in source") [Ⓣ][1] -Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Pass an `options` object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. +Creates a function that, when executed, will only call the `func` function at most once per every `wait` milliseconds. Provide an options object to indicate that `func` should be invoked on the leading and/or trailing edge of the `wait` timeout. Subsequent calls to the throttled function will return the result of the last `func` call. -Note: If `leading` and `trailing` options are `true`, `func` will be called on the trailing edge of the timeout only if the the throttled function is invoked more than once during the `wait` timeout. +Note: If `leading` and `trailing` options are `true` `func` will be called on the trailing edge of the timeout only if the the throttled function is invoked more than once during the `wait` timeout. #### Arguments 1. `func` *(Function)*: The function to throttle. @@ -2561,9 +2561,9 @@ jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { ### `_.wrap(value, wrapper)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5603 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5593 "View in source") [Ⓣ][1] -Creates a function that passes `value` to the `wrapper` function as its first argument. Additional arguments provided to the function are appended to those provided to the `wrapper` function. The `wrapper` is executed with the `this` binding of the created function. +Creates a function that provides `value` to the wrapper function as its first argument. Additional arguments provided to the function are appended to those provided to the wrapper function. The wrapper is executed with the `this` binding of the created function. #### Arguments 1. `value` *(Mixed)*: The value to wrap. @@ -2599,7 +2599,7 @@ hello(); ### `_.assign(object [, source1, source2, ..., callback, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1850 "View in source") [Ⓣ][1] -Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is provided, it will be executed to produce the assigned values. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. +Assigns own enumerable properties of source object(s) to the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the assigned values. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. #### Aliases *extend* @@ -2637,7 +2637,7 @@ defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.clone(value [, deep=false, callback, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1903 "View in source") [Ⓣ][1] -Creates a clone of `value`. If `deep` is `true`, nested objects will also be cloned, otherwise they will be assigned by reference. If a `callback` function is provided, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. +Creates a clone of `value`. If `deep` is `true` nested objects will also be cloned, otherwise they will be assigned by reference. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*. #### Arguments 1. `value` *(Mixed)*: The value to clone. @@ -2684,7 +2684,7 @@ clone.childNodes.length; ### `_.cloneDeep(value [, callback, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1955 "View in source") [Ⓣ][1] -Creates a deep clone of `value`. If a `callback` function is provided, it will be executed to produce the cloned values. If `callback` returns `undefined`, cloning will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with one argument; *(value)*. +Creates a deep clone of `value`. If a callback is provided it will be executed to produce the cloned values. If the callback returns `undefined` cloning will be handled by the method instead. The callback is bound to `thisArg` and invoked with one argument; *(value)*. Note: This method is loosely based on the structured clone algorithm. Functions and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and objects created by constructors other than `Object` are cloned to plain `Object` objects. See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. @@ -2756,11 +2756,11 @@ _.defaults(food, { 'name': 'banana', 'type': 'fruit' }); ### `_.findKey(object [, callback=identity, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2001 "View in source") [Ⓣ][1] -This method is like `_.findIndex`, except that it returns the key of the first element that passes the callback check, instead of the element itself. +This method is like `_.findIndex` except that it returns the key of the first element that passes the callback check, instead of the element itself. #### Arguments 1. `object` *(Object)*: The object to search. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -2784,11 +2784,11 @@ _.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.findLastKey(object [, callback=identity, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2033 "View in source") [Ⓣ][1] -This method is like `_.findKey`, except that it iterates over elements of a `collection` in the opposite order. +This method is like `_.findKey` except that it iterates over elements of a `collection` in the opposite order. #### Arguments 1. `object` *(Object)*: The object to search. -2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided, it will be used to create a "_.pluck" or "_.where" style callback, respectively. +2. `[callback=identity]` *(Function|Object|String)*: The function called per iteration. If a property name or object is provided it will be used to create a "_.pluck" or "_.where" style callback, respectively. 3. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns @@ -2812,7 +2812,7 @@ _.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) { ### `_.forIn(object [, callback=identity, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2074 "View in source") [Ⓣ][1] -Iterates over own and inherited enumerable properties of a given `object`, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. +Iterates over own and inherited enumerable properties of an object, executing the callback for each property. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. #### Arguments 1. `object` *(Object)*: The object to iterate over. @@ -2848,7 +2848,7 @@ _.forIn(new Dog('Dagny'), function(value, key) { ### `_.forInRight(object [, callback=identity, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2104 "View in source") [Ⓣ][1] -This method is like `_.forIn`, except that it iterates over elements of a `collection` in the opposite order. +This method is like `_.forIn` except that it iterates over elements of a `collection` in the opposite order. #### Arguments 1. `object` *(Object)*: The object to iterate over. @@ -2884,7 +2884,7 @@ _.forInRight(new Dog('Dagny'), function(value, key) { ### `_.forOwn(object [, callback=identity, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2142 "View in source") [Ⓣ][1] -Iterates over own enumerable properties of a given `object`, executing the `callback` for each property. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. +Iterates over own enumerable properties of an object, executing the callback for each property. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. #### Arguments 1. `object` *(Object)*: The object to iterate over. @@ -2912,7 +2912,7 @@ _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { ### `_.forOwnRight(object [, callback=identity, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2162 "View in source") [Ⓣ][1] -This method is like `_.forOwn`, except that it iterates over elements of a `collection` in the opposite order. +This method is like `_.forOwn` except that it iterates over elements of a `collection` in the opposite order. #### Arguments 1. `object` *(Object)*: The object to iterate over. @@ -2992,7 +2992,7 @@ _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); ### `_.invert(object)` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2233 "View in source") [Ⓣ][1] -Creates an object composed of the inverted keys and values of the given `object`. +Creates an object composed of the inverted keys and values of the given object. #### Arguments 1. `object` *(Object)*: The object to invert. @@ -3022,7 +3022,7 @@ Checks if `value` is an `arguments` object. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is an `arguments` object, else `false`. +*(Boolean)*: Returns `true` if the `value` is an `arguments` object, else `false`. #### Example ```js @@ -3049,7 +3049,7 @@ Checks if `value` is an array. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is an array, else `false`. +*(Boolean)*: Returns `true` if the `value` is an array, else `false`. #### Example ```js @@ -3076,7 +3076,7 @@ Checks if `value` is a boolean value. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is a boolean value, else `false`. +*(Boolean)*: Returns `true` if the `value` is a boolean value, else `false`. #### Example ```js @@ -3100,7 +3100,7 @@ Checks if `value` is a date. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is a date, else `false`. +*(Boolean)*: Returns `true` if the `value` is a date, else `false`. #### Example ```js @@ -3124,7 +3124,7 @@ Checks if `value` is a DOM element. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is a DOM element, else `false`. +*(Boolean)*: Returns `true` if the `value` is a DOM element, else `false`. #### Example ```js @@ -3148,7 +3148,7 @@ Checks if `value` is empty. Arrays, strings, or `arguments` objects with a lengt 1. `value` *(Array|Object|String)*: The value to inspect. #### Returns -*(Boolean)*: Returns `true`, if the `value` is empty, else `false`. +*(Boolean)*: Returns `true` if the `value` is empty, else `false`. #### Example ```js @@ -3172,7 +3172,7 @@ _.isEmpty(''); ### `_.isEqual(a, b [, callback, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2375 "View in source") [Ⓣ][1] -Performs a deep comparison between two values to determine if they are equivalent to each other. If `callback` is provided, it will be executed to compare values. If `callback` returns `undefined`, comparisons will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(a, b)*. +Performs a deep comparison between two values to determine if they are equivalent to each other. If a callback is provided it will be executed to compare values. If the callback returns `undefined` comparisons will be handled by the method instead. The callback is bound to `thisArg` and invoked with two arguments; *(a, b)*. #### Arguments 1. `a` *(Mixed)*: The value to compare. @@ -3181,7 +3181,7 @@ Performs a deep comparison between two values to determine if they are equivalen 4. `[thisArg]` *(Mixed)*: The `this` binding of `callback`. #### Returns -*(Boolean)*: Returns `true`, if the values are equivalent, else `false`. +*(Boolean)*: Returns `true` if the values are equivalent, else `false`. #### Example ```js @@ -3219,13 +3219,13 @@ _.isEqual(words, otherWords, function(a, b) { Checks if `value` is, or can be coerced to, a finite number. -Note: This is not the same as native `isFinite`, which will return true for booleans and empty strings. See http://es5.github.io/#x15.1.2.5. +Note: This is not the same as native `isFinite` which will return true for booleans and empty strings. See http://es5.github.io/#x15.1.2.5. #### Arguments 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is finite, else `false`. +*(Boolean)*: Returns `true` if the `value` is finite, else `false`. #### Example ```js @@ -3261,7 +3261,7 @@ Checks if `value` is a function. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is a function, else `false`. +*(Boolean)*: Returns `true` if the `value` is a function, else `false`. #### Example ```js @@ -3281,13 +3281,13 @@ _.isFunction(_); Checks if `value` is `NaN`. -Note: This is not the same as native `isNaN`, which will return `true` for `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. +Note: This is not the same as native `isNaN` which will return `true` for `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. #### Arguments 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is `NaN`, else `false`. +*(Boolean)*: Returns `true` if the `value` is `NaN`, else `false`. #### Example ```js @@ -3320,7 +3320,7 @@ Checks if `value` is `null`. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is `null`, else `false`. +*(Boolean)*: Returns `true` if the `value` is `null`, else `false`. #### Example ```js @@ -3349,7 +3349,7 @@ Note: `NaN` is considered a number. See http://es5.github.io/#x8.5. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is a number, else `false`. +*(Boolean)*: Returns `true` if the `value` is a number, else `false`. #### Example ```js @@ -3373,7 +3373,7 @@ Checks if `value` is the language type of Object. *(e.g. arrays, functions, obje 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is an object, else `false`. +*(Boolean)*: Returns `true` if the `value` is an object, else `false`. #### Example ```js @@ -3397,13 +3397,13 @@ _.isObject(1); ### `_.isPlainObject(value)` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2556 "View in source") [Ⓣ][1] -Checks if a given `value` is an object created by the `Object` constructor. +Checks if `value` is an object created by the `Object` constructor. #### Arguments 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if `value` is a plain object, else `false`. +*(Boolean)*: Returns `true` if `value` is a plain object, else `false`. #### Example ```js @@ -3438,7 +3438,7 @@ Checks if `value` is a regular expression. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is a regular expression, else `false`. +*(Boolean)*: Returns `true` if the `value` is a regular expression, else `false`. #### Example ```js @@ -3462,7 +3462,7 @@ Checks if `value` is a string. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is a string, else `false`. +*(Boolean)*: Returns `true` if the `value` is a string, else `false`. #### Example ```js @@ -3486,7 +3486,7 @@ Checks if `value` is `undefined`. 1. `value` *(Mixed)*: The value to check. #### Returns -*(Boolean)*: Returns `true`, if the `value` is `undefined`, else `false`. +*(Boolean)*: Returns `true` if the `value` is `undefined`, else `false`. #### Example ```js @@ -3504,7 +3504,7 @@ _.isUndefined(void 0); ### `_.keys(object)` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L1738 "View in source") [Ⓣ][1] -Creates an array composed of the own enumerable property names of `object`. +Creates an array composed of the own enumerable property names of an object. #### Arguments 1. `object` *(Object)*: The object to inspect. @@ -3528,7 +3528,7 @@ _.keys({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.merge(object [, source1, source2, ..., callback, thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2670 "View in source") [Ⓣ][1] -Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined`, into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a `callback` function is provided, it will be executed to produce the merged values of the destination and source properties. If `callback` returns `undefined`, merging will be handled by the method instead. The `callback` is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. +Recursively merges own enumerable properties of the source object(s), that don't resolve to `undefined` into the destination object. Subsequent sources will overwrite property assignments of previous sources. If a callback is provided it will be executed to produce the merged values of the destination and source properties. If the callback returns `undefined` merging will be handled by the method instead. The callback is bound to `thisArg` and invoked with two arguments; *(objectValue, sourceValue)*. #### Arguments 1. `object` *(Object)*: The destination object. @@ -3584,7 +3584,7 @@ _.merge(food, otherFood, function(a, b) { ### `_.omit(object, callback|[prop1, prop2, ..., thisArg])` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2726 "View in source") [Ⓣ][1] -Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a `callback` function is provided, it will be executed for each property in the `object`, omitting the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. +Creates a shallow clone of `object` excluding the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` omitting the properties the callback returns truthy for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. #### Arguments 1. `object` *(Object)*: The source object. @@ -3615,7 +3615,7 @@ _.omit({ 'name': 'moe', 'age': 40 }, function(value) { ### `_.pairs(object)` # [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2761 "View in source") [Ⓣ][1] -Creates a two dimensional array of the given object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. +Creates a two dimensional array of an object's key-value pairs, i.e. `[[key1, value1], [key2, value2]]`. #### Arguments 1. `object` *(Object)*: The object to inspect. @@ -3637,9 +3637,9 @@ _.pairs({ 'moe': 30, 'larry': 40 }); ### `_.pick(object, callback|[prop1, prop2, ..., thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2800 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2801 "View in source") [Ⓣ][1] -Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If `callback` is provided, it will be executed for each property in the `object`, picking the properties `callback` returns truthy for. The `callback` is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. +Creates a shallow clone of `object` composed of the specified properties. Property names may be specified as individual arguments or as arrays of property names. If a callback is provided it will be executed for each property of `object` picking the properties the callback returns truthy for. The callback is bound to `thisArg` and invoked with three arguments; *(value, key, object)*. #### Arguments 1. `object` *(Object)*: The source object. @@ -3668,9 +3668,9 @@ _.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) { ### `_.transform(collection [, callback=identity, accumulator, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2855 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2856 "View in source") [Ⓣ][1] -An alternative to `_.reduce`, this method transforms an `object` to a new `accumulator` object which is the result of running each of its elements through the `callback`, with each `callback` execution potentially mutating the `accumulator` object. The `callback` is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. +An alternative to `_.reduce` this method transforms `object` to a new `accumulator` object which is the result of running each of its elements through a callback, with each callback execution potentially mutating the `accumulator` object. The callback is bound to `thisArg` and invoked with four arguments; *(accumulator, value, key, object)*. Callbacks may exit iteration early by explicitly returning `false`. #### Arguments 1. `collection` *(Array|Object)*: The collection to iterate over. @@ -3705,7 +3705,7 @@ var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) ### `_.values(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2888 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L2889 "View in source") [Ⓣ][1] Creates an array composed of the own enumerable property values of `object`. @@ -3736,7 +3736,7 @@ _.values({ 'one': 1, 'two': 2, 'three': 3 }); ### `_.escape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5627 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5617 "View in source") [Ⓣ][1] Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding HTML entities. @@ -3760,7 +3760,7 @@ _.escape('Moe, Larry & Curly'); ### `_.identity(value)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5645 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5635 "View in source") [Ⓣ][1] This method returns the first argument provided to it. @@ -3784,13 +3784,14 @@ moe === _.identity(moe); -### `_.mixin(object)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5671 "View in source") [Ⓣ][1] +### `_.mixin(object, object)` +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5662 "View in source") [Ⓣ][1] -Adds functions properties of `object` to the `lodash` function and chainable wrapper. +Adds function properties of a source object to the `lodash` function and chainable wrapper. #### Arguments 1. `object` *(Object)*: The object of function properties to add to `lodash`. +2. `object` *(Object)*: The object of function properties to add to `lodash`. #### Example ```js @@ -3815,7 +3816,7 @@ _('moe').capitalize(); ### `_.noConflict()` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5709 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5700 "View in source") [Ⓣ][1] Reverts the '_' variable to its previous value and returns a reference to the `lodash` function. @@ -3835,9 +3836,9 @@ var lodash = _.noConflict(); ### `_.parseInt(value [, radix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5733 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5724 "View in source") [Ⓣ][1] -Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. +Converts the given `value` into an integer of the specified `radix`. If `radix` is `undefined` or `0` a `radix` of `10` is used unless the `value` is a hexadecimal, in which case a `radix` of `16` is used. Note: This method avoids differences in native ES3 and ES5 `parseInt` implementations. See http://es5.github.io/#E. @@ -3862,9 +3863,9 @@ _.parseInt('08'); ### `_.random([min=0, max=1])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5757 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5748 "View in source") [Ⓣ][1] -Produces a random number between `min` and `max` *(inclusive)*. If only one argument is provided, a number between `0` and the given number will be returned. +Produces a random number between `min` and `max` *(inclusive)*. If only one argument is provided a number between `0` and the given number will be returned. #### Arguments 1. `[min=0]` *(Number)*: The minimum possible value. @@ -3890,9 +3891,9 @@ _.random(5); ### `_.result(object, property)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5801 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5792 "View in source") [Ⓣ][1] -Resolves the value of `property` on `object`. If `property` is a function, it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey, then `undefined` is returned. +Resolves the value of `property` on `object`. If `property` is a function it will be invoked with the `this` binding of `object` and its result returned, else the property value is returned. If `object` is falsey then `undefined` is returned. #### Arguments 1. `object` *(Object)*: The object to inspect. @@ -3943,7 +3944,7 @@ Create a new `lodash` function using the given `context` object. ### `_.template(text, data, options)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5892 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L5883 "View in source") [Ⓣ][1] A micro-templating method that handles arbitrary delimiters, preserves whitespace, and correctly escapes quotes within interpolated code. @@ -4031,9 +4032,9 @@ fs.writeFileSync(path.join(cwd, 'jst.js'), '\ ### `_.times(n, callback [, thisArg])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6017 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6008 "View in source") [Ⓣ][1] -Executes the `callback` function `n` times, returning an array of the results of each `callback` execution. The `callback` is bound to `thisArg` and invoked with one argument; *(index)*. +Executes the callback `n` times, returning an array of the results of each callback execution. The callback is bound to `thisArg` and invoked with one argument; *(index)*. #### Arguments 1. `n` *(Number)*: The number of times to execute the callback. @@ -4063,9 +4064,9 @@ _.times(3, function(n) { this.cast(n); }, mage); ### `_.unescape(string)` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6044 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6035 "View in source") [Ⓣ][1] -The inverse of `_.escape`, this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. +The inverse of `_.escape` this method converts the HTML entities `&`, `<`, `>`, `"`, and `'` in `string` to their corresponding characters. #### Arguments 1. `string` *(String)*: The string to unescape. @@ -4087,9 +4088,9 @@ _.unescape('Moe, Larry & Curly'); ### `_.uniqueId([prefix])` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6064 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6055 "View in source") [Ⓣ][1] -Generates a unique ID. If `prefix` is provided, the ID will be appended to it. +Generates a unique ID. If `prefix` is provided the ID will be appended to it. #### Arguments 1. `[prefix]` *(String)*: The value to prefix the ID with. @@ -4140,7 +4141,7 @@ A reference to the `lodash` function. ### `_.VERSION` -# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6368 "View in source") [Ⓣ][1] +# [Ⓢ](https://github.com/bestiejs/lodash/blob/master/lodash.js#L6360 "View in source") [Ⓣ][1] *(String)*: The semantic version number. diff --git a/doc/parse.php b/doc/parse.php index 184d1f77f..13feb72fe 100644 --- a/doc/parse.php +++ b/doc/parse.php @@ -21,7 +21,7 @@ // generate Markdown $markdown = docdown(array( 'path' => '../' . $file, - 'title' => 'Lo-Dash v1.3.1', + 'title' => 'Lo-Dash v1.3.1', 'toc' => 'categories', 'url' => 'https://github.com/bestiejs/lodash/blob/master/lodash.js' )); diff --git a/lodash.js b/lodash.js index fedea67c3..c376140fb 100644 --- a/lodash.js +++ b/lodash.js @@ -134,7 +134,7 @@ /** Detect free variable `module` */ var freeModule = objectTypes[typeof module] && module && module.exports == freeExports && module; - /** Detect free variable `global`, from Node.js or Browserified code, and use it as `window` */ + /** Detect free variable `global` from Node.js or Browserified code and use it as `window` */ var freeGlobal = objectTypes[typeof global] && global; if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { window = freeGlobal; @@ -219,8 +219,8 @@ } /** - * Used by `_.max` and `_.min` as the default `callback` when a given - * `collection` is a string value. + * Used by `_.max` and `_.min` as the default callback when a given + * collection is a string value. * * @private * @param {String} value The character to inspect. @@ -374,7 +374,7 @@ } /** - * Releases the given `array` back to the array pool. + * Releases the given array back to the array pool. * * @private * @param {Array} [array] The array to release. @@ -387,7 +387,7 @@ } /** - * Releases the given `object` back to the object pool. + * Releases the given object back to the object pool. * * @private * @param {Object} [object] The object to release. @@ -407,7 +407,7 @@ * Slices the `collection` from the `start` index up to, but not including, * the `end` index. * - * Note: This function is used, instead of `Array#slice`, to support node lists + * Note: This function is used instead of `Array#slice` to support node lists * in IE < 9 and to ensure dense arrays are returned. * * @private @@ -551,7 +551,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a `lodash` object, which wraps the given `value`, to enable method + * Creates a `lodash` object which wraps the given value to enable method * chaining. * * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: @@ -1080,7 +1080,7 @@ } /** - * The base implementation of `_.flatten` without support for `callback` + * The base implementation of `_.flatten` without support for callback * shorthands or `thisArg` binding. * * @private @@ -1118,7 +1118,7 @@ * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. * @param {Array} [stackA=[]] Tracks traversed `a` objects. * @param {Array} [stackB=[]] Tracks traversed `b` objects. - * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`. + * @returns {Boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { // used to indicate that when comparing objects, `a` has at least the properties of `b` @@ -1142,7 +1142,7 @@ !(b && objectTypes[otherType])) { return false; } - // exit early for `null` and `undefined`, avoiding ES3's Function#call behavior + // exit early for `null` and `undefined` avoiding ES3's Function#call behavior // http://es5.github.io/#x15.3.4.4 if (a == null || b == null) { return a === b; @@ -1164,7 +1164,7 @@ case boolClass: case dateClass: // coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0`, treating invalid dates coerced to `NaN` as not equal + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal return +a == +b; case numberClass: @@ -1342,12 +1342,12 @@ } /** - * The base implementation of `_.uniq` without support for `callback` shorthands + * The base implementation of `_.uniq` without support for callback shorthands * or `thisArg` binding. * * @private * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. + * @param {Boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function} [callback] The function called per iteration. * @returns {Array} Returns a duplicate-value-free array. */ @@ -1607,14 +1607,14 @@ }; /** - * A fallback implementation of `isPlainObject` which checks if a given `value` + * A fallback implementation of `isPlainObject` which checks if a given value * is an object created by the `Object` constructor, assuming objects created * by the `Object` constructor have no inherited enumerable properties and that * there are no `Object.prototype` extensions. * * @private * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. + * @returns {Boolean} Returns `true` if `value` is a plain object, else `false`. */ function shimIsPlainObject(value) { var ctor, @@ -1666,7 +1666,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an `arguments` object, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an `arguments` object, else `false`. * @example * * (function() { return _.isArguments(arguments); })(1, 2, 3); @@ -1693,7 +1693,7 @@ * @type Function * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an array, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an array, else `false`. * @example * * (function() { return _.isArray(arguments); })(); @@ -1723,7 +1723,7 @@ }); /** - * Creates an array composed of the own enumerable property names of `object`. + * Creates an array composed of the own enumerable property names of an object. * * @static * @memberOf _ @@ -1801,8 +1801,8 @@ /** * A function compiled to iterate `arguments` objects, arrays, objects, and - * strings consistenly across environments, executing the `callback` for each - * element in the `collection`. The `callback` is bound to `thisArg` and invoked + * strings consistenly across environments, executing the callback for each + * element in the collection. The callback is bound to `thisArg` and invoked * with three arguments; (value, index|key, collection). Callbacks may exit * iteration early by explicitly returning `false`. * @@ -1820,9 +1820,9 @@ /** * Assigns own enumerable properties of source object(s) to the destination * object. Subsequent sources will overwrite property assignments of previous - * sources. If a `callback` function is provided, it will be executed to produce - * the assigned values. The `callback` is bound to `thisArg` and invoked with - * two arguments; (objectValue, sourceValue). + * sources. If a callback is provided it will be executed to produce the + * assigned values. The callback is bound to `thisArg` and invoked with two + * arguments; (objectValue, sourceValue). * * @static * @memberOf _ @@ -1861,11 +1861,11 @@ }); /** - * Creates a clone of `value`. If `deep` is `true`, nested objects will also - * be cloned, otherwise they will be assigned by reference. If a `callback` - * function is provided, it will be executed to produce the cloned values. If - * `callback` returns `undefined`, cloning will be handled by the method instead. - * The `callback` is bound to `thisArg` and invoked with one argument; (value). + * Creates a clone of `value`. If `deep` is `true` nested objects will also + * be cloned, otherwise they will be assigned by reference. If a callback + * is provided it will be executed to produce the cloned values. If the + * callback returns `undefined` cloning will be handled by the method instead. + * The callback is bound to `thisArg` and invoked with one argument; (value). * * @static * @memberOf _ @@ -1912,10 +1912,10 @@ } /** - * Creates a deep clone of `value`. If a `callback` function is provided, - * it will be executed to produce the cloned values. If `callback` returns - * `undefined`, cloning will be handled by the method instead. The `callback` - * is bound to `thisArg` and invoked with one argument; (value). + * Creates a deep clone of `value`. If a callback is provided it will be + * executed to produce the cloned values. If the callback returns `undefined` + * cloning will be handled by the method instead. The callback is bound to + * `thisArg` and invoked with one argument; (value). * * Note: This method is loosely based on the structured clone algorithm. Functions * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and @@ -1979,7 +1979,7 @@ var defaults = createIterator(defaultsIteratorOptions); /** - * This method is like `_.findIndex`, except that it returns the key of the + * This method is like `_.findIndex` except that it returns the key of the * first element that passes the callback check, instead of the element itself. * * @static @@ -1987,7 +1987,7 @@ * @category Objects * @param {Object} object The object to search. * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is provided, it will be used to + * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the key of the found element, else `undefined`. @@ -2011,7 +2011,7 @@ } /** - * This method is like `_.findKey`, except that it iterates over elements + * This method is like `_.findKey` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -2019,7 +2019,7 @@ * @category Objects * @param {Object} object The object to search. * @param {Function|Object|String} [callback=identity] The function called per - * iteration. If a property name or object is provided, it will be used to + * iteration. If a property name or object is provided it will be used to * create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the key of the found element, else `undefined`. @@ -2043,10 +2043,10 @@ } /** - * Iterates over own and inherited enumerable properties of a given `object`, - * executing the `callback` for each property. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. + * Iterates over own and inherited enumerable properties of an object, + * executing the callback for each property. The callback is bound to `thisArg` + * and invoked with three arguments; (value, key, object). Callbacks may exit + * iteration early by explicitly returning `false`. * * @static * @memberOf _ @@ -2076,7 +2076,7 @@ }); /** - * This method is like `_.forIn`, except that it iterates over elements + * This method is like `_.forIn` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -2119,10 +2119,10 @@ } /** - * Iterates over own enumerable properties of a given `object`, executing the - * `callback` for each property. The `callback` is bound to `thisArg` and - * invoked with three arguments; (value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. + * Iterates over own enumerable properties of an object, executing the callback + * for each property. The callback is bound to `thisArg` and invoked with three + * arguments; (value, key, object). Callbacks may exit iteration early by + * explicitly returning `false`. * * @static * @memberOf _ @@ -2142,7 +2142,7 @@ var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions); /** - * This method is like `_.forOwn`, except that it iterates over elements + * This method is like `_.forOwn` except that it iterates over elements * of a `collection` in the opposite order. * * @static @@ -2218,7 +2218,7 @@ } /** - * Creates an object composed of the inverted keys and values of the given `object`. + * Creates an object composed of the inverted keys and values of the given object. * * @static * @memberOf _ @@ -2250,7 +2250,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a boolean value, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a boolean value, else `false`. * @example * * _.isBoolean(null); @@ -2267,7 +2267,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a date, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a date, else `false`. * @example * * _.isDate(new Date); @@ -2284,7 +2284,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a DOM element, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a DOM element, else `false`. * @example * * _.isElement(document.body); @@ -2303,7 +2303,7 @@ * @memberOf _ * @category Objects * @param {Array|Object|String} value The value to inspect. - * @returns {Boolean} Returns `true`, if the `value` is empty, else `false`. + * @returns {Boolean} Returns `true` if the `value` is empty, else `false`. * @example * * _.isEmpty([1, 2, 3]); @@ -2336,10 +2336,10 @@ /** * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If `callback` is provided, it will be executed to - * compare values. If `callback` returns `undefined`, comparisons will be handled - * by the method instead. The `callback` is bound to `thisArg` and invoked with - * two arguments; (a, b). + * equivalent to each other. If a callback is provided it will be executed + * to compare values. If the callback returns `undefined` comparisons will + * be handled by the method instead. The callback is bound to `thisArg` and + * invoked with two arguments; (a, b). * * @static * @memberOf _ @@ -2348,7 +2348,7 @@ * @param {Mixed} b The other value to compare. * @param {Function} [callback] The function to customize comparing values. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Boolean} Returns `true`, if the values are equivalent, else `false`. + * @returns {Boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var moe = { 'name': 'moe', 'age': 40 }; @@ -2379,14 +2379,14 @@ /** * Checks if `value` is, or can be coerced to, a finite number. * - * Note: This is not the same as native `isFinite`, which will return true for + * Note: This is not the same as native `isFinite` which will return true for * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is finite, else `false`. + * @returns {Boolean} Returns `true` if the `value` is finite, else `false`. * @example * * _.isFinite(-101); @@ -2415,7 +2415,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a function, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a function, else `false`. * @example * * _.isFunction(_); @@ -2439,7 +2439,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is an object, else `false`. + * @returns {Boolean} Returns `true` if the `value` is an object, else `false`. * @example * * _.isObject({}); @@ -2462,14 +2462,14 @@ /** * Checks if `value` is `NaN`. * - * Note: This is not the same as native `isNaN`, which will return `true` for + * Note: This is not the same as native `isNaN` which will return `true` for * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `NaN`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `NaN`, else `false`. * @example * * _.isNaN(NaN); @@ -2497,7 +2497,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `null`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `null`, else `false`. * @example * * _.isNull(null); @@ -2519,7 +2519,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a number, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a number, else `false`. * @example * * _.isNumber(8.4 * 5); @@ -2530,13 +2530,13 @@ } /** - * Checks if a given `value` is an object created by the `Object` constructor. + * Checks if `value` is an object created by the `Object` constructor. * * @static * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if `value` is a plain object, else `false`. + * @returns {Boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Stooge(name, age) { @@ -2572,7 +2572,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a regular expression, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a regular expression, else `false`. * @example * * _.isRegExp(/moe/); @@ -2589,7 +2589,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is a string, else `false`. + * @returns {Boolean} Returns `true` if the `value` is a string, else `false`. * @example * * _.isString('moe'); @@ -2606,7 +2606,7 @@ * @memberOf _ * @category Objects * @param {Mixed} value The value to check. - * @returns {Boolean} Returns `true`, if the `value` is `undefined`, else `false`. + * @returns {Boolean} Returns `true` if the `value` is `undefined`, else `false`. * @example * * _.isUndefined(void 0); @@ -2618,11 +2618,11 @@ /** * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined`, into the destination object. Subsequent sources - * will overwrite property assignments of previous sources. If a `callback` function - * is provided, it will be executed to produce the merged values of the destination - * and source properties. If `callback` returns `undefined`, merging will be - * handled by the method instead. The `callback` is bound to `thisArg` and + * don't resolve to `undefined` into the destination object. Subsequent sources + * will overwrite property assignments of previous sources. If a callback is + * provided it will be executed to produce the merged values of the destination + * and source properties. If the callback returns `undefined` merging will + * be handled by the method instead. The callback is bound to `thisArg` and * invoked with two arguments; (objectValue, sourceValue). * * @static @@ -2700,10 +2700,10 @@ /** * Creates a shallow clone of `object` excluding the specified properties. * Property names may be specified as individual arguments or as arrays of - * property names. If a `callback` function is provided, it will be executed - * for each property in the `object`, omitting the properties `callback` - * returns truthy for. The `callback` is bound to `thisArg` and invoked - * with three arguments; (value, key, object). + * property names. If a callback is provided it will be executed for each + * property of `object` omitting the properties the callback returns truthy + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). * * @static * @memberOf _ @@ -2745,7 +2745,7 @@ } /** - * Creates a two dimensional array of the given object's key-value pairs, + * Creates a two dimensional array of an object's key-value pairs, * i.e. `[[key1, value1], [key2, value2]]`. * * @static @@ -2773,10 +2773,11 @@ /** * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of property - * names. If `callback` is provided, it will be executed for each property in the - * `object`, picking the properties `callback` returns truthy for. The `callback` - * is bound to `thisArg` and invoked with three arguments; (value, key, object). + * Property names may be specified as individual arguments or as arrays of + * property names. If a callback is provided it will be executed for each + * property of `object` picking the properties the callback returns truthy + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). * * @static * @memberOf _ @@ -2822,10 +2823,10 @@ } /** - * An alternative to `_.reduce`, this method transforms an `object` to a new + * An alternative to `_.reduce` this method transforms `object` to a new * `accumulator` object which is the result of running each of its elements - * through the `callback`, with each `callback` execution potentially mutating - * the `accumulator` object. The `callback` is bound to `thisArg` and invoked + * through a callback, with each callback execution potentially mutating + * the `accumulator` object. The callback is bound to `thisArg` and invoked * with four arguments; (accumulator, value, key, object). Callbacks may exit * iteration early by explicitly returning `false`. * @@ -2936,9 +2937,9 @@ } /** - * Checks if a given `target` element is present in a `collection` using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. + * Checks if a given value is present in a collection using strict equality + * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the + * offset from the end of the collection. * * @static * @memberOf _ @@ -2986,15 +2987,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the given `callback`. The corresponding - * value of each key is the number of times the key was returned by the `callback`. - * The `callback` is bound to `thisArg` and invoked with three arguments; + * each element of `collection` through the callback. The corresponding value + * of each key is the number of times the key was returned by the callback. + * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3003,7 +3004,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -3023,14 +3024,14 @@ }); /** - * Checks if the `callback` returns a truthy value for **all** elements of a - * `collection`. The `callback` is bound to `thisArg` and invoked with three + * Checks if the given callback returns truthy value for **all** elements of + * a collection. The callback is bound to `thisArg` and invoked with three * arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3040,7 +3041,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Boolean} Returns `true` if all elements passed the callback check, @@ -3085,14 +3086,14 @@ } /** - * Iterates over elements of a `collection`, returning an array of all elements - * the `callback` returns truthy for. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index|key, collection). + * Iterates over elements of a collection, returning an array of all elements + * the callback returns truthy for. The callback is bound to `thisArg` and + * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3102,7 +3103,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of elements that passed the callback check. @@ -3149,14 +3150,14 @@ } /** - * Iterates over elements of a `collection`, returning the first that the - * `callback` returns truthy for. The `callback` is bound to `thisArg` and + * Iterates over elements of a collection, returning the first element that + * the callback returns truthy for. The callback is bound to `thisArg` and * invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3166,7 +3167,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the found element, else `undefined`. @@ -3217,7 +3218,7 @@ } /** - * This method is like `_.find`, except that it iterates over elements + * This method is like `_.find` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -3225,7 +3226,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the found element, else `undefined`. @@ -3249,10 +3250,10 @@ } /** - * Iterates over elements of a `collection`, executing the `callback` for - * each element. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). Callbacks may exit iteration - * early by explicitly returning `false`. + * Iterates over elements of a collection, executing the callback for each + * element. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). Callbacks may exit iteration early by + * explicitly returning `false`. * * @static * @memberOf _ @@ -3287,7 +3288,7 @@ } /** - * This method is like `_.forEach`, except that it iterates over elements + * This method is like `_.forEach` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -3323,15 +3324,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the `callback`. The corresponding - * value of each key is an array of the elements responsible for generating - * the key. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). + * each element of a collection through the callback. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false` * @@ -3340,7 +3341,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -3362,15 +3363,15 @@ /** * Creates an object composed of keys generated from the results of running - * each element of the `collection` through the given `callback`. The corresponding + * each element of the collection through the given callback. The corresponding * value of each key is the last element responsible for generating the key. - * The `callback` is bound to `thisArg` and invoked with three arguments; + * The callback is bound to `thisArg` and invoked with three arguments; * (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3379,7 +3380,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Object} Returns the composed aggregate object. @@ -3404,10 +3405,10 @@ }); /** - * Invokes the method named by `methodName` on each element in the `collection`, + * Invokes the method named by `methodName` on each element in the `collection` * returning an array of the results of each invoked method. Additional arguments - * will be provided to each invoked method. If `methodName` is a function, it will - * be invoked for, and `this` bound to, each element in the `collection`. + * will be provided to each invoked method. If `methodName` is a function it + * will be invoked for, and `this` bound to, each element in the `collection`. * * @static * @memberOf _ @@ -3439,14 +3440,14 @@ } /** - * Creates an array of values by running each element in the `collection` - * through the `callback`. The `callback` is bound to `thisArg` and invoked with + * Creates an array of values by running each element in the collection + * through the callback. The callback is bound to `thisArg` and invoked with * three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3456,7 +3457,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of the results of each `callback` execution. @@ -3496,15 +3497,15 @@ } /** - * Retrieves the maximum value of an `array`. If `callback` is provided, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, collection). + * Retrieves the maximum value of an array. If a callback is provided it + * will be executed for each value in the array to generate the criterion by + * which the value is ranked. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3513,7 +3514,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the maximum value. @@ -3565,15 +3566,15 @@ } /** - * Retrieves the minimum value of an `array`. If `callback` is provided, - * it will be executed for each value in the `array` to generate the - * criterion by which the value is ranked. The `callback` is bound to `thisArg` - * and invoked with three arguments; (value, index, collection). + * Retrieves the minimum value of an array. If a callback is provided it + * will be executed for each value in the array to generate the criterion by + * which the value is ranked. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3582,7 +3583,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the minimum value. @@ -3656,11 +3657,11 @@ var pluck = map; /** - * Reduces a `collection` to a value which is the accumulated result of running - * each element in the `collection` through the `callback`, where each successive - * `callback` execution consumes the return value of the previous execution. - * If `accumulator` is not provided, the first element of the `collection` will be - * used as the initial `accumulator` value. The `callback` is bound to `thisArg` + * Reduces a collection to a value which is the accumulated result of running + * each element in the collection through the callback, where each successive + * callback execution consumes the return value of the previous execution. If + * `accumulator` is not provided the first element of the collection will be + * used as the initial `accumulator` value. The callback is bound to `thisArg` * and invoked with four arguments; (accumulator, value, index|key, collection). * * @static @@ -3710,7 +3711,7 @@ } /** - * This method is like `_.reduce`, except that it iterates over elements + * This method is like `_.reduce` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -3740,13 +3741,13 @@ } /** - * The opposite of `_.filter`, this method returns the elements of a - * `collection` that `callback` does **not** return truthy for. + * The opposite of `_.filter` this method returns the elements of a + * collection that the callback does **not** return truthy for. * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3755,11 +3756,10 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that did **not** pass the - * callback check. + * @returns {Array} Returns a new array of elements that failed the callback check. * @example * * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); @@ -3786,67 +3786,8 @@ } /** - * Removes all elements from the `collection` that thw `callback` returns truthy - * for and returns an array of removed elements. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback`, the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback`, the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|String} collection The collection to modify. - * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4, 5, 6]; - * var evens = _.remove(array, function(num) { return num % 2 == 0; }); - * - * console.log(array); - * // => [1, 3, 5] - * - * console.log(evens); - * // => [2, 4, 6] - */ - function remove(collection, callback, thisArg) { - var result = []; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - result.push(value); - splice.call(collection, index--, 1); - length--; - } - } - } else { - baseEach(collection, function(value, key, collection) { - if (callback(value, key, collection)) { - result.push(value); - delete collection[key]; - } - }); - } - return result; - } - - /** - * Creates an array of shuffled `array` values, using a version of the - * Fisher-Yates shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. + * Creates an array of shuffled values, using a version of the Fisher-Yates + * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. * * @static * @memberOf _ @@ -3897,15 +3838,15 @@ } /** - * 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 + * Checks if the callback returns a truthy value for **any** element of a + * collection. The function returns as soon as it finds a passing value and + * does not iterate over the entire collection. The callback is bound to * `thisArg` and invoked with three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3915,7 +3856,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Boolean} Returns `true` if any element passed the callback check, @@ -3961,15 +3902,15 @@ /** * Creates an array of elements, sorted in ascending order by the results of - * running each element in the `collection` through the `callback`. This method - * performs a stable sort, that is, it will preserve the original sort order of - * equal elements. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). + * running each element in a collection through the callback. This method + * performs a stable sort, that is, it will preserve the original sort order + * of equal elements. The callback is bound to `thisArg` and invoked with + * three arguments; (value, index|key, collection). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -3978,7 +3919,7 @@ * @category Collections * @param {Array|Object|String} collection The collection to iterate over. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new array of sorted elements. @@ -4069,8 +4010,8 @@ /*--------------------------------------------------------------------------*/ /** - * Creates an array with all falsey values of `array` removed. The values - * `false`, `null`, `0`, `""`, `undefined` and `NaN` are all falsey. + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are all falsey. * * @static * @memberOf _ @@ -4142,7 +4083,7 @@ } /** - * This method is like `_.find`, except that it returns the index of the first + * This method is like `_.find` except that it returns the index of the first * element that passes the callback check, instead of the element itself. * * @static @@ -4150,7 +4091,7 @@ * @category Arrays * @param {Array} array The array to search. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the index of the found element, else `-1`. @@ -4175,7 +4116,7 @@ } /** - * This method is like `_.findIndex`, except that it iterates over elements + * This method is like `_.findIndex` except that it iterates over elements * of a `collection` from right to left. * * @static @@ -4183,7 +4124,7 @@ * @category Arrays * @param {Array} array The array to search. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the index of the found element, else `-1`. @@ -4206,16 +4147,16 @@ } /** - * Gets the first element of the `array`. If a number `n` is provided, the first - * `n` elements of the `array` are returned. If a `callback` function is provided, - * elements at the beginning of the array are returned as long as the `callback` - * returns truthy. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index, array). + * Gets the first element of an array. If a number `n` is provided the first + * `n` elements of the array are returned. If a callback is provided elements + * at the beginning of the array are returned as long as the callback returns + * truthy. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4226,7 +4167,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n] The function called * per element or the number of elements to return. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the first element(s) of `array`. @@ -4285,15 +4226,15 @@ /** * Flattens a nested array (the nesting can be to any depth). If `isShallow` - * is truthy, `array` will only be flattened a single level. If `callback` - * is provided, each element of `array` is provided through a `callback` before - * flattening. The `callback` is bound to `thisArg` and invoked with three + * is truthy, the array will only be flattened a single level. If a callback + * is provided each element of the array is passed through the callback before + * flattening. The callback is bound to `thisArg` and invoked with three * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4303,7 +4244,7 @@ * @param {Array} array The array to flatten. * @param {Boolean} [isShallow=false] A flag to restrict flattening to a single level. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a new flattened array. @@ -4339,16 +4280,16 @@ /** * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the `array` is already - * sorted, passing `true` for `fromIndex` will run a faster binary search. + * strict equality for comparisons, i.e. `===`. If the array is already sorted + * providing `true` for `fromIndex` will run a faster binary search. * * @static * @memberOf _ * @category Arrays * @param {Array} array The array to search. * @param {Mixed} value The value to search for. - * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` to - * perform a binary search on a sorted `array`. + * @param {Boolean|Number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. * @returns {Number} Returns the index of the matched value or `-1`. * @example * @@ -4373,16 +4314,16 @@ } /** - * Gets all but the last element of `array`. If a number `n` is provided, the - * last `n` elements are excluded from the result. If a `callback` function - * is provided, elements at the end of the array are excluded from the result - * as long as the `callback` returns truthy. The `callback` is bound to - * `thisArg` and invoked with three arguments; (value, index, array). + * Gets all but the last element of an array. If a number `n` is provided + * the last `n` elements are excluded from the result. If a callback is + * provided elements at the end of the array are excluded from the result + * as long as the callback returns truthy. The callback is bound to `thisArg` + * and invoked with three arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4392,7 +4333,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n=1] The function called * per element or the number of elements to exclude. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. @@ -4507,17 +4448,17 @@ } /** - * Gets the last element of the `array`. If a number `n` is provided, the - * last `n` elements of the `array` are returned. If a `callback` function - * is provided, elements at the end of the array are returned as long as the - * `callback` returns truthy. The `callback` is bound to `thisArg` and - * invoked with three arguments;(value, index, array). + * Gets the last element of an array. If a number `n` is provided the last + * `n` elements of the array are returned. If a callback is provided elements + * at the end of the array are returned as long as the callback returns truthy. + * The callback is bound to `thisArg` and invoked with three arguments; + * (value, index, array). * * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4527,7 +4468,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n] The function called * per element or the number of elements to return. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Mixed} Returns the last element(s) of `array`. @@ -4706,18 +4647,68 @@ return result; } + /** - * The opposite of `_.initial`, this method gets all but the first value of - * `array`. If a number `n` is provided, the first `n` values are excluded from - * the result. If a `callback` function is provided, elements at the beginning - * of the array are excluded from the result as long as the `callback` returns - * truthy. The `callback` is bound to `thisArg` and invoked with three - * arguments; (value, index, array). + * Removes all elements from the given array that the callback returns truthy + * for and returns an array of removed elements. The callback is bound to + * `thisArg` and invoked with three arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback + * will return `true` for elements that have the properties of the given object, + * else `false`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array|Object|String} array The array to modify. + * @param {Function|Object|String} [callback=identity] The function called + * per iteration. If a property name or object is provided it will be used + * to create a "_.pluck" or "_.where" style callback, respectively. + * @param {Mixed} [thisArg] The `this` binding of `callback`. + * @returns {Array} Returns a new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4, 5, 6]; + * var evens = _.remove(array, function(num) { return num % 2 == 0; }); + * + * console.log(array); + * // => [1, 3, 5] + * + * console.log(evens); + * // => [2, 4, 6] + */ + function remove(array, callback, thisArg) { + var index = -1, + length = array.length, + result = []; + + callback = lodash.createCallback(callback, thisArg, 3); + while (++index < length) { + var value = array[index]; + if (callback(value, index, array)) { + result.push(value); + splice.call(array, index--, 1); + length--; + } + } + return result; + } + + /** + * The opposite of `_.initial` this method gets all but the first value of + * an array. If a number `n` is provided the first `n` values are excluded + * from the result. If a callback function is provided elements at the beginning + * of the array are excluded from the result as long as the callback returns + * truthy. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index, array). + * + * If a property name is provided for `callback` the created "_.pluck" style + * callback will return the property value of the given element. + * + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4728,7 +4719,7 @@ * @param {Array} array The array to query. * @param {Function|Object|Number|String} [callback|n=1] The function called * per element or the number of elements to exclude. If a property name or - * object is provided, it will be used to create a "_.pluck" or "_.where" + * object is provided it will be used to create a "_.pluck" or "_.where" * style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a slice of `array`. @@ -4781,16 +4772,16 @@ } /** - * 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 provided, it will be executed for `value` - * and each element in `array` to compute their sort ranking. The `callback` - * is bound to `thisArg` and invoked with one argument; (value). + * Uses a binary search to determine the smallest index at which a value + * should be inserted into a given sorted array in order to maintain the sort + * order of the array. If a callback is provided it will be executed for + * `value` and each element of `array` to compute their sort ranking. The + * callback is bound to `thisArg` and invoked with one argument; (value). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4800,10 +4791,10 @@ * @param {Array} array The array to inspect. * @param {Mixed} value The value to evaluate. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. - * @returns {Number} Returns the index at which the value should be inserted + * @returns {Number} Returns the index at which `value` should be inserted * into `array`. * @example * @@ -4864,17 +4855,17 @@ } /** - * Creates a duplicate-value-free version of the `array` using strict equality - * for comparisons, i.e. `===`. If the `array` is already sorted, passing `true` - * for `isSorted` will run a faster algorithm. If `callback` is provided, each - * element of `array` is provided through the `callback` before uniqueness is - * computed. The `callback` is bound to `thisArg` and invoked with three arguments; - * (value, index, array). + * Creates a duplicate-value-free version of an array using strict equality + * for comparisons, i.e. `===`. If the array is sorted, providing + * `true` for `isSorted` will use a faster algorithm. If a callback is provided + * each element of `array` is passed through the callback before uniqueness + * is computed. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index, array). * - * If a property name is provided for `callback`, the created "_.pluck" style + * If a property name is provided for `callback` the created "_.pluck" style * callback will return the property value of the given element. * - * If an object is provided for `callback`, the created "_.where" style callback + * If an object is provided for `callback` the created "_.where" style callback * will return `true` for elements that have the properties of the given object, * else `false`. * @@ -4883,9 +4874,9 @@ * @alias unique * @category Arrays * @param {Array} array The array to process. - * @param {Boolean} [isSorted=false] A flag to indicate that the `array` is already sorted. + * @param {Boolean} [isSorted=false] A flag to indicate that `array` is sorted. * @param {Function|Object|String} [callback=identity] The function called - * per iteration. If a property name or object is provided, it will be used + * per iteration. If a property name or object is provided it will be used * to create a "_.pluck" or "_.where" style callback, respectively. * @param {Mixed} [thisArg] The `this` binding of `callback`. * @returns {Array} Returns a duplicate-value-free array. @@ -4968,9 +4959,9 @@ } /** - * Creates an object composed from arrays of `keys` and `values`. Pass either - * a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]`, or - * two arrays, one of `keys` and one of corresponding `values`. + * Creates an object composed from arrays of `keys` and `values`. Provide + * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` + * or two arrays, one of `keys` and one of corresponding `values`. * * @static * @memberOf _ @@ -5004,7 +4995,7 @@ /*--------------------------------------------------------------------------*/ /** - * Creates a function this is restricted to executing `func`, with the `this` + * Creates a function this is restricted to executing `func` with the `this` * binding and arguments of the created function, only after it is called `n` times. * * @static @@ -5057,10 +5048,10 @@ } /** - * Binds methods on `object` to `object`, overwriting the existing method. - * Method names may be specified as individual arguments or as arrays of method - * names. If no method names are provided, all the function properties of `object` - * will be bound. + * Binds methods of an object to the object itself, overwriting the existing + * method. Method names may be specified as individual arguments or as arrays + * of method names. If no method names are provided all the function properties + * of `object` will be bound. * * @static * @memberOf _ @@ -5175,8 +5166,8 @@ /** * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name, the created callback will return the property value for a given element. - * If `func` is an object, the created callback will return `true` for elements + * name the created callback will return the property value for a given element. + * If `func` is an object the created callback will return `true` for elements * that contain the equivalent object properties, otherwise it will return `false`. * * @static @@ -5221,7 +5212,7 @@ // handle "_.where" style callback shorthands if (props.length == 1 && a === a && !isObject(a)) { - // fast path the common case of passing an object with a single + // fast path the common case of providing an object with a single // property containing a primitive value return function(object) { var b = object[key]; @@ -5243,12 +5234,12 @@ /** * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. Pass - * an `options` object to indicate that `func` should be invoked on the leading - * and/or trailing edge of the `wait` timeout. Subsequent calls to the debounced - * function will return the result of the last `func` call. + * `wait` milliseconds have elapsed since the last time it was invoked. + * Provide an options object to indicate that `func` should be invoked on + * the leading and/or trailing edge of the `wait` timeout. Subsequent calls + * to the debounced function will return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true`, `func` will be called + * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the debounced function is * invoked more than once during the `wait` timeout. * @@ -5410,7 +5401,7 @@ /** * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it will be used to determine the cache key for storing the result + * provided it will be used to determine the cache key for storing the result * based on the arguments provided to the memoized function. By default, the * first argument provided to the memoized function is used as the cache key. * The `func` is executed with the `this` binding of the memoized function. @@ -5478,7 +5469,7 @@ /** * Creates a function that, when called, invokes `func` with any additional * `partial` arguments prepended to those provided to the new function. This - * method is similar to `_.bind`, except it does **not** alter the `this` binding. + * method is similar to `_.bind` except it does **not** alter the `this` binding. * * @static * @memberOf _ @@ -5498,7 +5489,7 @@ } /** - * This method is like `_.partial`, except that `partial` arguments are + * This method is like `_.partial` except that `partial` arguments are * appended to those provided to the new function. * * @static @@ -5530,12 +5521,12 @@ /** * Creates a function that, when executed, will only call the `func` function - * at most once per every `wait` milliseconds. Pass an `options` object to + * at most once per every `wait` milliseconds. Provide an options object to * indicate that `func` should be invoked on the leading and/or trailing edge * of the `wait` timeout. Subsequent calls to the throttled function will * return the result of the last `func` call. * - * Note: If `leading` and `trailing` options are `true`, `func` will be called + * Note: If `leading` and `trailing` options are `true` `func` will be called * on the trailing edge of the timeout only if the the throttled function is * invoked more than once during the `wait` timeout. * @@ -5580,9 +5571,9 @@ } /** - * Creates a function that passes `value` to the `wrapper` function as its + * Creates a function that provides `value` to the wrapper function as its * first argument. Additional arguments provided to the function are appended - * to those provided to the `wrapper` function. The `wrapper` is executed with + * to those provided to the wrapper function. The wrapper is executed with * the `this` binding of the created function. * * @static @@ -5647,13 +5638,14 @@ } /** - * Adds functions properties of `object` to the `lodash` function and chainable - * wrapper. + * Adds function properties of a source object to the `lodash` function and + * chainable wrapper. * * @static * @memberOf _ * @category Utilities * @param {Object} object The object of function properties to add to `lodash`. + * @param {Object} object The object of function properties to add to `lodash`. * @example * * _.mixin({ @@ -5713,7 +5705,7 @@ /** * Converts the given `value` into an integer of the specified `radix`. - * If `radix` is `undefined` or `0`, a `radix` of `10` is used unless the + * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the * `value` is a hexadecimal, in which case a `radix` of `16` is used. * * Note: This method avoids differences in native ES3 and ES5 `parseInt` @@ -5737,7 +5729,7 @@ /** * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided, a number between `0` and the given number will be + * argument is provided a number between `0` and the given number will be * returned. * * @static @@ -5772,9 +5764,9 @@ } /** - * Resolves the value of `property` on `object`. If `property` is a function, + * Resolves the value of `property` on `object`. If `property` is a function * it will be invoked with the `this` binding of `object` and its result returned, - * else the property value is returned. If `object` is falsey, then `undefined` + * else the property value is returned. If `object` is falsey then `undefined` * is returned. * * @static @@ -5992,8 +5984,8 @@ } /** - * Executes the `callback` function `n` times, returning an array of the results - * of each `callback` execution. The `callback` is bound to `thisArg` and invoked + * Executes the callback `n` times, returning an array of the results + * of each callback execution. The callback is bound to `thisArg` and invoked * with one argument; (index). * * @static @@ -6027,7 +6019,7 @@ } /** - * The inverse of `_.escape`, this method converts the HTML entities + * The inverse of `_.escape` this method converts the HTML entities * `&`, `<`, `>`, `"`, and `'` in `string` to their * corresponding characters. * @@ -6046,7 +6038,7 @@ } /** - * Generates a unique ID. If `prefix` is provided, the ID will be appended to it. + * Generates a unique ID. If `prefix` is provided the ID will be appended to it. * * @static * @memberOf _ @@ -6097,14 +6089,15 @@ } /** - * 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. + * Invokes `interceptor` with the `value` as the first argument and then + * returns `value`. The purpose of this method is to "tap into" a method + * chain in order to perform operations on intermediate results within + * the chain. * * @static * @memberOf _ * @category Chaining - * @param {Mixed} value The value to pass to `interceptor`. + * @param {Mixed} value The value to provide to `interceptor`. * @param {Function} interceptor The function to invoke. * @returns {Mixed} Returns `value`. * @example