Bump to v3.4.0.

This commit is contained in:
John-David Dalton
2015-12-16 17:48:03 -08:00
parent 7a82a3d77b
commit 4ce1d5ddd3
50 changed files with 879 additions and 584 deletions

View File

@@ -1,7 +1,4 @@
define(['../internal/arrayEvery', '../internal/baseIsFunction'], function(arrayEvery, baseIsFunction) {
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
define(['../internal/createComposer'], function(createComposer) {
/**
* This method is like `_.flow` except that it creates a function that
@@ -15,38 +12,15 @@ define(['../internal/arrayEvery', '../internal/baseIsFunction'], function(arrayE
* @returns {Function} Returns the new function.
* @example
*
* function add(x, y) {
* return x + y;
* }
*
* function square(n) {
* return n * n;
* }
*
* var addSquare = _.flowRight(square, add);
* var addSquare = _.flowRight(square, _.add);
* addSquare(1, 2);
* // => 9
*/
function flowRight() {
var funcs = arguments,
fromIndex = funcs.length - 1;
if (fromIndex < 0) {
return function() { return arguments[0]; };
}
if (!arrayEvery(funcs, baseIsFunction)) {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
var index = fromIndex,
result = funcs[index].apply(this, arguments);
while (index--) {
result = funcs[index].call(this, result);
}
return result;
};
}
var flowRight = createComposer(true);
return flowRight;
});