UNPKG

475 BJavaScriptView Raw
1import { AsyncIterableX } from './asynciterablex';
2export class TimestampAsyncIterable extends AsyncIterableX {
3 constructor(source) {
4 super();
5 this._source = source;
6 }
7 async *[Symbol.asyncIterator]() {
8 for await (const item of this._source) {
9 yield { time: Date.now(), value: item };
10 }
11 }
12}
13export function timestamp(source) {
14 return new TimestampAsyncIterable(source);
15}
16
17//# sourceMappingURL=timestamp.mjs.map