/** * Performs binary search on a sorted array. * * @typeParam T The type of items in the array. * @typeParam U The type of the item. * @param input An array in sorted order (compatible with the order induced by `comparator`). * @param item * An item to search for. * This does not necessarily have to be an instance of `T`, but it must be supported by the comparator function. * @param comparator A comparison function. * @returns * The index of the item in `input`, if the item was found. * Otherwise, a negative index is returned indicating where the item can be *inserted* to * maintain the current order: `returnValue == -insertion point - 1`. * The actual (positive) insertion index can be obtained by calculating `-(returnValue + 1)`. */ declare function binarySearch(input: T[], item: U, comparator: (a: T, b: U) => number): number; export { binarySearch, binarySearch as default };