@tanstack/db
Version:
A reactive client store for building super fast apps on sync
25 lines (24 loc) • 1.36 kB
text/typescript
/**
* Finds the correct insert position for a value in a sorted array using binary search
* @param sortedArray The sorted array to search in
* @param value The value to find the position for
* @param compareFn Comparison function to use for ordering
* @returns The index where the value should be inserted to maintain order
*/
export declare function findInsertPositionInArray<T>(sortedArray: Array<T>, value: T, compareFn: (a: T, b: T) => number): number;
/**
* Finds the correct insert position for a value in a sorted tuple array using binary search
* @param sortedArray The sorted tuple array to search in
* @param value The value to find the position for
* @param compareFn Comparison function to use for ordering
* @returns The index where the value should be inserted to maintain order
*/
export declare function findInsertPosition<T>(sortedArray: Array<[T, any]>, value: T, compareFn: (a: T, b: T) => number): number;
/**
* Deletes a value from a sorted array while maintaining sort order
* @param sortedArray The sorted array to delete from
* @param value The value to delete
* @param compareFn Comparison function to use for ordering
* @returns True if the value was found and deleted, false otherwise
*/
export declare function deleteInSortedArray<T>(sortedArray: Array<T>, value: T, compareFn: (a: T, b: T) => number): boolean;