Cleanup _.compose.

This commit is contained in:
John-David Dalton
2014-01-28 22:14:10 -08:00
parent d969dcecbf
commit 63727b67ee

View File

@@ -4665,17 +4665,14 @@
*/ */
function compose() { function compose() {
var funcs = arguments, var funcs = arguments,
length = funcs.length; funcsLength = funcs.length,
length = funcsLength;
while (length--) { while (length--) {
if (!isFunction(funcs[length])) { if (!isFunction(funcs[length])) {
throw new TypeError; throw new TypeError;
} }
} }
var funcsLength = funcs.length;
if (funcsLength === 1) {
return funcs[0];
}
return function() { return function() {
var length = funcsLength - 1, var length = funcsLength - 1,
result = funcs[length].apply(this, arguments); result = funcs[length].apply(this, arguments);