Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/froebel/batch.ts>default

A strictly typed utility library.
Latest
variable default
import { default } from "https://deno.land/x/froebel@v0.23.2/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[][]