mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Remove semicolons.
This commit is contained in:
10
partition.js
10
partition.js
@@ -1,4 +1,4 @@
|
||||
import reduce from './reduce.js';
|
||||
import reduce from './reduce.js'
|
||||
|
||||
/**
|
||||
* Creates an array of elements split into two groups, the first of which
|
||||
@@ -18,15 +18,15 @@ import reduce from './reduce.js';
|
||||
* { 'user': 'barney', 'age': 36, 'active': false },
|
||||
* { 'user': 'fred', 'age': 40, 'active': true },
|
||||
* { 'user': 'pebbles', 'age': 1, 'active': false }
|
||||
* ];
|
||||
* ]
|
||||
*
|
||||
* partition(users, ({ active }) => active);
|
||||
* partition(users, ({ active }) => active)
|
||||
* // => objects for [['fred'], ['barney', 'pebbles']]
|
||||
*/
|
||||
function partition(collection, predicate) {
|
||||
return reduce(collection, (result, value, key) => (
|
||||
result[key ? 0 : 1].push(value)
|
||||
), [[], []]);
|
||||
), [[], []])
|
||||
}
|
||||
|
||||
export default partition;
|
||||
export default partition
|
||||
|
||||
Reference in New Issue
Block a user