jWidget utilities for native JavaScript arrays.
import * as ArrayUtils from "jwidget/ArrayUtils";
<T>(arr: T[], items: Iterable<T>, index?: number)
Adds a range of new items to an array.
<T>(arr: readonly T[], callback: (item: T, index: number) => void)
Iterates through array items in backward order.
<T>(arr: readonly T[], isHigher: (value: T) => boolean): number
Determines index of the first item the isHigher callback returns true for. If such an item does not exist, returns the array length. The input array must be ordered in such a way that all values such that !isHigher(value) go before isHigher(value).
(arr: readonly number[]): number[]
Builds a new array by the rule: result[arr[i]] === i
and returns it.
(arr: readonly number[]): boolean
arr[i] === i
.<T>(arrays: readonly (readonly T[])[]): T[]
Builds a new array consisting of subarray items in the same order.
<T>(arr: T[], fromIndex: number, toIndex: number): T
Moves an item in an array.
<T>(arr: T[], indexArray: readonly number[]): T[]
i
will be moved to index indexArray[i]
.
Must contain all indexes from 0 to (length - 1).
Reorders array items.
<T>(arr: T[],
segmentsToRemove: Iterable<IBindableArray.IndexCount>,
segmentsToAdd: Iterable<IBindableArray.IndexItems<T>>): IBindableArray.SpliceResult<T>
Removes and inserts item ranges.