Files: 079013977dd1a81caf9ed4717492ef3b9f722db0 / solutions / 05.js
308 bytesRaw
1 | |
2 | module.exports = function (n) { |
3 | return function (read) { |
4 | return function (abort, cb) { |
5 | //once we have read n items, abort the stream! |
6 | read(n-- ? abort : true, cb) |
7 | } |
8 | } |
9 | } |
10 | |
11 | //is your source stream compatible with abort? |
12 | |
13 | |
14 | if(!module.parent) |
15 | require('../helpers/take')(module.exports) |
16 |
Built with git-ssb-web