Skip to content

LinusU/unwrap-async-iterable-iterator-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unwrap Async Iterable Iterator Promise

Unwrap a Promise of an AsyncIterableIterator into a AsyncIterableIterator.

Installation

npm install --save unwrap-async-iterable-iterator-promise

Usage

const unwrapAsyncIterableIteratorPromise = require('unwrap-async-iterable-iterator-promise')

function iterateOverItems () {
  const iteratorPromise = getResource().then((resource) => {
    return resource.iterateItems()
  })

  return unwrapAsyncIterableIteratorPromise(iteratorPromise)
}

API

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.

About

Unwrap a `Promise` of an `AsyncIterableIterator` into a `AsyncIterableIterator`

Resources

Stars

Watchers

Forks

Packages

No packages published