Version v2.1.0 Size 3.6 KB gzip Dependencies Zero dependencies
Why Arsenal?
Arsenal keeps common utilities at package root and places specialized behavior behind category entry points. This keeps autocomplete focused while preserving one dependency and tree-shakeable modules.
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 | 3.6 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 { chunk, groupBy, retry } from '@vielzeug/arsenal';
import { cache } from '@vielzeug/arsenal/cache';
import { taskPool } from '@vielzeug/arsenal/async';
const pages = chunk([1, 2, 3, 4, 5], 2);
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(pages, byRole, health, profile);Features
chunk: common array/string chunking from package rootretry: 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/objectclamp: numeric bounds from package rootisEqual: structural equality from package root