VDL Plugin SDK

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

ParameterTypeDescription
valuenumberThe value to check.
maximumnumberThe 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

ParameterTypeDescription
valuenumberThe value to check.
minimumnumberThe lower bound of the range (inclusive).
maximumnumberThe 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.