-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Eugene Lazutkin edited this page Jun 27, 2026
·
2 revisions
tape-six-invariant is a zero-dependency library of assert-style invariant checks that materialize into real tape-six assertions when a tape-six run exercises the code, and are inert (or a configurable behavior) in production. It never imports tape-six — the two coordinate through the global slot Symbol.for('tape6.invariant.host.v1').
import check from 'tape-six-invariant';
export function transfer(from, to, amount) {
check(amount > 0, 'amount must be positive');
check(from.currency === to.currency, 'currencies must match');
}- Under a tape-six run, each
check()becomes a counted assertion on the current test. - In production, the default is inert; configure it with
setAbsentBehavior.
-
API — full reference:
check,hasHost,setAbsentBehavior, canned behaviors,InvariantError. -
Stripping checks in builds — remove
check()from release bundles with a builder.
See the README for installation and a quick start.