-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathdeno_partition.deno.txt
32 lines (25 loc) · 1.38 KB
/
deno_partition.deno.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
┏━━━━━━━━━━━━━━━━━━━━┓
┃ DENO_PARTITION ┃
┗━━━━━━━━━━━━━━━━━━━━┛
VERSION ==> #Part of Deno
#Browser compatible
@std/collections/partition
partition
(ITERABLE, FUNC(VAL)->BOOL)
->[ARR, ARR2] #Split ITERABLE into 2 sub-ARRs: with true (ARR) and false (ARR2)
@std/collections/partition-entries
partitionEntries
(OBJ, FUNC(['KEY', VAL])->BOOL)
->[OBJ2, OBJ3] #Split OBJ into 2 sub-OBJs: with true (OBJ2) and false (OBJ3)
@std/collections/[unstable-]chunk
chunk(ITERABLE, NUM)->ARR_ARR #Split ITERABLE into sub-ARRs of size NUM, with different items
!#Can be any ITERABLE, not only ARR
@std/collections/
[unstable-]sliding-windows
slidingWindows
(ARR|ITERABLE, NUM[, OPTS])
->ARR_ARR #Split ARR|ITERABLE into sub-ARRs of size NUM, with sliding items,
#i.e. each sub-ARR starts|ends only OPTS.step items after the previous ones.
!#Can use ITERABLE
OPTS.step #NUM (def: 1)
OPTS.partial #BOOL (def: false). Also return last sub-ARRs of size < NUM