Skip to content

Use these examples as copy/paste starting points for real applications.

Categories

Quick Example

ts
import { chunk, partial, queue, retry } from '@vielzeug/toolkit';

const doubleAll = partial((factor: number, values: number[]) => values.map((n) => n * factor), 2);
const pages = chunk(doubleAll([1, 2, 3, 4, 5]), 2);

const q = queue({ concurrency: 2 });
await q.add(() => retry(() => fetch('/api/a').then((r) => r.json()), { times: 2 }));

console.log(pages);