Lightweight, tree-shakeable, zero-dependency TypeScript utilities. Pay only for what you import.
- Tree-shakeable — every utility ships from its own subpath; bundlers drop everything you don't import.
- Zero dependencies — no transitive bloat, no supply-chain risk.
- TypeScript-first — full type inference and strict null safety out of the box.
- Tiny per-utility footprint — most utilities are under 500 B brotlied; the largest is ~1.2 kB.
- Benchmarked — measured against lodash, radash, es-toolkit, and native JavaScript — up to 11× faster on the slowest competitor.
- Interactive playground — every utility has a "Try it" block on its docs page that runs
1o1-utils directly from npm.
Import everything from the main entry:
import { chunk, pick, slugify, retry } from "1o1-utils";
Or import individual modules for minimal bundles:
import { chunk } from "1o1-utils/chunk";
import { pick } from "1o1-utils/pick";
| Utility |
Description |
Import |
arrayToHash |
Convert an array to a keyed object |
1o1-utils/array-to-hash |
chunk |
Split an array into fixed-size chunks |
1o1-utils/chunk |
diff |
Elements in array A not in array B |
1o1-utils/diff |
groupBy |
Group array items by a key |
1o1-utils/group-by |
partition |
Split into [matches, rest] by predicate |
1o1-utils/partition |
range |
Generate a numeric range as an array |
1o1-utils/range |
replace |
Replace element(s) by predicate (immutable) |
1o1-utils/replace |
shuffle |
Fisher-Yates shuffle (non-mutating) |
1o1-utils/shuffle |
sortBy |
Sort an array by a key |
1o1-utils/sort-by |
times |
Invoke fn N times and collect results |
1o1-utils/times |
unique |
Deduplicate an array (optionally by key) |
1o1-utils/unique |
unzip |
Split an array of tuples into separate arrays |
1o1-utils/unzip |
zip |
Combine arrays into tuples by index |
1o1-utils/zip |
| Utility |
Description |
Import |
clamp |
Clamp a value to [min, max] |
1o1-utils/clamp |
inRange |
Check if a number is in a range |
1o1-utils/in-range |
randomInt |
CSPRNG random integer in a range |
1o1-utils/random-int |
| Utility |
Description |
Import |
cloneDeep |
Deep clone (objects, arrays, Maps, Sets, etc.) |
1o1-utils/clone-deep |
compact |
Remove falsy values (with keep exceptions) |
1o1-utils/compact |
deepMerge |
Recursively merge objects |
1o1-utils/deep-merge |
defaults |
Fill undefined keys with defaults |
1o1-utils/defaults |
defaultsDeep |
Recursive defaults |
1o1-utils/defaults-deep |
get |
Read a nested value via dot notation |
1o1-utils/get |
isCircular |
Detect circular references in objects/arrays/Maps/Sets |
1o1-utils/is-circular |
isEmpty |
Check if a value is empty |
1o1-utils/is-empty |
mapKeys |
Transform object keys via an iteratee |
1o1-utils/map-keys |
mapValues |
Transform object values via an iteratee |
1o1-utils/map-values |
omit |
Remove keys from an object |
1o1-utils/omit |
omitBy |
Remove entries by predicate |
1o1-utils/omit-by |
pick |
Extract keys from an object |
1o1-utils/pick |
pickBy |
Keep entries by predicate |
1o1-utils/pick-by |
set |
Set a nested value immutably via dot notation |
1o1-utils/set |
| Utility |
Description |
Import |
capitalize |
Capitalize the first letter |
1o1-utils/capitalize |
deburr |
Strip diacritics (accent-fold) |
1o1-utils/deburr |
escapeRegExp |
Escape regex metacharacters |
1o1-utils/escape-reg-exp |
generateString |
Cryptographically-secure random string generator |
1o1-utils/generate-string |
normalizeEmail |
Trim, lowercase, optional plus-strip |
1o1-utils/normalize-email |
slugify |
Convert to a URL-friendly slug |
1o1-utils/slugify |
transformCase |
Change string casing (camel, snake, etc.) |
1o1-utils/transform-case |
truncate |
Truncate a string with a suffix |
1o1-utils/truncate |
| Utility |
Description |
Import |
debounce |
Debounce function calls |
1o1-utils/debounce |
retry |
Retry failed async operations with backoff |
1o1-utils/retry |
safely |
Wrap a function to return [error, result] |
1o1-utils/safely |
sleep |
Promise-based delay |
1o1-utils/sleep |
throttle |
Throttle function calls |
1o1-utils/throttle |
waitForCondition |
Poll a predicate until truthy or timeout |
1o1-utils/wait-for-condition |
withTimeout |
Race a promise against a timeout |
1o1-utils/with-timeout |
| Utility |
Description |
Import |
deepEqual |
Recursive structural equality |
1o1-utils/deep-equal |
isNil |
null or undefined check |
1o1-utils/is-nil |
shallowEqual |
Top-level entry equality |
1o1-utils/shallow-equal |
| Utility |
Description |
Import |
secondsToTimeFormat |
Format seconds as MM:SS / H:MM:SS |
1o1-utils/seconds-to-time-format |
timeFormatToSeconds |
Parse MM:SS / H:MM:SS into seconds |
1o1-utils/time-format-to-seconds |
| Utility |
Description |
Import |
memo |
Memoize a function with optional TTL |
1o1-utils/memo |
once |
Run only once, cache the first result |
1o1-utils/once |
pipe |
Compose functions left-to-right |
1o1-utils/pipe |
| Utility |
Description |
Import |
isValidEmail |
HTML5 + RFC 5321 email check |
1o1-utils/is-valid-email |
isValidPhone |
E.164 international phone check |
1o1-utils/is-valid-phone |
isValidUrl |
WHATWG URL parseable check |
1o1-utils/is-valid-url |
| Utility |
Description |
Import |
bindKey |
Keyboard shortcuts (combos + sequences) |
1o1-utils/bind-key |
copyToClipboard |
Clipboard API + execCommand fallback |
1o1-utils/copy-to-clipboard |
Run pnpm size to see per-utility brotli sizes locally. Sample from the latest release:
| Utility |
Brotli size |
isNil |
36 B |
clamp |
150 B |
chunk |
199 B |
deepEqual |
739 B |
bindKey |
1.05 kB |
isValidPhone |
1.19 kB |
| Whole library (all utilities) |
~11.6 kB brotli / ~13 kB gzipped |
Tree-shaking removes everything you don't import — typical real-world bundles add a few hundred bytes per utility, not the whole 13 kB.
All utilities are benchmarked against lodash, radash, es-toolkit, and native JavaScript.
| Utility |
vs lodash |
vs radash |
vs native |
| arrayToHash / keyBy |
on par |
on par |
on par |
| chunk |
4.9× faster |
on par |
on par |
| groupBy |
1.3× faster |
on par |
1.1× slower |
| unique (by key) |
2.7× faster |
1.6× faster |
on par |
| pick |
3.3× faster |
on par |
— |
Run pnpm bench to reproduce locally. See full benchmark results.
Full API reference, interactive playground, and migration guides at pedrotroccoli.github.io/1o1-utils.
Every utility page includes a Try it block — Sandpack-powered, runs 1o1-utils straight from npm in your browser. No install needed to experiment.
Contributions are welcome! Check out the Contributing Guide to get started.
MIT — Pedro Troccoli