API reference
Every function, class and type in node-comfort, generated from the same declarations your editor reads. 539 entries across 23 namespaces.
The four essentials (logger, fs, checker and utils) are also available at the top level. Everything else lives in its namespace, and each namespace can be imported on its own from @ix-xs/node-comfort/<name>.
Essentials
nc.loggerA console logger that works with zero setup: levels, colors, a small markup for styling, groups, timers and...
45nc.fsFiles and folders without try/catch: read and write text or JSON (atomically), copy, move, delete, list,...
62nc.checkerType checks and validators. Every isX accepts anything and never throws, and most of them are type guards:...
19nc.envEnvironment variables you can trust: .env loading, typed getters, and validate() to check your whole...
9nc.errorsThe errors node-comfort throws. They all extend NodeComfortError (itself a regular Error) and carry a stable...
5nc.utilsEveryday helpers: wait, when, dontCrash, and JSON functions that don't throw. They are also available at the...
Data
nc.strString helpers: case conversion, slugs, truncation, templates, wrapping, fuzzy matching, plurals. Nothing is...
39nc.numNumbers: clamping, rounding that gets decimals right, statistics, and formatting for humans (sizes, money,...
39nc.arrArray helpers. None of them mutate what you pass in, and item types carry through (chunk(numbers, 2) is a...
26nc.objObject helpers: deep clone, merge, equality, diff, typed dot paths, pick and omit. Inputs are never mutated,...
37nc.timeDates and durations: formatting, relative time, calendar math, time zones and scheduling, in any language...
14nc.idUnique ids: UUID v4 and v7, ULID, nanoid-style ids, Snowflakes, tokens and short codes. All of them use the...
19nc.schemaValidate data with schemas, in the spirit of zod. Describe your data once and get both a runtime check with...
Functions and async
nc.funcFunction helpers: debounce, throttle, memoize, retry with backoff, timeouts, error handling without...
14nc.asyncPromises and concurrency: map with a limit, queues with priorities, mutexes, polling, and friendlier...
16CacheAn in-memory cache with a size limit (the least recently used entries go first), expiry per entry, and...
12EmitterA small typed event emitter. Declare your events once, and your editor checks every event name and listener...
System and network
nc.httpAn HTTP client on top of fetch: JSON by default, query objects, base URLs, timeouts, safe retries that...
34SQLiteSQLite made pleasant, on the engine built into Node.js (22.13+): CRUD with rich filters, JSON and boolean...
13nc.cliWhat you need for command-line tools: typed arguments with a generated --help, prompts, arrow-key menus,...
8nc.colorTerminal colors you can chain, like chalk. Truecolor is supported and downgraded on older terminals. Colors...
13nc.sysProcesses and the system: run commands and get their output, find executables, shut down cleanly, open URLs,...
20nc.cryptoCrypto without the footguns, built on node:crypto: hashes, HMAC, password hashing (scrypt), encryption...