git ssb

2+

Dominic / pull-stream



Commit aafb43a723f744ee19b4b8d5815b8fb95b9f4386

pass string to map

Dominic Tarr committed on 3/24/2013, 5:49:47 AM
Parent: c4caefd7c6cd6984ee0223c391cd4ce43118cf29

Files changed

throughs.jschanged
throughs.jsView
@@ -1,10 +1,12 @@
11 var k = 0
22 var map = exports.map =
33 function (read, map) {
44 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+ }
79 map = map || function (e) {return e}
810 return function (end, cb) {
911 read(end, function (end, data) {
1012 var data = !end ? map(data) : null
@@ -53,9 +55,8 @@
5355 cb(ended)
5456 }
5557 return read(null, function (end, data) {
5658 if(ended) return
57- console.log('take?', end, !test(data))
5859 if(end) return cb(ended = end)
5960 //TODO, CHECK THAT END LOGIC IS CORRECT WITH TAKE!!!
6061 if(!test(data)) {
6162 ended = true

Built with git-ssb-web