Files: ba7f368b81bcbddeae02d80184c379d5c849a24b / pull.js
650 bytesRaw
1 | module.exports = function pull (a) { |
2 | var length = arguments.length |
3 | if (typeof a === 'function' && a.length === 1) { |
4 | var args = new Array(length) |
5 | for(var i = 0; i < length; i++) |
6 | args[i] = arguments[i] |
7 | return function (read) { |
8 | args.unshift(read) |
9 | return pull.apply(null, args) |
10 | } |
11 | } |
12 | |
13 | var read = a |
14 | |
15 | if (read && typeof read.source === 'function') { |
16 | read = read.source |
17 | } |
18 | |
19 | for (var i = 1; i < length; i++) { |
20 | var s = arguments[i] |
21 | if (typeof s === 'function') { |
22 | read = s(read) |
23 | } else if (s && typeof s === 'object') { |
24 | s.sink(read) |
25 | read = s.source |
26 | } |
27 | } |
28 | |
29 | return read |
30 | } |
31 | |
32 | |
33 | |
34 | |
35 | |
36 |
Built with git-ssb-web