mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
Remove baseIteratee and castFunction.
This commit is contained in:
14
partition.js
14
partition.js
@@ -11,7 +11,7 @@ import createAggregator from './_createAggregator.js';
|
||||
* @since 3.0.0
|
||||
* @category Collection
|
||||
* @param {Array|Object} collection The collection to iterate over.
|
||||
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
||||
* @param {Function} predicate The function invoked per iteration.
|
||||
* @returns {Array} Returns the array of grouped elements.
|
||||
* @example
|
||||
*
|
||||
@@ -23,18 +23,6 @@ import createAggregator from './_createAggregator.js';
|
||||
*
|
||||
* _.partition(users, function(o) { return o.active; });
|
||||
* // => objects for [['fred'], ['barney', 'pebbles']]
|
||||
*
|
||||
* // The `_.matches` iteratee shorthand.
|
||||
* _.partition(users, { 'age': 1, 'active': false });
|
||||
* // => objects for [['pebbles'], ['barney', 'fred']]
|
||||
*
|
||||
* // The `_.matchesProperty` iteratee shorthand.
|
||||
* _.partition(users, ['active', false]);
|
||||
* // => objects for [['barney', 'pebbles'], ['fred']]
|
||||
*
|
||||
* // The `_.property` iteratee shorthand.
|
||||
* _.partition(users, 'active');
|
||||
* // => objects for [['fred'], ['barney', 'pebbles']]
|
||||
*/
|
||||
const partition = createAggregator((result, value, key) =>
|
||||
result[key ? 0 : 1].push(value), () => [[], []]);
|
||||
|
||||
Reference in New Issue
Block a user