Skip to content

API Reference

Complete reference for AssertCheck, generated from JSDoc in the source code.


Core exports

ExportDescription
assertThe main assertion namespace — all 50+ methods documented individually.
check()Chainable wrapper — check(arr).noNils().uniqueBy("id")

Assertion categories

CategoryMethods
Existencenil, notNil, empty, notEmpty
Typesstring, number, integer, finite, boolean, array, object, func, instanceOf
Equalityequal, deepEqual
Numericspositive, negative, zero, greater, greaterOrEqual, less, lessOrEqual, withinRange, inDelta
Arrayslen, longerThan, shorterThan, includes, all, any, none, one, count, containsAll, containsNone, elementsMatch, subset, unique, uniqueBy, increasing, nonDecreasing, sortedBy, first, last, sumBy, noNils, flat, allInstanceOf, zippedWith, groupedBy, partition
ObjectshasKey, hasKeys, hasExactKeys, hasOnlyKeys, hasValue, containsSubset, allValuesMatch, noNilValues, dig
Functionsreturns, pure, idempotent, arity, mapsDistinct, homomorphic
Negationnot

Classes

ClassDescription
CheckerBase class for chainable checkers
ArrayCheckerReturned by check() when the value is an array
ObjectCheckerReturned by check() when the value is an object
AssertionErrorError thrown on assertion failure — carries assertion, actual, expected, message

Formatting primitives

ExportDescription
buildBlock()Build a formatted error block string
fmtValue()Format any value for display
colorANSI colour helpers: color.added, color.removed, color.index
parseOpts()Normalise string | AssertOptions | undefined → structured options
fail()Output the formatted error and throw AssertionError
diffObjects()Generate diff rows between two objects

Types

TypeDescription
AssertOptionsOptions accepted by every assertion: msg, note, actual

This reference is generated from JSDoc in the source. To regenerate after editing, run bun run docs:api.

Released under the Apache 2.0 License. Built by Vagabond Studio — senior-only for growing companies.