Comparing version 3.2.0 to 3.3.0
@@ -23,3 +23,3 @@ import baseDifference from '../internal/baseDifference'; | ||
* | ||
* _.difference([1, 2, 3], [5, 2, 10]); | ||
* _.difference([1, 2, 3], [4, 2]); | ||
* // => [1, 3] | ||
@@ -26,0 +26,0 @@ */ |
@@ -9,10 +9,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that match the properties of the given | ||
@@ -26,3 +26,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per element. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -32,20 +32,22 @@ * @returns {Array} Returns the slice of `array`. | ||
* | ||
* _.dropRightWhile([1, 2, 3], function(n) { return n > 1; }); | ||
* _.dropRightWhile([1, 2, 3], function(n) { | ||
* return n > 1; | ||
* }); | ||
* // => [1] | ||
* | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': false } | ||
* { 'user': 'barney', 'active': true }, | ||
* { 'user': 'fred', 'active': false }, | ||
* { 'user': 'pebbles', 'active': false } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.dropRightWhile(users, { 'age': 1, 'active': false }), 'user'); | ||
* // using the `_.matches` callback shorthand | ||
* _.pluck(_.dropRightWhile(users, { 'user': pebbles, 'active': false }), 'user'); | ||
* // => ['barney', 'fred'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.pluck(_.dropRightWhile(users, 'active', false), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.pluck(_.dropRightWhile(users, 'active'), 'user'); | ||
@@ -52,0 +54,0 @@ * // => ['barney', 'fred', 'pebbles'] |
@@ -9,10 +9,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -26,3 +26,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per element. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -32,20 +32,22 @@ * @returns {Array} Returns the slice of `array`. | ||
* | ||
* _.dropWhile([1, 2, 3], function(n) { return n < 3; }); | ||
* _.dropWhile([1, 2, 3], function(n) { | ||
* return n < 3; | ||
* }); | ||
* // => [3] | ||
* | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': true } | ||
* { 'user': 'barney', 'active': false }, | ||
* { 'user': 'fred', 'active': false }, | ||
* { 'user': 'pebbles', 'active': true } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.dropWhile(users, { 'age': 36, 'active': false }), 'user'); | ||
* // using the `_.matches` callback shorthand | ||
* _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user'); | ||
* // => ['fred', 'pebbles'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.pluck(_.dropWhile(users, 'active', false), 'user'); | ||
* // => ['pebbles'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.pluck(_.dropWhile(users, 'active'), 'user'); | ||
@@ -52,0 +54,0 @@ * // => ['barney', 'fred', 'pebbles'] |
@@ -10,3 +10,5 @@ import baseFill from '../internal/baseFill'; | ||
* | ||
* @private | ||
* @static | ||
* @memberOf _ | ||
* @category Array | ||
* @param {Array} array The array to fill. | ||
@@ -13,0 +15,0 @@ * @param {*} value The value to fill `array` with. |
@@ -7,10 +7,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -24,4 +24,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -32,21 +31,23 @@ * @returns {number} Returns the index of the found element, else `-1`. | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': true }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': false } | ||
* { 'user': 'barney', 'active': false }, | ||
* { 'user': 'fred', 'active': false }, | ||
* { 'user': 'pebbles', 'active': true } | ||
* ]; | ||
* | ||
* _.findIndex(users, function(chr) { return chr.age < 40; }); | ||
* _.findIndex(users, function(chr) { | ||
* return chr.user == 'barney'; | ||
* }); | ||
* // => 0 | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.findIndex(users, { 'age': 40, 'active': true }); | ||
* // using the `_.matches` callback shorthand | ||
* _.findIndex(users, { 'user': 'fred', 'active': false }); | ||
* // => 1 | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.findIndex(users, 'age', 1); | ||
* // => 2 | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.findIndex(users, 'active', false); | ||
* // => 0 | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.findIndex(users, 'active'); | ||
* // => 1 | ||
* // => 2 | ||
*/ | ||
@@ -53,0 +54,0 @@ function findIndex(array, predicate, thisArg) { |
@@ -7,10 +7,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -24,4 +24,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -32,19 +31,21 @@ * @returns {number} Returns the index of the found element, else `-1`. | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': false } | ||
* { 'user': 'barney', 'active': true }, | ||
* { 'user': 'fred', 'active': false }, | ||
* { 'user': 'pebbles', 'active': false } | ||
* ]; | ||
* | ||
* _.findLastIndex(users, function(chr) { return chr.age < 40; }); | ||
* _.findLastIndex(users, function(chr) { | ||
* return chr.user == 'pebbles'; | ||
* }); | ||
* // => 2 | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.findLastIndex(users, { 'age': 36, 'active': true }); | ||
* // using the `_.matches` callback shorthand | ||
* _.findLastIndex(users, { user': 'barney', 'active': true }); | ||
* // => 0 | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* _.findLastIndex(users, 'age', 40); | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.findLastIndex(users, 'active', false); | ||
* // => 1 | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.findLastIndex(users, 'active'); | ||
@@ -51,0 +52,0 @@ * // => 0 |
@@ -17,7 +17,7 @@ import baseFlatten from '../internal/baseFlatten'; | ||
* | ||
* _.flatten([1, [2], [3, [[4]]]]); | ||
* // => [1, 2, 3, [[4]]]; | ||
* _.flatten([1, [2, 3, [4]]]); | ||
* // => [1, 2, 3, [4]]; | ||
* | ||
* // using `isDeep` | ||
* _.flatten([1, [2], [3, [[4]]]], true); | ||
* _.flatten([1, [2, 3, [4]]], true); | ||
* // => [1, 2, 3, 4]; | ||
@@ -24,0 +24,0 @@ */ |
@@ -13,3 +13,3 @@ import baseFlatten from '../internal/baseFlatten'; | ||
* | ||
* _.flattenDeep([1, [2], [3, [[4]]]]); | ||
* _.flattenDeep([1, [2, 3, [4]]]); | ||
* // => [1, 2, 3, 4]; | ||
@@ -16,0 +16,0 @@ */ |
@@ -28,11 +28,11 @@ import baseIndexOf from '../internal/baseIndexOf'; | ||
* | ||
* _.indexOf([1, 2, 3, 1, 2, 3], 2); | ||
* // => 1 | ||
* _.indexOf([1, 2, 1, 2], 2); | ||
* // => 2 | ||
* | ||
* // using `fromIndex` | ||
* _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); | ||
* // => 4 | ||
* _.indexOf([1, 2, 1, 2], 2, 2); | ||
* // => 3 | ||
* | ||
* // performing a binary search | ||
* _.indexOf([4, 4, 5, 5, 6, 6], 5, true); | ||
* _.indexOf([1, 1, 2, 2], 2, true); | ||
* // => 2 | ||
@@ -39,0 +39,0 @@ */ |
@@ -22,5 +22,4 @@ import baseIndexOf from '../internal/baseIndexOf'; | ||
* @example | ||
* | ||
* _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); | ||
* // => [1, 2] | ||
* _.intersection([1, 2], [4, 2], [2, 1]); | ||
* // => [2] | ||
*/ | ||
@@ -27,0 +26,0 @@ function intersection() { |
@@ -22,11 +22,11 @@ import binaryIndex from '../internal/binaryIndex'; | ||
* | ||
* _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); | ||
* // => 4 | ||
* _.lastIndexOf([1, 2, 1, 2], 2); | ||
* // => 3 | ||
* | ||
* // using `fromIndex` | ||
* _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); | ||
* _.lastIndexOf([1, 2, 1, 2], 2, 2); | ||
* // => 1 | ||
* | ||
* // performing a binary search | ||
* _.lastIndexOf([4, 4, 5, 5, 6, 6], 5, true); | ||
* _.lastIndexOf([1, 1, 2, 2], 2, true); | ||
* // => 3 | ||
@@ -33,0 +33,0 @@ */ |
@@ -28,2 +28,3 @@ import baseIndexOf from '../internal/baseIndexOf'; | ||
* var array = [1, 2, 3, 1, 2, 3]; | ||
* | ||
* _.pull(array, 2, 3); | ||
@@ -30,0 +31,0 @@ * console.log(array); |
@@ -21,3 +21,3 @@ import baseFlatten from '../internal/baseFlatten'; | ||
* var array = [5, 10, 15, 20]; | ||
* var evens = _.pullAt(array, [1, 3]); | ||
* var evens = _.pullAt(array, 1, 3); | ||
* | ||
@@ -24,0 +24,0 @@ * console.log(array); |
@@ -14,10 +14,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -33,4 +33,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -41,3 +40,5 @@ * @returns {Array} Returns the new array of removed elements. | ||
* var array = [1, 2, 3, 4]; | ||
* var evens = _.remove(array, function(n) { return n % 2 == 0; }); | ||
* var evens = _.remove(array, function(n) { | ||
* return n % 2 == 0; | ||
* }); | ||
* | ||
@@ -44,0 +45,0 @@ * console.log(array); |
@@ -12,10 +12,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -30,4 +30,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -41,3 +40,3 @@ * @returns {number} Returns the index at which `value` should be inserted | ||
* | ||
* _.sortedIndex([4, 4, 5, 5, 6, 6], 5); | ||
* _.sortedIndex([4, 4, 5, 5], 5); | ||
* // => 2 | ||
@@ -53,3 +52,3 @@ * | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); | ||
@@ -56,0 +55,0 @@ * // => 1 |
@@ -16,4 +16,3 @@ import baseCallback from '../internal/baseCallback'; | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -24,3 +23,3 @@ * @returns {number} Returns the index at which `value` should be inserted | ||
* | ||
* _.sortedLastIndex([4, 4, 5, 5, 6, 6], 5); | ||
* _.sortedLastIndex([4, 4, 5, 5], 5); | ||
* // => 4 | ||
@@ -27,0 +26,0 @@ */ |
@@ -9,10 +9,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -26,3 +26,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per element. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -32,20 +32,22 @@ * @returns {Array} Returns the slice of `array`. | ||
* | ||
* _.takeRightWhile([1, 2, 3], function(n) { return n > 1; }); | ||
* _.takeRightWhile([1, 2, 3], function(n) { | ||
* return n > 1; | ||
* }); | ||
* // => [2, 3] | ||
* | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': true }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': false } | ||
* { 'user': 'barney', 'active': true }, | ||
* { 'user': 'fred', 'active': false }, | ||
* { 'user': 'pebbles', 'active': false } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.takeRightWhile(users, { 'age': 1, 'active': true }), 'user'); | ||
* // using the `_.matches` callback shorthand | ||
* _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); | ||
* // => ['pebbles'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.pluck(_.takeRightWhile(users, 'active', false), 'user'); | ||
* // => ['fred', 'pebbles'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.pluck(_.takeRightWhile(users, 'active'), 'user'); | ||
@@ -52,0 +54,0 @@ * // => [] |
@@ -9,10 +9,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -26,3 +26,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per element. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -32,20 +32,22 @@ * @returns {Array} Returns the slice of `array`. | ||
* | ||
* _.takeWhile([1, 2, 3], function(n) { return n < 3; }); | ||
* _.takeWhile([1, 2, 3], function(n) { | ||
* return n < 3; | ||
* }); | ||
* // => [1, 2] | ||
* | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': false }, | ||
* { 'user': 'pebbles', 'age': 1, 'active': true } | ||
* { 'user': 'barney', 'active': false }, | ||
* { 'user': 'fred', 'active': false}, | ||
* { 'user': 'pebbles', 'active': true } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.pluck(_.takeWhile(users, { 'age': 36, 'active': true }), 'user'); | ||
* // using the `_.matches` callback shorthand | ||
* _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.pluck(_.takeWhile(users, 'active', false), 'user'); | ||
* // => ['barney', 'fred'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.pluck(_.takeWhile(users, 'active'), 'user'); | ||
@@ -52,0 +54,0 @@ * // => [] |
@@ -20,4 +20,4 @@ import baseFlatten from '../internal/baseFlatten'; | ||
* | ||
* _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]); | ||
* // => [1, 2, 3, 5, 4] | ||
* _.union([1, 2], [4, 2], [2, 1]); | ||
* // => [1, 2, 4] | ||
*/ | ||
@@ -24,0 +24,0 @@ function union() { |
@@ -14,10 +14,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -38,4 +38,2 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee] The function invoked per iteration. | ||
* If a property name or object is provided it is used to create a "_.property" | ||
* or "_.matches" style callback respectively. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -53,6 +51,8 @@ * @returns {Array} Returns the new duplicate-value-free array. | ||
* // using an iteratee function | ||
* _.uniq([1, 2.5, 1.5, 2], function(n) { return this.floor(n); }, Math); | ||
* _.uniq([1, 2.5, 1.5, 2], function(n) { | ||
* return this.floor(n); | ||
* }, Math); | ||
* // => [1, 2.5] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); | ||
@@ -66,4 +66,3 @@ * // => [{ 'x': 1 }, { 'x': 2 }] | ||
} | ||
// Juggle arguments. | ||
if (typeof isSorted != 'boolean' && isSorted != null) { | ||
if (isSorted != null && typeof isSorted != 'boolean') { | ||
thisArg = iteratee; | ||
@@ -70,0 +69,0 @@ iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; |
@@ -21,4 +21,4 @@ import baseDifference from '../internal/baseDifference'; | ||
* | ||
* _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); | ||
* // => [2, 3, 4] | ||
* _.without([1, 2, 1, 3], 1, 2); | ||
* // => [3] | ||
*/ | ||
@@ -25,0 +25,0 @@ function without(array) { |
@@ -18,7 +18,4 @@ import baseDifference from '../internal/baseDifference'; | ||
* | ||
* _.xor([1, 2, 3], [5, 2, 1, 4]); | ||
* // => [3, 5, 4] | ||
* | ||
* _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]); | ||
* // => [1, 4, 5] | ||
* _.xor([1, 2], [4, 2]); | ||
* // => [1, 4] | ||
*/ | ||
@@ -25,0 +22,0 @@ function xor() { |
@@ -22,3 +22,5 @@ import lodash from './lodash'; | ||
* .sortBy('age') | ||
* .map(function(chr) { return chr.user + ' is ' + chr.age; }) | ||
* .map(function(chr) { | ||
* return chr.user + ' is ' + chr.age; | ||
* }) | ||
* .first() | ||
@@ -25,0 +27,0 @@ * .value(); |
import LazyWrapper from '../internal/LazyWrapper'; | ||
import LodashWrapper from '../internal/LodashWrapper'; | ||
import baseLodash from '../internal/baseLodash'; | ||
import isArray from '../lang/isArray'; | ||
@@ -47,4 +48,4 @@ import isObjectLike from '../internal/isObjectLike'; | ||
* `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, | ||
* `keysIn`, `map`, `mapValues`, `matches`, `memoize`, `merge`, `mixin`, | ||
* `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, | ||
* `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, | ||
* `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, | ||
* `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, | ||
@@ -86,7 +87,11 @@ * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, | ||
* // returns an unwrapped value | ||
* wrapped.reduce(function(sum, n) { return sum + n; }); | ||
* wrapped.reduce(function(sum, n) { | ||
* return sum + n; | ||
* }); | ||
* // => 6 | ||
* | ||
* // returns a wrapped value | ||
* var squares = wrapped.map(function(n) { return n * n; }); | ||
* var squares = wrapped.map(function(n) { | ||
* return n * n; | ||
* }); | ||
* | ||
@@ -111,2 +116,5 @@ * _.isArray(squares); | ||
// Ensure wrappers are instances of `baseLodash`. | ||
lodash.prototype = baseLodash.prototype; | ||
export default lodash; |
@@ -17,3 +17,5 @@ /** | ||
* _([1, 2, 3]) | ||
* .tap(function(array) { array.pop(); }) | ||
* .tap(function(array) { | ||
* array.pop(); | ||
* }) | ||
* .reverse() | ||
@@ -20,0 +22,0 @@ * .value(); |
@@ -15,3 +15,5 @@ /** | ||
* .last() | ||
* .thru(function(value) { return [value]; }) | ||
* .thru(function(value) { | ||
* return [value]; | ||
* }) | ||
* .value(); | ||
@@ -18,0 +20,0 @@ * // => [3] |
@@ -1,2 +0,2 @@ | ||
import LodashWrapper from '../internal/LodashWrapper'; | ||
import baseLodash from '../internal/baseLodash'; | ||
import wrapperClone from '../internal/wrapperClone'; | ||
@@ -14,3 +14,5 @@ | ||
* var array = [1, 2]; | ||
* var wrapper = _(array).map(_.partial(Math.pow, _, 2)); | ||
* var wrapper = _(array).map(function(value) { | ||
* return Math.pow(value, 2); | ||
* }); | ||
* | ||
@@ -30,3 +32,3 @@ * var other = [3, 4]; | ||
while (parent instanceof LodashWrapper) { | ||
while (parent instanceof baseLodash) { | ||
var clone = wrapperClone(parent); | ||
@@ -33,0 +35,0 @@ if (result) { |
@@ -20,4 +20,4 @@ import baseAt from '../internal/baseAt'; | ||
* | ||
* _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); | ||
* // => ['a', 'c', 'e'] | ||
* _.at(['a', 'b', 'c'], [0, 2]); | ||
* // => ['a', 'c'] | ||
* | ||
@@ -24,0 +24,0 @@ * _.at(['fred', 'barney', 'pebbles'], 0, 2); |
@@ -16,10 +16,10 @@ import createAggregator from '../internal/createAggregator'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -33,4 +33,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -40,6 +39,10 @@ * @returns {Object} Returns the composed aggregate object. | ||
* | ||
* _.countBy([4.3, 6.1, 6.4], function(n) { return Math.floor(n); }); | ||
* _.countBy([4.3, 6.1, 6.4], function(n) { | ||
* return Math.floor(n); | ||
* }); | ||
* // => { '4': 1, '6': 2 } | ||
* | ||
* _.countBy([4.3, 6.1, 6.4], function(n) { return this.floor(n); }, Math); | ||
* _.countBy([4.3, 6.1, 6.4], function(n) { | ||
* return this.floor(n); | ||
* }, Math); | ||
* // => { '4': 1, '6': 2 } | ||
@@ -46,0 +49,0 @@ * |
@@ -11,10 +11,10 @@ import arrayEvery from '../internal/arrayEvery'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -29,4 +29,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -37,19 +36,19 @@ * @returns {boolean} Returns `true` if all elements pass the predicate check, | ||
* | ||
* _.every([true, 1, null, 'yes']); | ||
* _.every([true, 1, null, 'yes'], Boolean); | ||
* // => false | ||
* | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': false } | ||
* { 'user': 'barney', 'active': false }, | ||
* { 'user': 'fred', 'active': false } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.every(users, { 'age': 36, 'active': false }); | ||
* // using the `_.matches` callback shorthand | ||
* _.every(users, { 'user': 'barney', 'active': false }); | ||
* // => false | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.every(users, 'active', false); | ||
* // => true | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.every(users, 'active'); | ||
@@ -56,0 +55,0 @@ * // => false |
@@ -11,10 +11,10 @@ import arrayFilter from '../internal/arrayFilter'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -29,4 +29,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -36,4 +35,6 @@ * @returns {Array} Returns the new filtered array. | ||
* | ||
* var evens = _.filter([1, 2, 3, 4], function(n) { return n % 2 == 0; }); | ||
* // => [2, 4] | ||
* _.filter([4, 5, 6], function(n) { | ||
* return n % 2 == 0; | ||
* }); | ||
* // => [4, 6] | ||
* | ||
@@ -45,11 +46,11 @@ * var users = [ | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* // using the `_.matches` callback shorthand | ||
* _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.pluck(_.filter(users, 'active', false), 'user'); | ||
* // => ['fred'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.pluck(_.filter(users, 'active'), 'user'); | ||
@@ -56,0 +57,0 @@ * // => ['barney'] |
@@ -12,10 +12,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -30,4 +30,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -43,14 +42,16 @@ * @returns {*} Returns the matched element, else `undefined`. | ||
* | ||
* _.result(_.find(users, function(chr) { return chr.age < 40; }), 'user'); | ||
* _.result(_.find(users, function(chr) { | ||
* return chr.age < 40; | ||
* }), 'user'); | ||
* // => 'barney' | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* // using the `_.matches` callback shorthand | ||
* _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); | ||
* // => 'pebbles' | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.result(_.find(users, 'active', false), 'user'); | ||
* // => 'fred' | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.result(_.find(users, 'active'), 'user'); | ||
@@ -57,0 +58,0 @@ * // => 'barney' |
@@ -14,4 +14,3 @@ import baseCallback from '../internal/baseCallback'; | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -21,3 +20,5 @@ * @returns {*} Returns the matched element, else `undefined`. | ||
* | ||
* _.findLast([1, 2, 3, 4], function(n) { return n % 2 == 1; }); | ||
* _.findLast([1, 2, 3, 4], function(n) { | ||
* return n % 2 == 1; | ||
* }); | ||
* // => 3 | ||
@@ -24,0 +25,0 @@ */ |
@@ -26,6 +26,10 @@ import arrayEach from '../internal/arrayEach'; | ||
* | ||
* _([1, 2, 3]).forEach(function(n) { console.log(n); }).value(); | ||
* _([1, 2]).forEach(function(n) { | ||
* console.log(n); | ||
* }).value(); | ||
* // => logs each value from left to right and returns the array | ||
* | ||
* _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(n, key) { console.log(n, key); }); | ||
* _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { | ||
* console.log(n, key); | ||
* }); | ||
* // => logs each value-key pair and returns the object (iteration order is not guaranteed) | ||
@@ -32,0 +36,0 @@ */ |
@@ -20,3 +20,5 @@ import arrayEachRight from '../internal/arrayEachRight'; | ||
* | ||
* _([1, 2, 3]).forEachRight(function(n) { console.log(n); }).join(','); | ||
* _([1, 2]).forEachRight(function(n) { | ||
* console.log(n); | ||
* }).join(','); | ||
* // => logs each value from right to left and returns the array | ||
@@ -23,0 +25,0 @@ */ |
@@ -16,10 +16,10 @@ import createAggregator from '../internal/createAggregator'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -33,4 +33,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -40,9 +39,13 @@ * @returns {Object} Returns the composed aggregate object. | ||
* | ||
* _.groupBy([4.2, 6.1, 6.4], function(n) { return Math.floor(n); }); | ||
* _.groupBy([4.2, 6.1, 6.4], function(n) { | ||
* return Math.floor(n); | ||
* }); | ||
* // => { '4': [4.2], '6': [6.1, 6.4] } | ||
* | ||
* _.groupBy([4.2, 6.1, 6.4], function(n) { return this.floor(n); }, Math); | ||
* _.groupBy([4.2, 6.1, 6.4], function(n) { | ||
* return this.floor(n); | ||
* }, Math); | ||
* // => { '4': [4.2], '6': [6.1, 6.4] } | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.groupBy(['one', 'two', 'three'], 'length'); | ||
@@ -49,0 +52,0 @@ * // => { '3': ['one', 'two'], '5': ['three'] } |
@@ -10,10 +10,10 @@ import createAggregator from '../internal/createAggregator'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -27,4 +27,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -42,6 +41,10 @@ * @returns {Object} Returns the composed aggregate object. | ||
* | ||
* _.indexBy(keyData, function(object) { return String.fromCharCode(object.code); }); | ||
* _.indexBy(keyData, function(object) { | ||
* return String.fromCharCode(object.code); | ||
* }); | ||
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } | ||
* | ||
* _.indexBy(keyData, function(object) { return this.fromCharCode(object.code); }, String); | ||
* _.indexBy(keyData, function(object) { | ||
* return this.fromCharCode(object.code); | ||
* }, String); | ||
* // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } | ||
@@ -48,0 +51,0 @@ */ |
@@ -11,10 +11,10 @@ import arrayMap from '../internal/arrayMap'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -38,4 +38,4 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* create a `_.property` or `_.matches` style callback respectively. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -45,8 +45,12 @@ * @returns {Array} Returns the new mapped array. | ||
* | ||
* _.map([1, 2, 3], function(n) { return n * 3; }); | ||
* // => [3, 6, 9] | ||
* function timesThree(n) { | ||
* return n * 3; | ||
* } | ||
* | ||
* _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(n) { return n * 3; }); | ||
* // => [3, 6, 9] (iteration order is not guaranteed) | ||
* _.map([1, 2], timesThree); | ||
* // => [3, 6] | ||
* | ||
* _.map({ 'a': 1, 'b': 2 }, timesThree); | ||
* // => [3, 6] (iteration order is not guaranteed) | ||
* | ||
* var users = [ | ||
@@ -57,3 +61,3 @@ * { 'user': 'barney' }, | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.map(users, 'user'); | ||
@@ -60,0 +64,0 @@ * // => ['barney', 'fred'] |
@@ -11,10 +11,10 @@ import arrayMax from '../internal/arrayMax'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -28,4 +28,2 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee] The function invoked per iteration. | ||
* If a property name or object is provided it is used to create a "_.property" | ||
* or "_.matches" style callback respectively. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -46,6 +44,8 @@ * @returns {*} Returns the maximum value. | ||
* | ||
* _.max(users, function(chr) { return chr.age; }); | ||
* _.max(users, function(chr) { | ||
* return chr.age; | ||
* }); | ||
* // => { 'user': 'fred', 'age': 40 }; | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.max(users, 'age'); | ||
@@ -52,0 +52,0 @@ * // => { 'user': 'fred', 'age': 40 }; |
@@ -11,10 +11,10 @@ import arrayMin from '../internal/arrayMin'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -28,4 +28,2 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee] The function invoked per iteration. | ||
* If a property name or object is provided it is used to create a "_.property" | ||
* or "_.matches" style callback respectively. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -46,6 +44,8 @@ * @returns {*} Returns the minimum value. | ||
* | ||
* _.min(users, function(chr) { return chr.age; }); | ||
* _.min(users, function(chr) { | ||
* return chr.age; | ||
* }); | ||
* // => { 'user': 'barney', 'age': 36 }; | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.min(users, 'age'); | ||
@@ -52,0 +52,0 @@ * // => { 'user': 'barney', 'age': 36 }; |
@@ -9,10 +9,10 @@ import createAggregator from '../internal/createAggregator'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -26,4 +26,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -33,6 +32,10 @@ * @returns {Array} Returns the array of grouped elements. | ||
* | ||
* _.partition([1, 2, 3], function(n) { return n % 2; }); | ||
* _.partition([1, 2, 3], function(n) { | ||
* return n % 2; | ||
* }); | ||
* // => [[1, 3], [2]] | ||
* | ||
* _.partition([1.2, 2.3, 3.4], function(n) { return this.floor(n) % 2; }, Math); | ||
* _.partition([1.2, 2.3, 3.4], function(n) { | ||
* return this.floor(n) % 2; | ||
* }, Math); | ||
* // => [[1, 3], [2]] | ||
@@ -46,13 +49,15 @@ * | ||
* | ||
* var mapper = function(array) { return _.pluck(array, 'user'); }; | ||
* var mapper = function(array) { | ||
* return _.pluck(array, 'user'); | ||
* }; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* // using the `_.matches` callback shorthand | ||
* _.map(_.partition(users, { 'age': 1, 'active': false }), mapper); | ||
* // => [['pebbles'], ['barney', 'fred']] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.map(_.partition(users, 'active', false), mapper); | ||
* // => [['barney', 'pebbles'], ['fred']] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.map(_.partition(users, 'active'), mapper); | ||
@@ -59,0 +64,0 @@ * // => [['fred'], ['barney', 'pebbles']] |
@@ -32,10 +32,12 @@ import arrayReduce from '../internal/arrayReduce'; | ||
* | ||
* var sum = _.reduce([1, 2, 3], function(sum, n) { return sum + n; }); | ||
* // => 6 | ||
* _.reduce([1, 2], function(sum, n) { | ||
* return sum + n; | ||
* }); | ||
* // => 3 | ||
* | ||
* var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, n, key) { | ||
* _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { | ||
* result[key] = n * 3; | ||
* return result; | ||
* }, {}); | ||
* // => { 'a': 3, 'b': 6, 'c': 9 } (iteration order is not guaranteed) | ||
* // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed) | ||
*/ | ||
@@ -42,0 +44,0 @@ function reduce(collection, iteratee, accumulator, thisArg) { |
@@ -23,3 +23,6 @@ import arrayReduceRight from '../internal/arrayReduceRight'; | ||
* var array = [[0, 1], [2, 3], [4, 5]]; | ||
* _.reduceRight(array, function(flattened, other) { return flattened.concat(other); }, []); | ||
* | ||
* _.reduceRight(array, function(flattened, other) { | ||
* return flattened.concat(other); | ||
* }, []); | ||
* // => [4, 5, 2, 3, 0, 1] | ||
@@ -26,0 +29,0 @@ */ |
@@ -10,10 +10,10 @@ import arrayFilter from '../internal/arrayFilter'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -27,4 +27,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -34,3 +33,5 @@ * @returns {Array} Returns the new filtered array. | ||
* | ||
* var odds = _.reject([1, 2, 3, 4], function(n) { return n % 2 == 0; }); | ||
* _.reject([1, 2, 3, 4], function(n) { | ||
* return n % 2 == 0; | ||
* }); | ||
* // => [1, 3] | ||
@@ -43,11 +44,11 @@ * | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* // using the `_.matches` callback shorthand | ||
* _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user'); | ||
* // => ['barney'] | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.pluck(_.reject(users, 'active', false), 'user'); | ||
* // => ['fred'] | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.pluck(_.reject(users, 'active'), 'user'); | ||
@@ -54,0 +55,0 @@ * // => ['barney'] |
@@ -15,8 +15,8 @@ import isLength from '../internal/isLength'; | ||
* | ||
* _.size([1, 2]); | ||
* _.size([1, 2, 3]); | ||
* // => 3 | ||
* | ||
* _.size({ 'a': 1, 'b': 2 }); | ||
* // => 2 | ||
* | ||
* _.size({ 'one': 1, 'two': 2, 'three': 3 }); | ||
* // => 3 | ||
* | ||
* _.size('pebbles'); | ||
@@ -23,0 +23,0 @@ * // => 7 |
@@ -12,10 +12,10 @@ import arraySome from '../internal/arraySome'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -30,4 +30,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -42,15 +41,15 @@ * @returns {boolean} Returns `true` if any element passes the predicate check, | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36, 'active': false }, | ||
* { 'user': 'fred', 'age': 40, 'active': true } | ||
* { 'user': 'barney', 'active': true }, | ||
* { 'user': 'fred', 'active': false } | ||
* ]; | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* _.some(users, { 'age': 1, 'active': true }); | ||
* // using the `_.matches` callback shorthand | ||
* _.some(users, { user': 'barney', 'active': false }); | ||
* // => false | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.some(users, 'active', false); | ||
* // => true | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.some(users, 'active'); | ||
@@ -57,0 +56,0 @@ * // => true |
@@ -15,10 +15,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -33,3 +33,3 @@ * object, else `false`. | ||
* invoked per iteration. If a property name or an object is provided it is | ||
* used to create a "_.property" or "_.matches" style callback respectively. | ||
* used to create a `_.property` or `_.matches` style callback respectively. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -39,6 +39,10 @@ * @returns {Array} Returns the new sorted array. | ||
* | ||
* _.sortBy([1, 2, 3], function(n) { return Math.sin(n); }); | ||
* _.sortBy([1, 2, 3], function(n) { | ||
* return Math.sin(n); | ||
* }); | ||
* // => [3, 1, 2] | ||
* | ||
* _.sortBy([1, 2, 3], function(n) { return this.sin(n); }, Math); | ||
* _.sortBy([1, 2, 3], function(n) { | ||
* return this.sin(n); | ||
* }, Math); | ||
* // => [3, 1, 2] | ||
@@ -52,3 +56,3 @@ * | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.pluck(_.sortBy(users, 'user'), 'user'); | ||
@@ -55,0 +59,0 @@ * // => ['barney', 'fred', 'pebbles'] |
@@ -15,3 +15,5 @@ import isNative from '../lang/isNative'; | ||
* | ||
* _.defer(function(stamp) { console.log(_.now() - stamp); }, _.now()); | ||
* _.defer(function(stamp) { | ||
* console.log(_.now() - stamp); | ||
* }, _.now()); | ||
* // => logs the number of milliseconds it took for the deferred function to be invoked | ||
@@ -18,0 +20,0 @@ */ |
@@ -24,3 +24,5 @@ import baseBindAll from '../internal/baseBindAll'; | ||
* 'label': 'docs', | ||
* 'onClick': function() { console.log('clicked ' + this.label); } | ||
* 'onClick': function() { | ||
* console.log('clicked ' + this.label); | ||
* } | ||
* }; | ||
@@ -27,0 +29,0 @@ * |
@@ -15,3 +15,5 @@ import baseDelay from '../internal/baseDelay'; | ||
* | ||
* _.defer(function(text) { console.log(text); }, 'deferred'); | ||
* _.defer(function(text) { | ||
* console.log(text); | ||
* }, 'deferred'); | ||
* // logs 'deferred' after one or more milliseconds | ||
@@ -18,0 +20,0 @@ */ |
@@ -16,3 +16,5 @@ import baseDelay from '../internal/baseDelay'; | ||
* | ||
* _.delay(function(text) { console.log(text); }, 1000, 'later'); | ||
* _.delay(function(text) { | ||
* console.log(text); | ||
* }, 1000, 'later'); | ||
* // => logs 'later' after one second | ||
@@ -19,0 +21,0 @@ */ |
import arrayEvery from '../internal/arrayEvery'; | ||
import isFunction from '../lang/isFunction'; | ||
import baseIsFunction from '../internal/baseIsFunction'; | ||
@@ -38,3 +38,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
} | ||
if (!arrayEvery(funcs, isFunction)) { | ||
if (!arrayEvery(funcs, baseIsFunction)) { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
@@ -41,0 +41,0 @@ } |
import arrayEvery from '../internal/arrayEvery'; | ||
import isFunction from '../lang/isFunction'; | ||
import baseIsFunction from '../internal/baseIsFunction'; | ||
@@ -38,3 +38,3 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
} | ||
if (!arrayEvery(funcs, isFunction)) { | ||
if (!arrayEvery(funcs, baseIsFunction)) { | ||
throw new TypeError(FUNC_ERROR_TEXT); | ||
@@ -41,0 +41,0 @@ } |
@@ -30,3 +30,5 @@ import baseFlatten from '../internal/baseFlatten'; | ||
* var map = _.rearg(_.map, [1, 0]); | ||
* map(function(n) { return n * 3; }, [1, 2, 3]); | ||
* map(function(n) { | ||
* return n * 3; | ||
* }, [1, 2, 3]); | ||
* // => [3, 6, 9] | ||
@@ -33,0 +35,0 @@ */ |
@@ -29,7 +29,5 @@ /** Used as the `TypeError` message for "Functions" methods. */ | ||
* | ||
* var add = function(x, y) { | ||
* numbers.then(_.spread(function(x, y) { | ||
* return x + y; | ||
* }; | ||
* | ||
* numbers.then(_.spread(add)); | ||
* })); | ||
* // => a Promise of 76 | ||
@@ -36,0 +34,0 @@ */ |
@@ -46,4 +46,5 @@ import debounce from './debounce'; | ||
* // invoke `renewToken` when the click event is fired, but not more than once every 5 minutes | ||
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false }) | ||
* jQuery('.interactive').on('click', throttled); | ||
* jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { | ||
* 'trailing': false | ||
* })); | ||
* | ||
@@ -50,0 +51,0 @@ * // cancel a trailing throttled call |
@@ -28,3 +28,3 @@ import baseIsMatch from './baseIsMatch'; | ||
return function(object) { | ||
return object != null && value === object[key] && hasOwnProperty.call(object, key); | ||
return object != null && object[key] === value && hasOwnProperty.call(object, key); | ||
}; | ||
@@ -31,0 +31,0 @@ } |
@@ -6,2 +6,3 @@ import arrayEach from './arrayEach'; | ||
import isLength from './isLength'; | ||
import isObject from '../lang/isObject'; | ||
import isObjectLike from './isObjectLike'; | ||
@@ -23,4 +24,6 @@ import isTypedArray from '../lang/isTypedArray'; | ||
function baseMerge(object, source, customizer, stackA, stackB) { | ||
if (!isObject(object)) { | ||
return object; | ||
} | ||
var isSrcArr = isLength(source.length) && (isArray(source) || isTypedArray(source)); | ||
(isSrcArr ? arrayEach : baseForOwn)(source, function(srcValue, key, source) { | ||
@@ -27,0 +30,0 @@ if (isObjectLike(srcValue)) { |
@@ -25,5 +25,6 @@ import isIndex from './isIndex'; | ||
} | ||
return prereq && object[index] === value; | ||
var other = object[index]; | ||
return prereq && (value === value ? value === other : other !== other); | ||
} | ||
export default isIterateeCall; |
@@ -0,1 +1,4 @@ | ||
import baseCreate from './baseCreate'; | ||
import baseLodash from './baseLodash'; | ||
/** Used as references for `-Infinity` and `Infinity`. */ | ||
@@ -21,2 +24,5 @@ var POSITIVE_INFINITY = Number.POSITIVE_INFINITY; | ||
LazyWrapper.prototype = baseCreate(baseLodash.prototype); | ||
LazyWrapper.prototype.constructor = LazyWrapper; | ||
export default LazyWrapper; |
@@ -0,1 +1,4 @@ | ||
import baseCreate from './baseCreate'; | ||
import baseLodash from './baseLodash'; | ||
/** | ||
@@ -15,2 +18,5 @@ * The base constructor for creating `lodash` wrapper objects. | ||
LodashWrapper.prototype = baseCreate(baseLodash.prototype); | ||
LodashWrapper.prototype.constructor = LodashWrapper; | ||
export default LodashWrapper; |
@@ -43,18 +43,22 @@ import baseClone from '../internal/baseClone'; | ||
* // using a customizer callback | ||
* var body = _.clone(document.body, function(value) { | ||
* return _.isElement(value) ? value.cloneNode(false) : undefined; | ||
* var el = _.clone(document.body, function(value) { | ||
* if (_.isElement(value)) { | ||
* return value.cloneNode(false); | ||
* } | ||
* }); | ||
* | ||
* body === document.body | ||
* el === document.body | ||
* // => false | ||
* body.nodeName | ||
* el.nodeName | ||
* // => BODY | ||
* body.childNodes.length; | ||
* el.childNodes.length; | ||
* // => 0 | ||
*/ | ||
function clone(value, isDeep, customizer, thisArg) { | ||
// Juggle arguments. | ||
if (typeof isDeep != 'boolean' && isDeep != null) { | ||
if (isDeep && typeof isDeep != 'boolean' && isIterateeCall(value, isDeep, customizer)) { | ||
isDeep = false; | ||
} | ||
else if (typeof isDeep == 'function') { | ||
thisArg = customizer; | ||
customizer = isIterateeCall(value, isDeep, thisArg) ? null : isDeep; | ||
customizer = isDeep; | ||
isDeep = false; | ||
@@ -61,0 +65,0 @@ } |
@@ -37,10 +37,12 @@ import baseClone from '../internal/baseClone'; | ||
* var el = _.cloneDeep(document.body, function(value) { | ||
* return _.isElement(value) ? value.cloneNode(true) : undefined; | ||
* if (_.isElement(value)) { | ||
* return value.cloneNode(true); | ||
* } | ||
* }); | ||
* | ||
* body === document.body | ||
* el === document.body | ||
* // => false | ||
* body.nodeName | ||
* el.nodeName | ||
* // => BODY | ||
* body.childNodes.length; | ||
* el.childNodes.length; | ||
* // => 20 | ||
@@ -47,0 +49,0 @@ */ |
@@ -27,3 +27,3 @@ import isLength from '../internal/isLength'; | ||
* | ||
* (function() { return _.isArguments(arguments); })(); | ||
* _.isArguments(function() { return arguments; }()); | ||
* // => true | ||
@@ -30,0 +30,0 @@ * |
@@ -34,3 +34,3 @@ import isLength from '../internal/isLength'; | ||
* | ||
* (function() { return _.isArray(arguments); })(); | ||
* _.isArray(function() { return arguments; }()); | ||
* // => false | ||
@@ -37,0 +37,0 @@ */ |
@@ -42,3 +42,5 @@ import baseIsEqual from '../internal/baseIsEqual'; | ||
* _.isEqual(array, other, function(value, other) { | ||
* return _.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/) || undefined; | ||
* if (_.every([value, other], RegExp.prototype.test, /^h(?:i|ello)$/)) { | ||
* return true; | ||
* } | ||
* }); | ||
@@ -45,0 +47,0 @@ * // => true |
@@ -0,1 +1,2 @@ | ||
import baseIsFunction from '../internal/baseIsFunction'; | ||
import isNative from './isNative'; | ||
@@ -36,17 +37,9 @@ import root from '../internal/root'; | ||
*/ | ||
function isFunction(value) { | ||
// Avoid a Chakra JIT bug in compatibility modes of IE 11. | ||
// See https://github.com/jashkenas/underscore/issues/1621 for more details. | ||
return typeof value == 'function' || false; | ||
} | ||
// Fallback for environments that return incorrect `typeof` operator results. | ||
if (isFunction(/x/) || (Uint8Array && !isFunction(Uint8Array))) { | ||
isFunction = function(value) { | ||
// The use of `Object#toString` avoids issues with the `typeof` operator | ||
// in older versions of Chrome and Safari which return 'function' for regexes | ||
// and Safari 8 equivalents which return 'object' for typed array constructors. | ||
return objToString.call(value) == funcTag; | ||
}; | ||
} | ||
var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) { | ||
// The use of `Object#toString` avoids issues with the `typeof` operator | ||
// in older versions of Chrome and Safari which return 'function' for regexes | ||
// and Safari 8 equivalents which return 'object' for typed array constructors. | ||
return objToString.call(value) == funcTag; | ||
}; | ||
export default isFunction; |
@@ -15,3 +15,5 @@ import arrayCopy from '../internal/arrayCopy'; | ||
* | ||
* (function() { return _.toArray(arguments).slice(1); })(1, 2, 3); | ||
* (function() { | ||
* return _.toArray(arguments).slice(1); | ||
* }(1, 2, 3)); | ||
* // => [2, 3] | ||
@@ -18,0 +20,0 @@ */ |
/** | ||
* @license | ||
* lodash 3.2.0 (Custom Build) <https://lodash.com/> | ||
* lodash 3.3.0 (Custom Build) <https://lodash.com/> | ||
* Build: `lodash modularize modern exports="es" -o ./` | ||
@@ -24,3 +24,2 @@ * Copyright 2012-2015 The Dojo Foundation <http://dojofoundation.org/> | ||
import baseCallback from './internal/baseCallback'; | ||
import baseCreate from './internal/baseCreate'; | ||
import baseForOwn from './internal/baseForOwn'; | ||
@@ -43,3 +42,3 @@ import baseFunctions from './internal/baseFunctions'; | ||
/** Used as the semantic version number. */ | ||
var VERSION = '3.2.0'; | ||
var VERSION = '3.3.0'; | ||
@@ -61,9 +60,2 @@ /** Used to indicate the type of lazy iteratees. */ | ||
// Ensure `new LodashWrapper` is an instance of `lodash`. | ||
LodashWrapper.prototype = baseCreate(lodash.prototype); | ||
// Ensure `new LazyWraper` is an instance of `LodashWrapper` | ||
LazyWrapper.prototype = baseCreate(LodashWrapper.prototype); | ||
LazyWrapper.prototype.constructor = LazyWrapper; | ||
// wrap `_.mixin` so it works when provided only one argument | ||
@@ -228,2 +220,3 @@ var mixin = (function(func) { | ||
lodash.indexOf = array.indexOf; | ||
lodash.inRange = number.inRange; | ||
lodash.isArguments = lang.isArguments; | ||
@@ -408,14 +401,14 @@ lodash.isArray = isArray; | ||
LazyWrapper.prototype.dropWhile = function(iteratee, thisArg) { | ||
LazyWrapper.prototype.dropWhile = function(predicate, thisArg) { | ||
var done; | ||
iteratee = baseCallback(iteratee, thisArg, 3); | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
return this.filter(function(value, index, array) { | ||
return done || (done = !iteratee(value, index, array)); | ||
return done || (done = !predicate(value, index, array)); | ||
}); | ||
}; | ||
LazyWrapper.prototype.reject = function(iteratee, thisArg) { | ||
iteratee = baseCallback(iteratee, thisArg, 3); | ||
LazyWrapper.prototype.reject = function(predicate, thisArg) { | ||
predicate = baseCallback(predicate, thisArg, 3); | ||
return this.filter(function(value, index, array) { | ||
return !iteratee(value, index, array); | ||
return !predicate(value, index, array); | ||
}); | ||
@@ -498,3 +491,3 @@ }; | ||
// Add chaining functions to the lodash wrapper. | ||
// Add chaining functions to the `lodash` wrapper. | ||
lodash.prototype.chain = chain.wrapperChain; | ||
@@ -507,3 +500,3 @@ lodash.prototype.commit = chain.commit; | ||
// Add function aliases to the lodash wrapper. | ||
// Add function aliases to the `lodash` wrapper. | ||
lodash.prototype.collect = lodash.prototype.map; | ||
@@ -510,0 +503,0 @@ lodash.prototype.head = lodash.prototype.first; |
@@ -0,5 +1,7 @@ | ||
import inRange from './number/inRange'; | ||
import random from './number/random'; | ||
export default { | ||
'inRange': inRange, | ||
'random': random | ||
}; |
@@ -29,3 +29,5 @@ import baseCopy from '../internal/baseCopy'; | ||
* | ||
* Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle }); | ||
* Circle.prototype = _.create(Shape.prototype, { | ||
* 'constructor': Circle | ||
* }); | ||
* | ||
@@ -32,0 +34,0 @@ * var circle = new Circle; |
@@ -9,10 +9,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -26,4 +26,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -39,14 +38,16 @@ * @returns {string|undefined} Returns the key of the matched element, else `undefined`. | ||
* | ||
* _.findKey(users, function(chr) { return chr.age < 40; }); | ||
* _.findKey(users, function(chr) { | ||
* return chr.age < 40; | ||
* }); | ||
* // => 'barney' (iteration order is not guaranteed) | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* // using the `_.matches` callback shorthand | ||
* _.findKey(users, { 'age': 1, 'active': true }); | ||
* // => 'pebbles' | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.findKey(users, 'active', false); | ||
* // => 'fred' | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.findKey(users, 'active'); | ||
@@ -53,0 +54,0 @@ * // => 'barney' |
@@ -9,10 +9,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `predicate` the created "_.property" | ||
* If a property name is provided for `predicate` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `predicate` the created "_.matches" style | ||
* If an object is provided for `predicate` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -26,4 +26,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [predicate=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `predicate`. | ||
@@ -39,14 +38,16 @@ * @returns {string|undefined} Returns the key of the matched element, else `undefined`. | ||
* | ||
* _.findLastKey(users, function(chr) { return chr.age < 40; }); | ||
* _.findLastKey(users, function(chr) { | ||
* return chr.age < 40; | ||
* }); | ||
* // => returns `pebbles` assuming `_.findKey` returns `barney` | ||
* | ||
* // using the "_.matches" callback shorthand | ||
* // using the `_.matches` callback shorthand | ||
* _.findLastKey(users, { 'age': 36, 'active': true }); | ||
* // => 'barney' | ||
* | ||
* // using the "_.matchesProperty" callback shorthand | ||
* // using the `_.matchesProperty` callback shorthand | ||
* _.findLastKey(users, 'active', false); | ||
* // => 'fred' | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.findLastKey(users, 'active'); | ||
@@ -53,0 +54,0 @@ * // => 'pebbles' |
@@ -19,6 +19,13 @@ import baseForOwn from '../internal/baseForOwn'; | ||
* | ||
* _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(n, key) { | ||
* function Foo() { | ||
* this.a = 1; | ||
* this.b = 2; | ||
* } | ||
* | ||
* Foo.prototype.c = 3; | ||
* | ||
* _.forOwn(new Foo, function(value, key) { | ||
* console.log(key); | ||
* }); | ||
* // => logs '0', '1', and 'length' (iteration order is not guaranteed) | ||
* // => logs 'a' and 'b' (iteration order is not guaranteed) | ||
*/ | ||
@@ -25,0 +32,0 @@ function forOwn(object, iteratee, thisArg) { |
@@ -18,6 +18,13 @@ import baseForRight from '../internal/baseForRight'; | ||
* | ||
* _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(n, key) { | ||
* function Foo() { | ||
* this.a = 1; | ||
* this.b = 2; | ||
* } | ||
* | ||
* Foo.prototype.c = 3; | ||
* | ||
* _.forOwnRight(new Foo, function(value, key) { | ||
* console.log(key); | ||
* }); | ||
* // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length' | ||
* // => logs 'b' and 'a' assuming `_.forOwn` logs 'a' and 'b' | ||
*/ | ||
@@ -24,0 +31,0 @@ function forOwnRight(object, iteratee, thisArg) { |
@@ -17,3 +17,3 @@ import baseFunctions from '../internal/baseFunctions'; | ||
* _.functions(_); | ||
* // => ['all', 'any', 'bind', ...] | ||
* // => ['after', 'ary', 'assign', ...] | ||
*/ | ||
@@ -20,0 +20,0 @@ function functions(object) { |
@@ -19,3 +19,5 @@ /** Used for native method references. */ | ||
* | ||
* _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); | ||
* var object = { 'a': 1, 'b': 2, 'c': 3 }; | ||
* | ||
* _.has(object, 'b'); | ||
* // => true | ||
@@ -22,0 +24,0 @@ */ |
@@ -24,12 +24,10 @@ import isIterateeCall from '../internal/isIterateeCall'; | ||
* | ||
* _.invert({ 'first': 'fred', 'second': 'barney' }); | ||
* // => { 'fred': 'first', 'barney': 'second' } | ||
* var object = { 'a': 1, 'b': 2, 'c': 1 }; | ||
* | ||
* // without `multiValue` | ||
* _.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' }); | ||
* // => { 'fred': 'third', 'barney': 'second' } | ||
* _.invert(object); | ||
* // => { '1': 'c', '2': 'b' } | ||
* | ||
* // with `multiValue` | ||
* _.invert({ 'first': 'fred', 'second': 'barney', 'third': 'fred' }, true); | ||
* // => { 'fred': ['first', 'third'], 'barney': ['second'] } | ||
* _.invert(object, true); | ||
* // => { '1': ['a', 'c'], '2': ['b'] } | ||
*/ | ||
@@ -36,0 +34,0 @@ function invert(object, multiValue, guard) { |
@@ -10,10 +10,10 @@ import baseCallback from '../internal/baseCallback'; | ||
* | ||
* If a property name is provided for `iteratee` the created "_.property" | ||
* If a property name is provided for `iteratee` the created `_.property` | ||
* style callback returns the property value of the given element. | ||
* | ||
* If value is also provided for `thisArg` the created "_.matchesProperty" | ||
* If a value is also provided for `thisArg` the created `_.matchesProperty` | ||
* style callback returns `true` for elements that have a matching property | ||
* value, else `false`. | ||
* | ||
* If an object is provided for `iteratee` the created "_.matches" style | ||
* If an object is provided for `iteratee` the created `_.matches` style | ||
* callback returns `true` for elements that have the properties of the given | ||
@@ -27,4 +27,3 @@ * object, else `false`. | ||
* @param {Function|Object|string} [iteratee=_.identity] The function invoked | ||
* per iteration. If a property name or object is provided it is used to | ||
* create a "_.property" or "_.matches" style callback respectively. | ||
* per iteration. | ||
* @param {*} [thisArg] The `this` binding of `iteratee`. | ||
@@ -34,4 +33,6 @@ * @returns {Object} Returns the new mapped object. | ||
* | ||
* _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(n) { return n * 3; }); | ||
* // => { 'a': 3, 'b': 6, 'c': 9 } | ||
* _.mapValues({ 'a': 1, 'b': 2 }, function(n) { | ||
* return n * 3; | ||
* }); | ||
* // => { 'a': 3, 'b': 6 } | ||
* | ||
@@ -43,3 +44,3 @@ * var users = { | ||
* | ||
* // using the "_.property" callback shorthand | ||
* // using the `_.property` callback shorthand | ||
* _.mapValues(users, 'age'); | ||
@@ -46,0 +47,0 @@ * // => { 'fred': 40, 'pebbles': 1 } (iteration order is not guaranteed) |
@@ -46,3 +46,5 @@ import baseMerge from '../internal/baseMerge'; | ||
* _.merge(object, other, function(a, b) { | ||
* return _.isArray(a) ? a.concat(b) : undefined; | ||
* if (_.isArray(a)) { | ||
* return a.concat(b); | ||
* } | ||
* }); | ||
@@ -49,0 +51,0 @@ * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot'] } |
@@ -28,14 +28,12 @@ import arrayEach from '../internal/arrayEach'; | ||
* | ||
* var squares = _.transform([1, 2, 3, 4, 5, 6], function(result, n) { | ||
* n *= n; | ||
* if (n % 2) { | ||
* return result.push(n) < 3; | ||
* } | ||
* _.transform([2, 3, 4], function(result, n) { | ||
* result.push(n *= n); | ||
* return n % 2 == 0; | ||
* }); | ||
* // => [1, 9, 25] | ||
* // => [4, 9] | ||
* | ||
* var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, n, key) { | ||
* _.transform({ 'a': 1, 'b': 2 }, function(result, n, key) { | ||
* result[key] = n * 3; | ||
* }); | ||
* // => { 'a': 3, 'b': 6, 'c': 9 } | ||
* // => { 'a': 3, 'b': 6 } | ||
*/ | ||
@@ -42,0 +40,0 @@ function transform(object, iteratee, accumulator, thisArg) { |
{ | ||
"name": "lodash-es", | ||
"version": "3.2.0", | ||
"version": "3.3.0", | ||
"description": "The modern build of lodash exported as ES modules.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://lodash.com/custom-builds", |
@@ -1,2 +0,2 @@ | ||
# lodash-es v3.2.0 | ||
# lodash-es v3.3.0 | ||
@@ -10,2 +10,2 @@ The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [ES](https://people.mozilla.org/~jorendorff/es6-draft.html) modules. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.2.0-es) for more details. | ||
See the [package source](https://github.com/lodash/lodash/tree/3.3.0-es) for more details. |
import createCompounder from '../internal/createCompounder'; | ||
/** | ||
* Converts `string` to kebab case (a.k.a. spinal case). | ||
* Converts `string` to kebab case. | ||
* See [Wikipedia](https://en.wikipedia.org/wiki/Letter_case#Special_case_styles) for | ||
@@ -6,0 +6,0 @@ * more details. |
@@ -36,9 +36,17 @@ import baseToString from '../internal/baseToString'; | ||
* | ||
* _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); | ||
* _.trunc('hi-diddly-ho there, neighborino', { | ||
* 'length': 24, | ||
* 'separator': ' ' | ||
* }); | ||
* // => 'hi-diddly-ho there,...' | ||
* | ||
* _.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); | ||
* _.trunc('hi-diddly-ho there, neighborino', { | ||
* 'length': 24, | ||
* 'separator': /,? +/ | ||
* }); | ||
* //=> 'hi-diddly-ho there...' | ||
* | ||
* _.trunc('hi-diddly-ho there, neighborino', { 'omission': ' [...]' }); | ||
* _.trunc('hi-diddly-ho there, neighborino', { | ||
* 'omission': ' [...]' | ||
* }); | ||
* // => 'hi-diddly-ho there, neig [...]' | ||
@@ -45,0 +53,0 @@ */ |
@@ -1,2 +0,1 @@ | ||
import baseSlice from '../internal/baseSlice'; | ||
import isError from '../lang/isError'; | ||
@@ -24,5 +23,12 @@ | ||
*/ | ||
function attempt(func) { | ||
function attempt() { | ||
var length = arguments.length, | ||
func = arguments[0]; | ||
try { | ||
return func.apply(undefined, baseSlice(arguments, 1)); | ||
var args = Array(length ? length - 1 : 0); | ||
while (--length > 0) { | ||
args[length - 1] = arguments[length]; | ||
} | ||
return func.apply(undefined, args); | ||
} catch(e) { | ||
@@ -29,0 +35,0 @@ return isError(e) ? e : new Error(e); |
@@ -35,3 +35,5 @@ import baseCallback from '../internal/baseCallback'; | ||
* return function(object) { | ||
* return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3]; | ||
* return match[2] == 'gt' | ||
* ? object[match[1]] > match[3] | ||
* : object[match[1]] < match[3]; | ||
* }; | ||
@@ -38,0 +40,0 @@ * }); |
@@ -13,2 +13,3 @@ /** | ||
* var getter = _.constant(object); | ||
* | ||
* getter() === object; | ||
@@ -15,0 +16,0 @@ * // => true |
@@ -12,2 +12,3 @@ /** | ||
* var object = { 'user': 'fred' }; | ||
* | ||
* _.identity(object) === object; | ||
@@ -14,0 +15,0 @@ * // => true |
@@ -21,10 +21,8 @@ import baseClone from '../internal/baseClone'; | ||
* var users = [ | ||
* { 'user': 'barney', 'age': 36 }, | ||
* { 'user': 'fred', 'age': 40 }, | ||
* { 'user': 'pebbles', 'age': 1 } | ||
* { 'user': 'barney' }, | ||
* { 'user': 'fred' }, | ||
* { 'user': 'pebbles' } | ||
* ]; | ||
* | ||
* var matchFred = _.matchesProperty('user', 'fred'); | ||
* | ||
* _.find(users, matchFred); | ||
* _.find(users, _.matchesProperty('user', 'fred')); | ||
* // => { 'user': 'fred', 'age': 40 } | ||
@@ -31,0 +29,0 @@ */ |
/** | ||
* A no-operation function. | ||
* A no-operation function which returns `undefined` regardless of the | ||
* arguments it receives. | ||
* | ||
@@ -10,2 +11,3 @@ * @static | ||
* var object = { 'user': 'fred' }; | ||
* | ||
* _.noop(object) === undefined; | ||
@@ -12,0 +14,0 @@ * // => true |
@@ -12,7 +12,7 @@ /** | ||
* | ||
* var object = { 'user': 'fred', 'age': 40, 'active': true }; | ||
* _.map(['active', 'user'], _.propertyOf(object)); | ||
* // => [true, 'fred'] | ||
* var object = { 'a': 3, 'b': 1, 'c': 2 }; | ||
* | ||
* var object = { 'a': 3, 'b': 1, 'c': 2 }; | ||
* _.map(['a', 'c'], _.propertyOf(object)); | ||
* // => [3, 2] | ||
* | ||
* _.sortBy(['a', 'b', 'c'], _.propertyOf(object)); | ||
@@ -19,0 +19,0 @@ * // => ['b', 'c', 'a'] |
@@ -11,4 +11,5 @@ import isIterateeCall from '../internal/isIterateeCall'; | ||
* Creates an array of numbers (positive and/or negative) progressing from | ||
* `start` up to, but not including, `end`. If `start` is less than `end` a | ||
* zero-length range is created unless a negative `step` is specified. | ||
* `start` up to, but not including, `end`. If `end` is not specified it | ||
* defaults to `start` with `start` becoming `0`. If `start` is less than | ||
* `end` a zero-length range is created unless a negative `step` is specified. | ||
* | ||
@@ -15,0 +16,0 @@ * @static |
@@ -28,6 +28,10 @@ import bindCallback from '../internal/bindCallback'; | ||
* | ||
* _.times(3, function(n) { mage.castSpell(n); }); | ||
* _.times(3, function(n) { | ||
* mage.castSpell(n); | ||
* }); | ||
* // => invokes `mage.castSpell(n)` three times with `n` of `0`, `1`, and `2` respectively | ||
* | ||
* _.times(3, function(n) { this.cast(n); }, mage); | ||
* _.times(3, function(n) { | ||
* this.cast(n); | ||
* }, mage); | ||
* // => also invokes `mage.castSpell(n)` three times | ||
@@ -34,0 +38,0 @@ */ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
362
12473
410028