Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including async-iterator with all npm packages installed. Try it out:

var asyncIterator = require("async-iterator")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

async-iterator v1.1.0

A Standard API for LevelDOWN style Iterator.

async-iterator

A Standard API for LevelDOWN style Iterator.

Stability

Unstable: Expect patches and features, possible api changes.

Example

var Iterator = require('async-iterator')

var it = Iterator(function get (i, cb) {
  //retrive the Ith item.
}, function end (cb) {
  //drop everthing! iterator is no longer needed!
})

API

Iterator#next(cb)

Get the next item.

Will error if:

  • you are already retriving an item, but the callback has not yet been called.
  • the Iterator has ended.

Iterator#end(cb)

Dispose of the Iterator. If you have called Iterator#next but it has not called back yet, then the end call will be queued until it has.

License

MIT

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free