@peerigon/typescript-toolkit
v2.2.0
Published
🔧✨ Tiny helpers for TypeScript applications
Readme
Features
- 🎯 High-quality module design
- ⚡ Lightweight sub-package exports
- 📦 Tree-shakeable ES modules
Installation
npm install @peerigon/typescript-toolkit --saveAlso 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 |
| ------------------------------------ | -------------------------------------------------------------------------------- | ---------------------------- |
| assert | Assert a value is not null or undefined, with TypeScript narrowing | → |
| need | Assert a value is not null or undefined and return it with a narrowed type | → |
| 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 | → |
| match | Exhaustive pattern matching with compile-time case checks, similar to switch | → |
| result | Type-safe error handling with pending, success, and error states | → |
| signals | Push-based reactive state with explicit subscribers and signal.from adapters | → |
| unwrap | Extract values from Result or nullable types, with optional fallback support | → |
