Commit aafb43a723f744ee19b4b8d5815b8fb95b9f4386
pass string to map
Dominic Tarr committed on 3/24/2013, 5:49:47 AMParent: c4caefd7c6cd6984ee0223c391cd4ce43118cf29
Files changed
throughs.js | changed |
throughs.js | ||
---|---|---|
@@ -1,10 +1,12 @@ | ||
1 | 1 | var k = 0 |
2 | 2 | var map = exports.map = |
3 | 3 | function (read, map) { |
4 | 4 | var _k = k++ |
5 | - if('string' == typeof map) | |
6 | - function (data) { return data[key] } | |
5 | + if('string' == typeof map) { | |
6 | + var key = map | |
7 | + map = function (data) { return data[key] } | |
8 | + } | |
7 | 9 | map = map || function (e) {return e} |
8 | 10 | return function (end, cb) { |
9 | 11 | read(end, function (end, data) { |
10 | 12 | var data = !end ? map(data) : null |
@@ -53,9 +55,8 @@ | ||
53 | 55 | cb(ended) |
54 | 56 | } |
55 | 57 | return read(null, function (end, data) { |
56 | 58 | if(ended) return |
57 | - console.log('take?', end, !test(data)) | |
58 | 59 | if(end) return cb(ended = end) |
59 | 60 | //TODO, CHECK THAT END LOGIC IS CORRECT WITH TAKE!!! |
60 | 61 | if(!test(data)) { |
61 | 62 | ended = true |
Built with git-ssb-web