VerifierFactory Reference
should() returns the VerifierFactory singleton — the only entry point of the library.
import { should } from '@artstesh/it-should';
should().number(5).positive();
Factory methods
Method | Examined value | Returns |
|---|
array<T>(entry: (T \| null \| undefined)[] \| null \| undefined)
| an array | ArrayVerifier<T>
|
number(entry: number \| null \| undefined)
| a number | NumberVerifier
|
string(entry: string \| null \| undefined)
| a string | StringVerifier
|
date(entry: Date \| string \| null \| undefined)
| a date or ISO string | DateVerifier
|
objects<T extends {}, P extends {}>(entry: T, other: P)
| two objects | ObjectsVerifier<T, P>
|
method<R>(entry: ((...params: any[]) => R) \| null \| undefined)
| a function | MethodVerifier<R>
|
Method | Passes when | Failure message |
|---|
true(entry: any): void
| entry is truthy — not false, 0, '', null, undefined, NaN | The entry expected to be true.
|
false(entry: any): void
| entry is falsy | The entry expected to be false.
|
undefined(entry: any): void
| entry is strictly undefined — null does not pass | The entry expected to be undefined.
|
null(entry: any): void
| entry is strictly null — undefined does not pass | The entry expected to be null.
|
All are terminal: they return void and have no not form. See General Assertions.
Shared verifier members
Every verifier returned above inherits:
Member | Behavior |
|---|
not (property)
| inverts every following check in the chain |
defined()
| passes when the entry is not null/undefined; otherwise throws The entry is not defined. |
The rules for null/undefined entries under not are documented in Concepts.
16 September 2026