stream-iterate
Iterate through the values of a stream
Last updated 9 years ago by mafintosh .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install stream-iterate 
SYNC missed versions from official npm registry.

stream-iterate

Iterate through the values in a stream.

npm install stream-iterate

build status

Usage

var iterate = require('stream-iterate')
var from = require('from2')

var stream = from.obj(['a', 'b', 'c'])

var read = iterate(stream)

loop()

// recursively iterates through each item in the stream
function loop () {
  read(function (err, data, next) {
    console.log(err, data)
    next()
    loop()
  })
}

If you don't call next and call read again the same (err, value) pair will be returned.

You can use this module to implement stuff like a streaming merge sort.

License

MIT

Current Tags

  • 1.2.0                                ...           latest (9 years ago)

6 Versions

  • 1.2.0                                ...           9 years ago
  • 1.1.1                                ...           11 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.2                                ...           11 years ago
  • 1.0.1                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 0
Dependencies (2)
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |