git ssb

3+

cel / ssb-npm-registry



Tree: d2f2697f296dd39aed6a8b63c6d04a736a7db5b3

Files: d2f2697f296dd39aed6a8b63c6d04a736a7db5b3 / node_modules / pull-stream / throughs / filter.js

488 bytesRaw
1'use strict'
2
3var tester = require('../util/tester')
4
5module.exports = function filter (test) {
6 //regexp
7 test = tester(test)
8 return function (read) {
9 return function next (end, cb) {
10 var sync, loop = true
11 while(loop) {
12 loop = false
13 sync = true
14 read(end, function (end, data) {
15 if(!end && !test(data))
16 return sync ? loop = true : next(end, cb)
17 cb(end, data)
18 })
19 sync = false
20 }
21 }
22 }
23}
24
25

Built with git-ssb-web