source: node_modules/es-toolkit/dist/compat/array/sortedIndex.d.ts

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * Uses a binary search to determine the lowest index at which `value`
3 * should be inserted into `array` in order to maintain its sort order.
4 *
5 * @category Array
6 * @param {ArrayLike<T> | null | undefined} array The sorted array to inspect.
7 * @param {T} value The value to evaluate.
8 * @returns {number} Returns the index at which `value` should be inserted
9 * into `array`.
10 * @example
11 * sortedIndex([30, 50], 40)
12 * // => 1
13 */
14declare function sortedIndex<T>(array: ArrayLike<T> | null | undefined, value: T): number;
15/**
16 * Uses a binary search to determine the lowest index at which `value`
17 * should be inserted into `array` in order to maintain its sort order.
18 *
19 * @category Array
20 * @param {ArrayLike<T> | null | undefined} array The sorted array to inspect.
21 * @param {T} value The value to evaluate.
22 * @returns {number} Returns the index at which `value` should be inserted
23 * into `array`.
24 * @example
25 * sortedIndex([30, 50], 40)
26 * // => 1
27 */
28declare function sortedIndex<T>(array: ArrayLike<T> | null | undefined, value: T): number;
29
30export { sortedIndex };
Note: See TracBrowser for help on using the repository browser.