Skip to main content
Module

x/structurae/sorted-array.ts>SortedArray#range

Data structures for high-performance JavaScript applications.
Latest
method SortedArray.prototype.range
import { SortedArray } from "https://deno.land/x/structurae@4.0.1/sorted-array.ts";

Returns a range of elements of the array that are greater or equal to the provided starting element and less or equal to the provided ending element.

Examples

//=> SortedArray [ 2, 3, 4, 5, 9 ]; SortedArray.range(3, 5); // => [ 3, 4, 5 ] SortedArray.range(undefined, 4); // => [ 2, 3, 4 ] SortedArray.range(4); // => [ 4, 5, 8 ]

Parameters

optional
start: ItemType

the starting element

optional
end: ItemType

the ending element

Returns

SortedArray<ItemType>

the resulting range of elements