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