@maxxuxx/ts-utils
v0.8.0
Published
Shared TypeScript utilities
Maintainers
Readme
ts-utils
Shared TypeScript utilities for projects that need small reusable runtime helpers
Install
npm install @maxxuxx/ts-utilsGitHub install is also supported
npm install github:maxxuxx/ts-utilsImport style
Use subpath imports instead of the package root. The package root is intentionally empty so applications can import only the runtime surface they need
import { parser } from "@maxxuxx/ts-utils/parser";
import { createApiFetcher } from "@maxxuxx/ts-utils/api-fetch";
import { createTokenSession } from "@maxxuxx/ts-utils/session";Module map
| Entry point | Core role | Details |
|---|---|---|
| @maxxuxx/ts-utils/parser | Zod parser presets and wrappers for repeated runtime validation | parser |
| @maxxuxx/ts-utils/is | Runtime type guards for primitives, objects, collections, and built-ins | is |
| @maxxuxx/ts-utils/result | Discriminated success and failure values with mapping helpers | result |
| @maxxuxx/ts-utils/try-catch | Result helpers for sync and async error boundaries | try-catch |
| @maxxuxx/ts-utils/format | Formatting helpers for numbers, currency, dates, phone numbers, and units | format |
| @maxxuxx/ts-utils/normalize | Small coercion helpers for stable number, text, date, and boolean values | normalize |
| @maxxuxx/ts-utils/object | Plain object shaping helpers for request and response payloads | object |
| @maxxuxx/ts-utils/url | Web path, API URL, and query string helpers | url |
| @maxxuxx/ts-utils/promise | Timeout, retry, parallel, and settle helpers for promise tasks | promise |
| @maxxuxx/ts-utils/json | JSON parse, stringify, fallback, safe result, and schema boundary helpers | json |
| @maxxuxx/ts-utils/encoding | UTF-8, base64, hex, and byte conversion helpers | encoding |
| @maxxuxx/ts-utils/encoding/base64url | Strict browser and Node base64url text and byte helpers | encoding/base64url |
| @maxxuxx/ts-utils/jwt | JWT header and payload readers with expiration checks | jwt |
| @maxxuxx/ts-utils/env | Runtime environment readers and Zod schema helpers | env |
| @maxxuxx/ts-utils/time | Client/server timestamp helpers for estimating server time | time |
| @maxxuxx/ts-utils/device | Runtime-selecting device UUID helper | device |
| @maxxuxx/ts-utils/device/browser | Browser and renderer cookie-backed device UUID helpers | device/browser |
| @maxxuxx/ts-utils/device/node | Node machine ID based device UUID helpers | device/node |
| @maxxuxx/ts-utils/session | Framework-neutral token session controller | session |
| @maxxuxx/ts-utils/session/sveltekit | SvelteKit cookie session factory | session/sveltekit |
| @maxxuxx/ts-utils/session/react | React browser-storage token session helper | session/react |
| @maxxuxx/ts-utils/api-fetch | Fetch API client with validation, refresh, retry, timeout, hooks, and endpoints | api-fetch |
| @maxxuxx/ts-utils/api-fetch/sveltekit | SvelteKit adapter for api-fetch auth refresh | api-fetch/sveltekit |
| @maxxuxx/ts-utils/http-response | Small Web Response helpers for route handlers | http-response |
Runtime notes
- General utility modules are dependency-light and designed for browser and server code
- Zod-backed modules re-export
zfrom their own subpath when colocated schemas are useful - Device helpers are split into browser and Node subpaths; prefer the runtime-specific path when the target runtime is known
Development
npm run typecheck
npm test
npm run build