git ssb

2+

Dominic / pull-stream



Commit cd76eff3ebf93df1912d899b6453a4b837d2eebb

filter loops if read function is sync

Dominic Tarr committed on 7/20/2014, 6:08:23 PM
Parent: 047277298060a158af99ed2a8f3162d93553ea61

Files changed

throughs.jschanged
throughs.jsView
@@ -86,13 +86,19 @@
8686 function (read, test) {
8787 //regexp
8888 test = tester(test)
8989 return function next (end, cb) {
90- read(end, function (end, data) {
91- if(!end && !test(data))
92- return next(end, cb)
93- cb(end, data)
94- })
90+ var sync, loop = true
91+ while(loop) {
92+ loop = false
93+ sync = true
94+ read(end, function (end, data) {
95+ if(!end && !test(data))
96+ return sync ? loop = true : next(end, cb)
97+ cb(end, data)
98+ })
99+ sync = false
100+ }
95101 }
96102 }
97103
98104 var filterNot = exports.filterNot =

Built with git-ssb-web