Skip to content

inRange

Import from @varavel/vdl-plugin-sdk/utils/math.

Utility functions re-exported from es-toolkit (MIT License). See https://github.com/toss/es-toolkit for more details.

Call Signature

function inRange(value, maximum): boolean;

Checks if the value is less than the maximum.

Parameters

Parameter Type Description
value number The value to check.
maximum number The upper bound of the range (exclusive).

Returns

boolean

true if the value is less than the maximum, otherwise false.

Example

const result = inRange(3, 5); // result will be true.
const result2 = inRange(5, 5); // result2 will be false.

Call Signature

function inRange(
   value, 
   minimum, 
   maximum): boolean;

Checks if the value is within the range defined by minimum (inclusive) and maximum (exclusive).

Parameters

Parameter Type Description
value number The value to check.
minimum number The lower bound of the range (inclusive).
maximum number The upper bound of the range (exclusive).

Returns

boolean

true if the value is within the specified range, otherwise false.

Example

const result = inRange(3, 2, 5); // result will be true.
const result2 = inRange(1, 2, 5); // result2 will be false.