arrayBatch
このコンテンツはまだ日本語訳がありません。
arrayBatch<
T>(inputArray,batchSize?):T[][]
Defined in: index.ts:281
Utility function to split an array into batches of a specified size.
Type Parameters
Section titled “Type Parameters”T = any
Parameters
Section titled “Parameters”inputArray
Section titled “inputArray”T[]
batchSize?
Section titled “batchSize?”number = 1
Returns
Section titled “Returns”T[][]
Example
Section titled “Example”const items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]const batches = arrayBatch(items, 3)// Output: [[1, 2, 3], [4, 5, 6], [7, 8, 9], [10]]Throws
Section titled “Throws”If batchSize is not a positive integer