Toolkit Examples
Use these example collections to find working snippets for the current Toolkit API.
How to Use These Examples
- Start with the category that matches your immediate task.
- Move to adjacent categories as your utility needs grow.
- Keep the API page open while adapting snippets to your project.
Categories
- Array utilities
- Async utilities
- Date utilities
- Function utilities
- Math utilities
- Money utilities
- Object utilities
- Random utilities
- String utilities
- Typed utilities
Getting Started
ts
import { chunk, retry, currency, Scheduler } from '@vielzeug/toolkit';
const batches = chunk([1, 2, 3, 4], 2);
const value = currency({ amount: 1299n, currency: 'USD' });
await retry(async () => fetch('/api/health'), {
times: 3,
delay: 100,
shouldRetry: (err, attempt) => attempt < 2,
});
// Background-priority task (won't delay user interactions)
const scheduler = new Scheduler();
void scheduler.postTask(() => cleanupOldData(), { delay: 60_000, priority: 'background' });