Skip to content

assertcheck v1.0.0


assertcheck / assert / withinRange

Function: withinRange()

ts
function withinRange(
   v, 
   min, 
   max, 
   opts?): void;

Defined in: src/assert.ts:695

Asserts that v is within the closed range [min, max].

Parameters

ParameterTypeDescription
vnumberThe value to check.
minnumberInclusive lower bound.
maxnumberInclusive upper bound.
opts?OptsOptional message / context.

Returns

void

Example

ts
assert.withinRange(percentage, 0, 100, "percentage must be 0–100")

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