Skip to content

Reinforcements

A TypeScript utility belt. ~130 functions for objects, strings, numbers, async, randomness, and functional composition. Path-first object access, smart string casings, real concurrency helpers, deterministic randomness — all from one import, all tree-shakable, all typed.

Highlighted features

~130 typed helpers

One install replaces a handful of lodash modules — and ships with TypeScript-first signatures, not adapter packages.

Path-first object access

get(user, “profile.email”) autocompletes every legal dot-notation path and infers the value type — no as casts, no manual generics.

Smart string casings

The casing family shares one words() tokenizer that handles acronyms correctly: AIAgent[“AI”,“Agent”], not [“A”,“I”,“Agent”].

Async helpers that scale

retry with backoff, pMap with concurrency caps, timeout, defer, sleep — without pulling in the whole p-* ecosystem.

Random namespace

Random.int(1, 10), Random.uuid(), Random.sample(arr), Random.seed(n) for deterministic test fixtures. Namespace class, never new.

lazy breaks cycles

The one tool that resolves ES-module circular imports cleanly — defer evaluation until first read.

Install

Terminal window
npm install @mongez/reinforcements

Quick peek

import { get, slugify, debounce, retry, pMap, Random } from "@mongez/reinforcements";
const email = get(user, "profile.email"); // typed by path
const slug = slugify("Café & Croissant"); // "cafe-croissant"
const save = debounce(persist, 500, { maxWait: 3_000 }); // cancel / flush / pending
const data = await retry(() => fetch(url), { attempts: 5 });
const docs = await pMap(urls, fetch, { concurrency: 5 });
const id = Random.uuid();

A taste of the breadth — typed path access, casing, debouncing, retries, parallel mapping, and randomness all from one import.

Namespaces

NamespaceCountExamples
object24get, set, pick, omit, compact, merge, clone, flatten, walk, diff
string~45Casing family, slugify, truncate, template, mask, stripHtmlTags
number12round, clamp, formatBytes, percentage, safeDivide
array18chunk, range, unique, pluck, groupBy, sum
random14Random.int, Random.uuid, Random.sample, Random.seed
function17debounce, throttle, memoize, pipe, curry, once
async11sleep, retry, timeout, pMap, pProps, pFilter, defer
types16Path, PathValue, DeepPartial, Branded, Prettify
lazy1 + variantslazy, lazy.async, lazy.from, isLazy
mixed4clone, areEqual, shuffle, coalesce

Scope boundaries

ConcernLives inWhy
Type/shape predicates (isString, isEmpty, isURL, …)@mongez/supportive-isSingle-purpose package
Array collection helpers (partition, keyBy, sortBy, …)@mongez/collectionRicher collection model
HTML sanitizationUse DOMPurifyParser-based, not regex
Schema validationUse zod / valibotOut of scope
Date manipulationUse dayjs / date-fns / TemporalOut of scope

Where to go next