Static
inChecks if a value is within the specified numeric range.
The value to check.
The start of the range.
The end of the range.
True if the value is within the range, false otherwise.
const isInRange = Ranges.inRange(3, 1, 5);
console.log(isInRange); // Output: true
Static
rangeCreates an array representing a range of numbers from start
to end
(inclusive) with an optional step.
The start of the range.
The end of the range.
Optional
step: number = 1The step between elements. Defaults to 1.
An array representing the range of numbers.
const numericRange = Ranges.range(1, 5, 2);
console.log(numericRange); // Output: [1, 3, 5]
Static
rangeCreates an array representing a range of numbers from start
to end
(inclusive) with an optional step.
Alias for the range
method.
The start of the range.
The end of the range.
Optional
step: number = 1The step between elements. Defaults to 1.
An array representing the range of numbers.
const numericRange = Ranges.rangeTo(1, 5, 2);
console.log(numericRange); // Output: [1, 3, 5]
Static
rangeCreates an array representing a range of numbers from start
to (end - 1) with an optional step.
The start of the range.
The end of the range.
Optional
step: number = 1The step between elements. Defaults to 1.
An array representing the range of numbers.
const numericRange = Ranges.rangeUntil(1, 5, 2);
console.log(numericRange); // Output: [1, 3]
Generated using TypeDoc
The Range class provides utility methods for working with numeric ranges. It allows you to generate a range of numbers, check if a value is within a specified range, and create aliases for the range methods.
Example
Since
version 1.0.4
Author
Manuel Santos ney.br.santos@gmail.com