Submit
Path:
~
/
/
proc
/
self
/
root
/
usr
/
lib
/
node_modules
/
npm
/
node_modules
/
stream-each
/
File Content:
index.js
var eos = require('end-of-stream') var shift = require('stream-shift') module.exports = each function each (stream, fn, cb) { var want = true var error = null var ended = false var running = false var calling = false stream.on('readable', onreadable) onreadable() if (cb) eos(stream, {readable: true, writable: false}, done) return stream function done (err) { if (!error) error = err ended = true if (!running) cb(error) } function onreadable () { if (want) read() } function afterRead (err) { running = false if (err) { error = err if (ended) return cb(error) stream.destroy(err) return } if (ended) return cb(error) if (!calling) read() } function read () { while (!running && !ended) { want = false var data = shift(stream) if (data === null) { want = true return } running = true calling = true fn(data, afterRead) calling = false } } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
.npmignore
13 bytes
0644
.travis.yml
62 bytes
0644
LICENSE
1079 bytes
0644
README.md
1012 bytes
0644
collaborators.md
352 bytes
0644
index.js
1019 bytes
0644
package.json
1642 bytes
0644
test.js
2079 bytes
0644
N4ST4R_ID | Naxtarrr