Skip to main content

$$partition

Partition an array to multiple constant size arrays

Usage​

{
"$$partition": [ /* values */ ],
"size": 100
}
"$$partition([size]):{input}"

Returns​

array (of arrays of same items type as input)

Arguments​

ArgumentTypeValuesRequired / Default ValueDescription
PrimaryarrayYesArray of elements
sizenumberA positive integer100The size of each partition

Examples​

Input

Definition

Output

[
"a",
"b",
"c",
"d",
"e",
"f"
]
{ 
"$$partition": "$",
"size": 3
}
[
[
"a",
"b",
"c"
],
[
"d",
"e",
"f"
]
]
[
"a",
"b",
"c",
"d",
"e",
"f"
]
"$$partition(3):$"
[
[
"a",
"b",
"c"
],
[
"d",
"e",
"f"
]
]