Sheet
A sheet is a keyed business structure — row key -> ordered values — stored as
a plain object: Record<string, readonly T[]>.
API Reference
@teakit/sheet is not a spreadsheet-formula engine or a linear-algebra
library. It models keyed two-dimensional business data (forecasts, budgets,
occupancy, KPIs, asset models) — no cell formulas, and no linear-algebra
operations (multiplication, inverse, determinant, eigenvalues).
Core types
Invariants
- Key order: integer-index keys sort numerically first, then other string
keys lexicographically. Fixed-width period keys (
YYYY,YYYY-MM) therefore sort in time order. All returning APIs emit keys ascending;map,reduce, andentriestraverse in that same order. - No-data vs missing: aggregation and
rollupskip both"-"andundefined;merge,zip,normalize, andtransposepass"-"through verbatim and never invent it. - Immutability: every operation returns a new object; inputs are not mutated. Row arrays are copied; cell values are not deep-copied.
Agent Contract
Agent Notes
- Import with
import { Sheet } from "@teakit/sheet"; no default import. - Do not call
Sheet(...)ornew Sheet(...); it is a namespace of static functions, not a class. - Keep sheets as plain objects and arrays; do not wrap them in classes.
- See period-shapes for the fixed period shapes and errors for the error model.