@tanstack/optimistic
Version:
Core optimistic updates library
38 lines (37 loc) • 1.69 kB
TypeScript
/**
* Helper function to determine if an object is a function call with an aggregate function
*/
export declare function isAggregateFunctionCall(obj: any): boolean;
/**
* Helper function to determine if an object is an ORDER_INDEX function call
*/
export declare function isOrderIndexFunctionCall(obj: any): boolean;
/**
* Type guard to check if a value is comparable (can be used with <, >, <=, >= operators)
* @param value The value to check
* @returns True if the value is comparable
*/
export declare function isComparable(value: unknown): value is number | string | Date | boolean;
/**
* Performs a comparison between two values, ensuring they are of compatible types
* @param left The left operand
* @param right The right operand
* @param operator The comparison operator
* @returns The result of the comparison
* @throws Error if the values are not comparable
*/
export declare function compareValues(left: unknown, right: unknown, operator: `<` | `<=` | `>` | `>=`): boolean;
/**
* Converts a SQL LIKE pattern to a JavaScript regex pattern
* @param pattern The SQL LIKE pattern to convert
* @returns A regex-compatible pattern string
*/
export declare function convertLikeToRegex(pattern: string): string;
/**
* Helper function to check if a value is in an array, with special handling for various types
* @param value The value to check for
* @param array The array to search in
* @param caseInsensitive Optional flag to enable case-insensitive matching for strings (default: false)
* @returns True if the value is found in the array
*/
export declare function isValueInArray(value: unknown, array: Array<unknown>, caseInsensitive?: boolean): boolean;