git ssb

2+

Dominic / pull-stream



Tree: bb1bdb89523248804aace29fa3128944c6b432c3

Files: bb1bdb89523248804aace29fa3128944c6b432c3 / index.js

968 bytesRaw
1var sources = require('./sources')
2var sinks = require('./sinks')
3var throughs = require('./throughs')
4var u = require('pull-core')
5
6function isThrough (fun) {
7 return fun.type === "Through" || fun.length === 1
8}
9
10var 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
25for(var k in sources)
26 exports[k] = u.Source(sources[k])
27
28for(var k in throughs)
29 exports[k] = u.Through(throughs[k])
30
31for(var k in sinks)
32 exports[k] = u.Sink(sinks[k])
33
34var maybe = require('./maybe')(exports)
35
36for(var k in maybe)
37 exports[k] = maybe[k]
38
39exports.Duplex =
40exports.Through = exports.pipeable = u.Through
41exports.Source = exports.pipeableSource = u.Source
42exports.Sink = exports.pipeableSink = u.Sink
43
44
45

Built with git-ssb-web