Reuse length var in _.compose.

This commit is contained in:
John-David Dalton
2014-07-09 00:41:58 -07:00
parent 1b9dbd0e62
commit 30f256aad2

View File

@@ -5692,7 +5692,7 @@
function compose() {
var funcs = arguments,
length = funcs.length,
fromIndex = length - 1;
index = length - 1;
if (!length) {
return function() {};
@@ -5703,11 +5703,11 @@
}
}
return function() {
var index = fromIndex,
result = funcs[index].apply(this, arguments);
length = index;
var result = funcs[length].apply(this, arguments);
while (index--) {
result = funcs[index].call(this, result);
while (length--) {
result = funcs[length].call(this, result);
}
return result;
};