aboutsummaryrefslogtreecommitdiff
path: root/src/query.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-29 18:27:50 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-29 18:27:50 +0200
commit94d111a94533c0c31231642e8ffe4fbd4ce30096 (patch)
tree79c9f8ec3754699f8a135630f1ab6ee9be8019e6 /src/query.ts
parentb5c90d12219ca3a0df173ddf085d2353831a8ef6 (diff)
lint for unused variables, fix query bug detected by this
Diffstat (limited to 'src/query.ts')
-rw-r--r--src/query.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/query.ts b/src/query.ts
index 805abd361..24db4de56 100644
--- a/src/query.ts
+++ b/src/query.ts
@@ -49,6 +49,7 @@ export class Store<T> {
}
}
+
/**
* Definition of an index.
*/
@@ -61,6 +62,13 @@ export class Index<S extends IDBValidKey, T> {
constructor(s: Store<T>, public indexName: string, public keyPath: string | string[]) {
this.storeName = s.name;
}
+
+ /**
+ * We want to have the key type parameter in use somewhere,
+ * because otherwise the compiler complains. In iterIndex the
+ * key type is pretty useful.
+ */
+ protected _dummyKey: S|undefined;
}
/**
@@ -315,7 +323,6 @@ abstract class QueryStreamBase<T> implements QueryStream<T>, PromiseLike<void> {
type FilterFn = (e: any) => boolean;
type SubscribeFn = (done: boolean, value: any, tx: IDBTransaction) => void;
type SubscribeOneFn = (value: any, tx: IDBTransaction) => void;
-type FlatMapFn<T> = (v: T) => T[];
class QueryStreamFilter<T> extends QueryStreamBase<T> {
constructor(public s: QueryStreamBase<T>, public filterFn: FilterFn) {
@@ -349,7 +356,7 @@ class QueryStreamFlatMap<T, S> extends QueryStreamBase<S> {
}
const values = this.flatMapFn(value);
for (const v in values) {
- f(false, value, tx);
+ f(false, v, tx);
}
});
}