• Home
Name
Date
Size
#Lines
LOC

..--

node_modules/12-May-2024-3,2492,177

.npmignoreD12-May-202413 21

.travis.ymlD12-May-202460 65

LICENSED12-May-20241.1 KiB2217

README.mdD12-May-2024834 4026

index.jsD12-May-20241.3 KiB7157

package.jsonD12-May-20241.5 KiB5756

test.jsD12-May-20241.2 KiB6149

README.md

1 # stream-iterate
2 
3 Iterate through the values in a stream.
4 
5 ```
6 npm install stream-iterate
7 ```
8 
9 [![build status](http://img.shields.io/travis/mafintosh/stream-iterate.svg?style=flat)](http://travis-ci.org/mafintosh/stream-iterate)
10 
11 ## Usage
12 
13 ``` js
14 var iterate = require('stream-iterate')
15 var from = require('from2')
16 
17 var stream = from.obj(['a', 'b', 'c'])
18 
19 var read = iterate(stream)
20 
21 loop()
22 
23 // recursively iterates through each item in the stream
24 function loop () {
25   read(function (err, data, next) {
26     console.log(err, data)
27     next()
28     loop()
29   })
30 }
31 ```
32 
33 If you don't call `next` and call `read` again the same `(err, value)` pair will be returned.
34 
35 You can use this module to implement stuff like [a streaming merge sort](https://github.com/mafintosh/stream-iterate/blob/master/test.js#L5-L47).
36 
37 ## License
38 
39 [MIT](LICENSE)
40