Bump to v3.4.0.

This commit is contained in:
jdalton
2015-02-28 22:12:58 -08:00
parent 1e05116bcb
commit d01a1e4ef3
50 changed files with 477 additions and 317 deletions

View File

@@ -1,8 +1,4 @@
import arrayEvery from '../internal/arrayEvery';
import baseIsFunction from '../internal/baseIsFunction';
/** Used as the `TypeError` message for "Functions" methods. */
var FUNC_ERROR_TEXT = 'Expected a function';
import createComposer from '../internal/createComposer';
/**
* Creates a function that returns the result of invoking the provided
@@ -16,37 +12,14 @@ var FUNC_ERROR_TEXT = 'Expected a function';
* @returns {Function} Returns the new function.
* @example
*
* function add(x, y) {
* return x + y;
* }
*
* function square(n) {
* return n * n;
* }
*
* var addSquare = _.flow(add, square);
* var addSquare = _.flow(_.add, square);
* addSquare(1, 2);
* // => 9
*/
function flow() {
var funcs = arguments,
length = funcs.length;
if (!length) {
return function() { return arguments[0]; };
}
if (!arrayEvery(funcs, baseIsFunction)) {
throw new TypeError(FUNC_ERROR_TEXT);
}
return function() {
var index = 0,
result = funcs[index].apply(this, arguments);
while (++index < length) {
result = funcs[index].call(this, result);
}
return result;
};
}
var flow = createComposer();
export default flow;