This repository was archived by the owner on Nov 27, 2023. It is now read-only.
This repository was archived by the owner on Nov 27, 2023. It is now read-only.
I still think Array#partition will be great as well #9
Closed
Description
Original proposal: tc39/proposal-array-filtering#2
Ofc with groupBy
we could be emulate partition
as:
function partition(arr, fn) {
return Object.values(arr.groupBy(idx => Number(!fn(idx))));
}
or
function partition(arr, fn) {
return Object.assign([], arr.groupBy(idx => Number(!fn(idx))));
}
But why not just present it as a first class citizen?
Metadata
Metadata
Assignees
Labels
No labels