Consecutive playback and per-conversation playback rate

This commit is contained in:
Alvaro 2022-09-15 14:10:46 -06:00 committed by GitHub
parent eb10aafd7c
commit 6cfe2a09df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 783 additions and 319 deletions

View file

@ -112,6 +112,16 @@ export function collect<T, S>(
return new CollectIterable(iterable, fn);
}
export function collectFirst<T, S>(
iterable: Iterable<T>,
fn: (value: T) => S | undefined
): S | undefined {
for (const v of collect(iterable, fn)) {
return v;
}
return undefined;
}
class CollectIterable<T, S> implements Iterable<S> {
constructor(
private readonly iterable: Iterable<T>,