UNPKG

@extra-array/bsearch-closest

Version:

Binary searches closest value in sorted array.

12 lines 447 B
import type { compareFn, mapFn } from './_types'; /** * Binary searches closest value in sorted array. * @param x an array (sorted) * @param v search value * @param fc compare function (a, b) * @param fm map function (v, i, x) * @returns index of closest value */ declare function bsearchClosest<T, U = T>(x: T[], v: T, fc?: compareFn<T | U>, fm?: mapFn<T, T | U>): number; export default bsearchClosest; //# sourceMappingURL=index.d.ts.map