It Should Help

API Reference

The public surface of @artstesh/it-should (v2 line). Everything is exported from the package root; there is no default export.

Exports

Export

What it is

should

the entry function; returns the VerifierFactory singleton

VerifierFactory

creates verifiers: number, string, array, date, objects, true, false

AbstractVerifier

base class of all verifiers; provides not

GeneralVerifier

typed base; provides defined()

NumberVerifier, StringVerifier, DateVerifier, ArrayVerifier, ObjectsVerifier

the verifiers

Times

occurrence counters for string/array checks: once, twice, exactly, moreThan, lessThan

ArrayOrderedSettings

settings object for array().ordered()

DateAccuracy

type: 'year' \| 'month' \| 'day' \| 'hour' \| 'minute' | 'second' | 'millisecond'

ShouldError (the error type every failed check throws) is intentionally not re-exported — see Caveats. The method verifier that appears in the 1.2.x changelog is not yet public API.

Model

  • should(): VerifierFactory — the single entry point.

  • Each factory method wraps the examined value in the matching verifier.

  • Check methods return the verifier (chainable); a failed check throws ShouldError with a per-check message.

  • not inverts every following check; defined() and the implicit null/undefined guard behave as documented in Concepts.

Pages

Page

Covers

VerifierFactory

should(), factory methods, true/false

Number verifier

comparisons, ranges, proximity

String verifier

content, case, contains + Times, match

Date verifier

equals with accuracy, before/after, inRange

Array verifier

membership, counts, uniqueness, equality, ordered

Objects verifier

equal with rule/map/ignoring/compareOnly

02 сентября 2026