stream-iterate
Iterate through the values of a stream
Last updated 10 years ago by mafintosh .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm 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 (10 years ago)

6 Versions

  • 1.2.0                                ...           10 years ago
  • 1.1.1                                ...           12 years ago
  • 1.1.0                                ...           12 years ago
  • 1.0.2                                ...           12 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
Maintainers (2)
Downloads
Total 18
Today 0
This Week 0
This Month 13
Last Day 0
Last Week 0
Last Month 2
Dependencies (2)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE