2.1.0 • Published 4 years ago
asynciterator-promiseproxy v2.1.0
Async Promise Proxy Iterator
An AsyncIterator proxy that allows its source to be set via a promise.
This is useful in cases when you need to pass an iterator, but only know its source at a later stage, or if you want to create this source lazilly.
Usage
const PromiseProxyIterator = require('asynciterator-promiseproxy').PromiseProxyIterator;
let it = new PromiseProxyIterator(() -> makeIterator());
it.on('data', console.log);
async function makeIterator() {
someExpensiveOperation();
return AsyncIterator.range(0, 10);
}
License
This software is written by Ruben Taelman.
This code is released under the MIT license.