git ssb

2+

Dominic / pull-stream



Tree: 00aa328fb3613d3e040d83b59f2b0cb70fb3640e

Files: 00aa328fb3613d3e040d83b59f2b0cb70fb3640e / pull.js

581 bytesRaw
1module.exports = function pull (a) {
2 if (typeof a === 'function' && a.length === 1) {
3 var args = [].slice.call(arguments)
4 return function (read) {
5 args.unshift(read)
6 return pull.apply(null, args)
7 }
8 }
9
10 var read = a
11 var n = arguments.length
12 var i = 1
13
14 if (read && typeof read.source === 'function') {
15 read = read.source
16 }
17
18 for (; i < n; i++) {
19 var s = arguments[i]
20 if (typeof s === 'function') {
21 read = s(read)
22 } else if (s && typeof s === 'object') {
23 s.sink(read)
24 read = s.source
25 }
26 }
27
28 return read
29}
30
31

Built with git-ssb-web