forked from mystiq/hydrogen-web
Try to reduce repitition in CursorIterator
This commit is contained in:
parent
a2ff02e6c0
commit
1707df71df
1 changed files with 1 additions and 3 deletions
|
@ -144,9 +144,7 @@ export function txnAsPromise(txn): Promise<void> {
|
|||
* Thus, when a value is available (an `IDBCursorWithValue` is given), we require a function `(T) => ...`, and when it is not, we require
|
||||
* a function `(undefined) => ...`.
|
||||
*/
|
||||
type CursorIterator<T, I extends IDBCursor> = I extends IDBCursorWithValue ?
|
||||
(value: T, key: IDBValidKey, cursor: IDBCursorWithValue) => { done: boolean, jumpTo?: IDBValidKey } :
|
||||
(value: undefined, key: IDBValidKey, cursor: IDBCursor) => { done: boolean, jumpTo?: IDBValidKey }
|
||||
type CursorIterator<T, I extends IDBCursor> = (value: I extends IDBCursorWithValue ? T : undefined, key: IDBValidKey, cursor: I) => { done: boolean, jumpTo?: IDBValidKey }
|
||||
|
||||
export function iterateCursor<T, I extends IDBCursor = IDBCursorWithValue>(cursorRequest: IDBRequest<I | null>, processValue: CursorIterator<T, I>): Promise<boolean> {
|
||||
// TODO: does cursor already have a value here??
|
||||
|
|
Loading…
Reference in a new issue