diff options
author | Florian Dold <florian.dold@gmail.com> | 2019-11-20 20:02:48 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2019-11-20 20:02:48 +0100 |
commit | 035b3fdae2961bd0b1d48e8119a64f4d340cd696 (patch) | |
tree | a479f1939606a33c766adfc0ddc9089cd6cfcc44 /src/query.ts | |
parent | 7974a76228f6474a781524664a455efb3b6faf7b (diff) |
version upgrade and formatting
Diffstat (limited to 'src/query.ts')
-rw-r--r-- | src/query.ts | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/query.ts b/src/query.ts index 7d03cfea8..f510da55d 100644 --- a/src/query.ts +++ b/src/query.ts @@ -89,7 +89,10 @@ export function oneShotGetIndexed<S extends IDBValidKey, T>( key: any, ): Promise<T | undefined> { const tx = db.transaction([index.storeName], "readonly"); - const req = tx.objectStore(index.storeName).index(index.indexName).get(key); + const req = tx + .objectStore(index.storeName) + .index(index.indexName) + .get(key); return requestToPromise(req); } @@ -104,7 +107,10 @@ export function oneShotPut<T>( return requestToPromise(req); } -function applyMutation<T>(req: IDBRequest, f: (x: T) => T | undefined): Promise<void> { +function applyMutation<T>( + req: IDBRequest, + f: (x: T) => T | undefined, +): Promise<void> { return new Promise((resolve, reject) => { req.onsuccess = () => { const cursor = req.result; @@ -226,7 +232,7 @@ class ResultStream<T> { const x = await this.next(); if (x.hasValue) { if (f(x.value)) { - arr.push(x.value) + arr.push(x.value); } } else { break; @@ -261,7 +267,7 @@ class ResultStream<T> { export function oneShotIter<T>( db: IDBDatabase, - store: Store<T> + store: Store<T>, ): ResultStream<T> { const tx = db.transaction([store.name], "readonly"); const req = tx.objectStore(store.name).openCursor(); @@ -274,7 +280,10 @@ export function oneShotIterIndex<S extends IDBValidKey, T>( query?: any, ): ResultStream<T> { const tx = db.transaction([index.storeName], "readonly"); - const req = tx.objectStore(index.storeName).index(index.indexName).openCursor(query); + const req = tx + .objectStore(index.storeName) + .index(index.indexName) + .openCursor(query); return new ResultStream<T>(req); } @@ -298,7 +307,7 @@ class TransactionHandle { iter<T>(store: Store<T>, key?: any): ResultStream<T> { const req = this.tx.objectStore(store.name).openCursor(key); - return new ResultStream<T>(req); + return new ResultStream<T>(req); } delete<T>(store: Store<T>, key: any): Promise<void> { @@ -389,7 +398,6 @@ export class Index<S extends IDBValidKey, T> { protected _dummyKey: S | undefined; } - /** * Exception that should be thrown by client code to abort a transaction. */ |