Skip to content

Helpers 4 TypeScript

Production-ready TypeScript utility functions — modular, strictly typed, exhaustively tested.

A collection of functional helpers to stop rewriting the same utility code across every project — each function does one thing, does it right, and ships with full type safety and exhaustive tests.

Born from 10 years of recoding the same domain-specific helpers across projects, helpers4 covers the gaps that popular general-purpose toolkits deliberately exclude: dates, URLs, semver, observables, promise guards. The Philosophy and the Radashi comparison pages explain the reasoning in detail.

  • Tree-shakable — import one function, pay for one function
  • Framework-agnostic — React, Vue, Svelte, Angular, or no framework at all
  • Well-typed — strict TypeScript, no any, full inference
  • Zero runtime dependencies — nothing pulled in at runtime
  • Battle-tested — 100% coverage, >90% mutation score, property-based · contract · boundary · security tests
  • Enterprise-grade — formal LGPL-3.0 license, audit-ready, predictable at scale
  • AI-ready — exhaustive contracts make every function safe to call from generated or agentic code

V2 is a major milestone with 40+ new helpers:

40+ new helpersanalyzeCommits, buildConventionalCommitRegex, formatSize, injectWordBreaks, isArrayBuffer, isBlob, isBuffer, isConventionalCommit, isFormData, isPrerelease, parseConventionalCommit, parsePackageRepository, safeJsonParse, stringify, truncate, and many more
New commit categoryParse and analyze Conventional Commits messages with formal structure validation
New version categoryparse, compare, increment, stringify — semantic version operations with full SemVer 2.0.0 support
Expanded type categoryGuards for every major type: isTemporalInstant, isTemporalDuration, isTemporalPlainDate, isTemporalPlainDateTime, isPromise, isIterable, and more
Mutation testing>90% score — tests verified to catch regressions, not just execute — dashboard
Property-based testsInvariants validated against thousands of random inputs (fast-check)
Contract testsFormal behavioral guarantees for each function
Boundary & security testsEdge values and security-sensitive inputs (prototype pollution, injections)
Native API trackingStandard JS equivalents documented, not re-implemented
New docs siteYou’re reading it — built with Astro, fully searchable

Wondering how helpers4 stacks up against other utility libraries? See the comparisons section.

Some helpers share the same name across multiple categories — for example, compact exists in both @helpers4/array and @helpers4/object because it is a genuinely different operation on a different data type. When you need both in the same file, use the standard ES module as rename:

import { compact as compact4array } from '@helpers4/array';
import { compact as compact4object } from '@helpers4/object';

See the full list in Name Conflicts.

Found a bug or want to suggest a helper? Open an issue on the TypeScript repository.

Want to improve this documentation? Use the Edit page link at the bottom of any page, or open an issue on the website repository.