Unwrap a Promise
of an AsyncIterableIterator
into a AsyncIterableIterator
.
npm install --save unwrap-async-iterable-iterator-promise
const unwrapAsyncIterableIteratorPromise = require('unwrap-async-iterable-iterator-promise')
function iterateOverItems () {
const iteratorPromise = getResource().then((resource) => {
return resource.iterateItems()
})
return unwrapAsyncIterableIteratorPromise(iteratorPromise)
}
unwrapAsyncIterableIteratorPromise<T> (input: Promise<AsyncIterableIterator<T>>): AsyncIterableIterator<T>
Returns an async iterator that will wait for input
to resolve, and the yield the items from the resolved iterator.