Home > @jsplumbtoolkit/browser-ui > insertSorted
insertSorted() function
Inserts the given value into the given array at a sorted location.
Signature:
export declare function insertSorted<T>(value: T, array: Array<T>, comparator: (v1: T, v2: T) => number, sortDescending?: boolean): void;
Parameters
Parameter | Type | Description |
---|---|---|
value | T | Value to insert |
array | Array<T> | Array to insert into |
comparator | (v1: T, v2: T) => number | Function to use when determining sort order. |
sortDescending | boolean | Defaults to false; if true, the insertion is sorted in reverse order. |
Returns:
void