UNPKG
multi-lock-queue
Version:
latest (1.0.2)
1.0.2
1.0.1
1.0.0
optimally parallelize tasks that lock on potentially intersecting sets of ids
multi-lock-queue
/
partition.js
15 lines
(12 loc)
•
225 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const
partition
= (
arr, condition
) => {
const
yes = []
const
no = []
for
(
const
item
of
arr) {
const
side =
condition
(item) ? yes : no side.
push
(item) }
return
[yes, no] }
module
.
exports
= { partition }