Skip to content
CIVersionSizeTypeScriptDependencies
Toolkit logo

Toolkit

⚡ Quick Reference

Package: @vielzeug/toolkit  ·  Category: Utilities

Key exports: chunk, debounce, throttle, group, clamp, isEqual, deepClone, currency, retry, sleep

When to use: 75+ tree-shakeable utility functions for arrays, objects, strings, async control, math, and money. Import only what you use.

@vielzeug/toolkit is a compact utility package built for modern TypeScript projects. The API is intentionally small, composable, and fully tree-shakeable.

Installation

sh
pnpm add @vielzeug/toolkit
sh
npm install @vielzeug/toolkit
sh
yarn add @vielzeug/toolkit

Quick Start

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

const pages = chunk([1, 2, 3, 4, 5], 2);
const user = pick({ id: 1, name: 'Alice', role: 'admin' }, ['id', 'name']);

const q = queue({ concurrency: 2 });
await q.add(() => fetch('/api/a'));

const health = await retry(() => fetch('/api/health').then((r) => r.json()), {
  times: 3,
  delay: 250,
});

const cfg = parseJSON('{"api":{"host":"localhost","port":3000}}', {
  defaultValue: { api: { host: 'localhost', port: 3000 } },
});

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

if (is.object(cfg)) {
  console.log(health, cfg, user);
}

Why Toolkit?

Toolkit favors a curated, typed utility surface over an everything-and-the-kitchen-sink API, with zero dependencies and modern tree-shakeable exports.

FeatureToolkitlodash-esRemeda
Bundle size10.2 KB~72 kB~18 kB
TypeScript-first ergonomicsPartial
Deep utility coveragePartial
Async control-flow helpersPartial
Typed predicate namespacePartial
Tree-shakeable modules
Zero dependencies

Use Toolkit when you want one compact, typed utility layer that covers array/object/function/async/math/date/random use cases.

Consider narrower alternatives when you only need a small functional subset and prefer ultra-focused APIs.

Features

  • Array: chunk, compact, countBy, difference, filterMap, flatten, groupBy, indexBy, partition, sample, take/drop, union/intersection, zip/unzip, and more
  • Async: attempt, abortable, timeout, parallel, queue, Scheduler, retry, waitFor
  • Object: pick, omit, mapValues, mapKeys, filterValues, entries, fromEntries, keys, values, deepClone, defaults, deepMerge, shallowMerge, parseJSON, get, seek, stash
  • Function: partial, negate, and/or/not, tap, identity, constant, composition, memoization, and rate limiting
  • Math: lerp, normalize, mod, gcd/lcm, variance, standardDeviation, plus existing numeric helpers
  • Date: expires, interval, timeDiff
  • Money: currency, exchange
  • Random: draw, random, shuffle, uuid
  • Typed Namespace: is.array, is.boolean, is.date, is.defined, is.empty, is.equal, is.fn, is.greaterThan, is.greaterThanOrEqual, is.lessThan, is.lessThanOrEqual, is.match, is.nil, is.number, is.object, is.primitive, is.promise, is.regex, is.string, is.typeOf, is.within
  • Typed Predicates: standalone numeric helpers isGreaterThan, isGreaterThanOrEqual, isLessThan, isLessThanOrEqual, isWithin

Compatibility

EnvironmentSupport
Browser
Node.js
SSR
Deno

See Also