mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 14:37:49 +00:00
This commit is contained in:
committed by
John-David Dalton
parent
012a929067
commit
512c8de526
13
lodash.js
13
lodash.js
@@ -4672,14 +4672,17 @@
|
||||
throw new TypeError;
|
||||
}
|
||||
}
|
||||
var funcsLength = funcs.length;
|
||||
if (funcsLength === 1) {
|
||||
return funcs[0];
|
||||
}
|
||||
return function() {
|
||||
var args = arguments,
|
||||
length = funcs.length;
|
||||
|
||||
var length = funcsLength - 1,
|
||||
result = funcs[length].apply(this, arguments);
|
||||
while (length--) {
|
||||
args = [funcs[length].apply(this, args)];
|
||||
result = funcs[length].call(this, result);
|
||||
}
|
||||
return args[0];
|
||||
return result;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1259,6 +1259,12 @@
|
||||
var welcome = _.compose(greet, format);
|
||||
equal(welcome('pebbles'), 'Hiya Penelope!');
|
||||
});
|
||||
|
||||
test('should return original function if only one function passed', 1, function(){
|
||||
var noop = function(){};
|
||||
equal(_.compose(noop), noop);
|
||||
});
|
||||
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user