Version v3.0.0 Size 4.0 KB gzip Dependencies Zero dependencies
Why Arsenal?
Arsenal provides typed, zero-dependency utilities that reduce repeated application code: collection transforms, numeric operations, retry and cancellation, caching, safe-path traversal, and deterministic serialization. The root stays curated while category entry points expose the broader toolkit. Exact platform aliases remain excluded.
ts
// Before
const users = JSON.parse(raw).filter((user) => user.name.includes(query));
// After
import { fuzzyFilter } from '@vielzeug/arsenal/array';
import { tryParseJson } from '@vielzeug/arsenal/object';
const parsed = tryParseJson(raw);
const users = parsed.ok ? fuzzyFilter(parsed.value as User[], query, { select: (user) => user.name }) : [];| Feature | Arsenal | lodash-es | Remeda |
|---|---|---|---|
| Bundle size | 4.0 KB | ~72 kB | ~18 kB |
| Typed root utilities | Partial | ||
| Category entry points | Partial | Partial | |
| Async task pool and cache | |||
| Zero dependencies |
Use Arsenal when you need one typed utility dependency with focused subpaths for specialized behavior.
Consider narrower alternatives when you need only platform APIs or a small functional subset.
Installation
sh
pnpm add @vielzeug/arsenalsh
npm install @vielzeug/arsenalsh
yarn add @vielzeug/arsenalQuick Start
ts
import { groupBy, retry } from '@vielzeug/arsenal';
import { cache } from '@vielzeug/arsenal/cache';
import { taskPool } from '@vielzeug/arsenal/async';
const byRole = groupBy([{ role: 'admin' }, { role: 'user' }], (user) => user.role);
const pool = taskPool({ concurrency: 2 });
const health = await pool.run((signal) => retry(() => fetch('/health', { signal }).then((response) => response.json())));
const responses = cache<string, unknown>({ ttlMs: 60_000 });
const profile = await responses.getOrLoad('/profile', () => fetch('/profile').then((response) => response.json()));
pool.dispose();
console.log(byRole, health, profile);Features
retry: retry async work with cancellation support from package roottaskPool: bounded, disposable concurrent work from/asynccache: identity-keyed TTL cache with async load deduplication from/cachefuzzyFilter: explicit-field fuzzy filtering from/arraytryParseJson: preserve JSON syntax failures from/objectallocate: lossless proportional distribution from/mathchunk,zip,compact: typed collection transforms from/arrayrange,average,median: common numeric operations from/mathassert,tap: typed control-flow helpers from/functionisEqual: structural equality from package roothash: deterministic serialization for stable cache keys from/object