Skip to main content
Module

x/froebel/batch.ts>default

A strictly typed utility library.
Go to Latest
variable default
import { default } from "https://deno.land/x/froebel@v0.21.3/batch.ts";

Takes a list and returns it in multiple smaller lists of the size batchSize. The last batch may be smaller than batchSize depending on if list size is divisible by batchSize.

Examples

Example 1

batch([1,2,3,4,5], 2)  // -> [ [1,2], [3,4], [5] ]

type

<T>(list: T[], batchSize: number) => T[][]