chunk
配列 arr を長さ length のサブ配列に分割します。
Added in v0.0.2
Usage
ts
import { chunk } from 'parsnip-kit'
const arr = [1, 2, 3, 4, 5]
chunk(arr, 2)
// [[1, 2], [3, 4], [5]]API
Type Parameter
| Arg | Type | Description |
|---|---|---|
T | | 要分割的数组的元素类型 |
Arguments
| Arg | Type | Optional | Default | Description |
|---|---|---|---|---|
arr | T[] | false | undefined | 分割する配列 |
length | length | false | undefined | サブ配列の長さ |
Returns
| Type |
|---|
T[][] |