It Should Help

Number Verifier Reference

Created by should().number(entry: number | null | undefined). All checks are chainable and throw ShouldError on failure; every check first asserts the entry is defined (see Concepts).

Methods

Method

Passes when

Failure message (direct)

equals(expected: number)

strictly equal

`${real} doesn't equal ${expected}.`

greater(then: number)

entry > then (exclusive)

`${real} is not greater then ${then}.`

greaterOrEqual(then: number)

entry >= then

less(then: number)

entry < then (exclusive)

`${real} is not less then ${then}.`

lessOrEqual(then: number)

entry <= then

positive()

entry > 0

`${real} is not positive.`

negative()

entry < 0

`${real} is not negative.`

inRange(min: number, max: number)

min < entry < max (both exclusive)

`${real} isn't in range [${min},${max}].`

approximately(expected: number, precision: number)

\|entry − expected\| < precision (strict)

Plus the inherited not and defined().

Notes

  • Negated checks mirror the messages: ${real} is positive, but should not., etc.

  • approximately is the float-safe alternative to equals.

  • inRange bounds are exclusive on both sides — for inclusive edges chain greaterOrEqual(min).lessOrEqual(max).

Guide: Numbers.

02 сентября 2026