Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

219 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

typescript-toolkit

πŸ”§βœ¨ Tiny helpers for TypeScript applications

Version on NPM Version on JSR Semantically released Monthly downloads on NPM License

Small, focused utilities you import one at a time.

Features

  • 🎯 High-quality module design
  • ⚑ Lightweight sub-package exports
  • πŸ“¦ Tree-shakeable ES modules
  • βœ… Zero dependencies

Installation

npm install @peerigon/typescript-toolkit --save

Also available on JSR.

Usage

Import only the utilities you need. Each one is exposed as its own subpath:

import { assert } from "@peerigon/typescript-toolkit/assert";

Utilities

Module Description Docs
api Define a typed JSON API client with an overridable hook pipeline β†’
api/rate-limit Rate-limited fetch for defineApi (pacing + Retry-After) β†’
api/result defineApiResult β€” like defineApi, but returns Result.Sync β†’
assert Assert a value is not null or undefined, with TypeScript narrowing β†’
concurrency/once Run an async function at most once (single-flight + cache) β†’
concurrency/once/result once with a synchronous Result snapshot β†’
concurrency/exactlyOnce Invoke an async function exactly once; second call throws β†’
concurrency/exactlyOnce/result exactlyOnce with a synchronous Result snapshot β†’
concurrency/mutex Serialize async tasks (concurrency 1) β†’
concurrency/rate-limit Pace async task starts (max per sliding interval) β†’
need Assert a value is not null or undefined and return it with a narrowed type β†’
no-null Convert between null and undefined in JSON-like values (runtime + types) β†’
dedupe Remove duplicate values from an array while preserving first-occurrence order β†’
emitter Minimal typed event emitter with payload objects per event β†’
enums Lightweight string-enum alternative for erasableSyntaxOnly TypeScript projects β†’
map-leaves Deeply map leaves in JSON-like values (mutates arrays/objects in place) β†’
match Exhaustive pattern matching with compile-time case checks, similar to switch β†’
metadata Typed metadata attached to objects via per-channel WeakMap stores β†’
namespace Hierarchical namespaces with exclusive member claims and dotted prefixes β†’
result Type-safe error handling with pending, success, and error states β†’
signals Push-based reactive state with explicit watchers and signal.from adapters β†’
sleep Promise-based delay with optional AbortSignal cancellation β†’
stable-stringify Deterministic stringify for JSON + Map/Set/BigInt/Symbol/Date/RegExp β†’
stable-stringify/json JSON-only deterministic JSON.stringify with sorted object keys β†’
unwrap Extract values from Result or nullable types, with optional fallback support β†’

License

MIT

Sponsors

Peerigon

About

πŸ”§βœ¨ Tiny helpers for TypeScript applications

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages