diff options
Diffstat (limited to 'src/util/query.ts')
-rw-r--r-- | src/util/query.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/util/query.ts b/src/util/query.ts index 08a8fec02..217c0674e 100644 --- a/src/util/query.ts +++ b/src/util/query.ts @@ -176,6 +176,17 @@ class ResultStream<T> { return arr; } + async forEachAsync(f: (x: T) => Promise<void>): Promise<void> { + while (true) { + const x = await this.next(); + if (x.hasValue) { + await f(x.value); + } else { + break; + } + } + } + async forEach(f: (x: T) => void): Promise<void> { while (true) { const x = await this.next(); |