UNPKG

@kform/react

Version:

React integration for KForm.

13 lines (12 loc) 544 B
/** * Searches the provided array for the provided element using the binary search * algorithm. * * @param array Sorted array (in an order compatible with `compareFn`) in which * to find the provided element. * @param element Element to find in the array. * @param compareFn Comparison function. * @returns The index of the element if it is contained in the array; otherwise, * the inverted insertion point `-i - 1`. */ export declare function binarySearch<T>(array: T[], element: T, compareFn: (v1: T, v2: T) => number): number;