git ssb

2+

Dominic / pull-stream



Commit 822a78b0de9a399dae39ef6b8c6142cc908a3ee1

make pull as compose way faster

Dominic Tarr committed on 3/23/2016, 12:02:14 AM
Parent: 3d39bb95880efe1bb2e347c6e2565ca156ce5996

Files changed

pull.jschanged
pull.jsView
@@ -1,22 +1,23 @@
11 module.exports = function pull (a) {
2+ var length = arguments.length
23 if (typeof a === 'function' && a.length === 1) {
3- var args = [].slice.call(arguments)
4+ var args = new Array(length)
5+ for(var i = 0; i < length; i++)
6+ args[i] = arguments[i]
47 return function (read) {
58 args.unshift(read)
69 return pull.apply(null, args)
710 }
811 }
912
1013 var read = a
11- var n = arguments.length
12- var i = 1
1314
1415 if (read && typeof read.source === 'function') {
1516 read = read.source
1617 }
1718
18- for (; i < n; i++) {
19+ for (var i = 1; i < length; i++) {
1920 var s = arguments[i]
2021 if (typeof s === 'function') {
2122 read = s(read)
2223 } else if (s && typeof s === 'object') {
@@ -27,4 +28,8 @@
2728
2829 return read
2930 }
3031
32+
33+
34+
35+

Built with git-ssb-web