Introduction
@open-kerno/commons is a shared TypeScript utility library for Node.js applications. It provides a set of well-tested, typed modules that solve common problems across services.
Installation
npm install @open-kerno/commons
Modules
| Module | Description |
|---|---|
http | HttpStatusCode and HttpMethod enums |
errors/http | Typed HTTP error classes |
errors/database | Typed database error classes |
collections | Array to Map/Set utilities |
math/distribution | Weighted value distribution |
math/rounding | Precision rounding |
logger | Structured logger with field masking |
infrastructure/database/postgres | PostgreSQL connection pool wrapper |
object | JSON encoding helpers |
currency | Immutable, fluent money arithmetic |
Requirements
- Node.js 18 or higher
- TypeScript 5 or higher