Commit b390ecc4bf4d610b201252d8a8a0cd1ad8cd2748
Use pull.through
Charles Lehner committed on 2/17/2016, 3:03:54 AMParent: 079bb118621d4c2fe7fcdefdceeb7bbe93930f13
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -131,22 +131,8 @@ | ||
131 | 131 | } |
132 | 132 | ]) |
133 | 133 | } |
134 | 134 | |
135 | -// run a callback when a pipeline ends | |
136 | -// TODO: find a better way to do this | |
137 | -function onThroughEnd(onEnd) { | |
138 | - return function (read) { | |
139 | - return function (end, cb) { | |
140 | - read(end, function (end, data) { | |
141 | - cb(end, data) | |
142 | - if (end) | |
143 | - onEnd(end === true ? null : end) | |
144 | - }) | |
145 | - } | |
146 | - } | |
147 | -} | |
148 | - | |
149 | 135 | /* |
150 | 136 | TODO: investigate capabilities |
151 | 137 | report-status delete-refs side-band-64k quiet atomic ofs-delta |
152 | 138 | */ |
@@ -195,9 +181,9 @@ | ||
195 | 181 | // receive their refs |
196 | 182 | var lines = pktLine.decode(read, options) |
197 | 183 | pull( |
198 | 184 | lines.updates, |
199 | - onThroughEnd(updatesDone), | |
185 | + pull.through(null, updatesDone), | |
200 | 186 | updateSink |
201 | 187 | ) |
202 | 188 | function updatesDone(err) { |
203 | 189 | if (err) return cb(err) |
Built with git-ssb-web