Skip to main content

API Conventions

Consistent API design across all modules.

Naming Conventions

Constructors

Converters

Predicates

Comparisons

Function Signatures

Input Flexibility

Public functions accept flexible inputs:

Internal Functions

Internal functions require exact types:

Naming Convention

Error Handling

Error Types

Each module defines its own error class:

When to Throw

Error Messages

Return Types

Branded Types

Always return branded types, not plain arrays:

Immutability

Returned values should be treated as immutable:

Documentation

JSDoc for .js Files

TypeScript Types in index.ts

Constants

Named Constants

Export in Index

Module Structure

Standard Exports

Every primitive module exports:

Namespace Usage

Async Conventions

Sync by Default

Most functions are synchronous:

Async When Required

Use async only for I/O:

Naming for Async