| 1 |
/** |
| 2 |
* Binary search |
| 3 |
* @param table - the table search. must be sorted! |
| 4 |
* @param value - value to find |
| 5 |
* @param cmp |
| 6 |
* @private |
| 7 |
*/ |
| 8 |
export declare function _lookup(table: number[], value: number, cmp?: (value: number) => boolean): { |
| 9 |
lo: number; |
| 10 |
hi: number; |
| 11 |
}; |
| 12 |
export declare function _lookup<T>(table: T[], value: number, cmp: (value: number) => boolean): { |
| 13 |
lo: number; |
| 14 |
hi: number; |
| 15 |
}; |
| 16 |
/** |
| 17 |
* Binary search |
| 18 |
* @param table - the table search. must be sorted! |
| 19 |
* @param key - property name for the value in each entry |
| 20 |
* @param value - value to find |
| 21 |
* @param last - lookup last index |
| 22 |
* @private |
| 23 |
*/ |
| 24 |
export declare const _lookupByKey: (table: Record<string, number>[], key: string, value: number, last?: boolean) => { |
| 25 |
lo: number; |
| 26 |
hi: number; |
| 27 |
}; |
| 28 |
/** |
| 29 |
* Reverse binary search |
| 30 |
* @param table - the table search. must be sorted! |
| 31 |
* @param key - property name for the value in each entry |
| 32 |
* @param value - value to find |
| 33 |
* @private |
| 34 |
*/ |
| 35 |
export declare const _rlookupByKey: (table: Record<string, number>[], key: string, value: number) => { |
| 36 |
lo: number; |
| 37 |
hi: number; |
| 38 |
}; |
| 39 |
/** |
| 40 |
* Return subset of `values` between `min` and `max` inclusive. |
| 41 |
* Values are assumed to be in sorted order. |
| 42 |
* @param values - sorted array of values |
| 43 |
* @param min - min value |
| 44 |
* @param max - max value |
| 45 |
*/ |
| 46 |
export declare function _filterBetween(values: number[], min: number, max: number): number[]; |
| 47 |
export interface ArrayListener<T> { |
| 48 |
_onDataPush?(...item: T[]): void; |
| 49 |
_onDataPop?(): void; |
| 50 |
_onDataShift?(): void; |
| 51 |
_onDataSplice?(index: number, deleteCount: number, ...items: T[]): void; |
| 52 |
_onDataUnshift?(...item: T[]): void; |
| 53 |
} |
| 54 |
/** |
| 55 |
* Hooks the array methods that add or remove values ('push', pop', 'shift', 'splice', |
| 56 |
* 'unshift') and notify the listener AFTER the array has been altered. Listeners are |
| 57 |
* called on the '_onData*' callbacks (e.g. _onDataPush, etc.) with same arguments. |
| 58 |
*/ |
| 59 |
export declare function listenArrayEvents<T>(array: T[], listener: ArrayListener<T>): void; |
| 60 |
/** |
| 61 |
* Removes the given array event listener and cleanup extra attached properties (such as |
| 62 |
* the _chartjs stub and overridden methods) if array doesn't have any more listeners. |
| 63 |
*/ |
| 64 |
export declare function unlistenArrayEvents<T>(array: T[], listener: ArrayListener<T>): void; |
| 65 |
/** |
| 66 |
* @param items |
| 67 |
*/ |
| 68 |
export declare function _arrayUnique<T>(items: T[]): T[]; |