Files: bb1bdb89523248804aace29fa3128944c6b432c3 / index.js
968 bytesRaw
1 | var sources = require('./sources') |
2 | var sinks = require('./sinks') |
3 | var throughs = require('./throughs') |
4 | var u = require('pull-core') |
5 | |
6 | function isThrough (fun) { |
7 | return fun.type === "Through" || fun.length === 1 |
8 | } |
9 | |
10 | var exports = module.exports = function pull () { |
11 | var args = [].slice.call(arguments) |
12 | |
13 | if(isThrough(args[0])) |
14 | return function (read) { |
15 | args.unshift(read) |
16 | return pull.apply(null, args) |
17 | } |
18 | |
19 | var read = args.shift() |
20 | while(args.length) |
21 | read = args.shift() (read) |
22 | return read |
23 | } |
24 | |
25 | for(var k in sources) |
26 | exports[k] = u.Source(sources[k]) |
27 | |
28 | for(var k in throughs) |
29 | exports[k] = u.Through(throughs[k]) |
30 | |
31 | for(var k in sinks) |
32 | exports[k] = u.Sink(sinks[k]) |
33 | |
34 | var maybe = require('./maybe')(exports) |
35 | |
36 | for(var k in maybe) |
37 | exports[k] = maybe[k] |
38 | |
39 | exports.Duplex = |
40 | exports.Through = exports.pipeable = u.Through |
41 | exports.Source = exports.pipeableSource = u.Source |
42 | exports.Sink = exports.pipeableSink = u.Sink |
43 | |
44 | |
45 |
Built with git-ssb-web