Skip to content
Overview

Overview

Documentation for @pencroff-lab/kore, a TypeScript core utilities library providing value-based error handling: the immutable Err type and flow, a tier of free functions over ResultTuple<T>.

Everything linked from this page ships inside the npm package. If you are reading this from node_modules/@pencroff-lab/kore/docs/, you are reading the documentation for the exact version you have installed — prefer it over the website when the two disagree.

Start here

import { Err, ok, fail, pipe, onOk, onErr, defaultTo } from "@pencroff-lab/kore";
import { expectOk, expectErr } from "@pencroff-lab/kore/test";

The package has two entry points: the root export carries the library, and @pencroff-lab/kore/test carries the assertion helpers so they never reach production bundles.

A ResultTuple<T> is readonly [T, null] | readonly [null, Err]. The error slot is the only failure signal — no operation inspects a value’s runtime shape. Every fallible callback returns a ResultTuple; maps and explicit value adapters carry their callback returns as data.

API reference

Generated from the source comments; regenerated on every release.

  • Overview — every exported symbol
  • flow — the primary API: free functions over ResultTuple<T>
  • Err — immutable error type with wrapping, aggregation, codes, and JSON serialization
  • test helpers — expectOk / expectErr, from the /test subpath
  • Outcome — deprecated and frozen since v0.7.0
  • Logger — structured, level-filtered logging
  • dtStamp — compact, sortable date/time stamps

Guides

Examples

Every example page is generated from an executable test file, so the code runs in the library’s own test suite.

Contributor documentation

These describe how the library itself is written; they are not needed to use the package.

For agents

Start with the core subset and safety rules .

llms.txt at the package root is the machine-readable index of this documentation set. It links only to files that ship in the package.