Permalink
Browse files

export pull() as default

  • Loading branch information...
1 parent ed03e36 commit bb1bdb89523248804aace29fa3128944c6b432c3 @dominictarr dominictarr committed Jun 9, 2013
Showing with 19 additions and 1 deletion.
  1. +19 −1 index.js
View
@@ -1,9 +1,27 @@
-
var sources = require('./sources')
var sinks = require('./sinks')
var throughs = require('./throughs')
var u = require('pull-core')
+function isThrough (fun) {
+ return fun.type === "Through" || fun.length === 1
+}
+
+var exports = module.exports = function pull () {
+ var args = [].slice.call(arguments)
+
+ if(isThrough(args[0]))
+ return function (read) {
+ args.unshift(read)
+ return pull.apply(null, args)
+ }
+
+ var read = args.shift()
+ while(args.length)
+ read = args.shift() (read)
+ return read
+}
+
for(var k in sources)
exports[k] = u.Source(sources[k])

0 comments on commit bb1bdb8

Please sign in to comment.