UNPKG

1.48 kBTypeScriptView Raw
1/**
2 * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.
3 * https://github.com/darkskyapp/binary-search
4 */
5export function binarySearch(haystack: any[], needle: any, opt_comparator?: () => void): number;
6export function equals(arr1: any[] | Uint8ClampedArray, arr2: any[] | Uint8ClampedArray): boolean;
7export function extend<VALUE>(arr: VALUE[], data: VALUE[] | VALUE): void;
8export function find<VALUE>(arr: VALUE[], func: (p0: VALUE, p1: number, p2: any) => boolean): VALUE | null;
9export function findIndex(arr: any[], func: () => void): number;
10/**
11 * Whether the array contains the given object.
12 */
13export function includes(arr: any[], obj: any): boolean;
14export function isSorted(arr: any[], opt_func?: () => void, opt_strict?: boolean): boolean;
15export function linearFindNearest(arr: number[], target: number, direction: number): number;
16/**
17 * Compare function for array sort that is safe for numbers.
18 */
19export function numberSafeCompareFunction(a: any, b: any): number;
20export function remove<VALUE>(arr: VALUE[], obj: VALUE): boolean;
21export function reverseSubArray(arr: any[], begin: number, end: number): void;
22/**
23 * Sort the passed array such that the relative order of equal elements is preverved.
24 * See https://en.wikipedia.org/wiki/Sorting_algorithm#Stability for details.
25 */
26export function stableSort(arr: any[], compareFnc: (p0: any, p1: any) => number): void;