From 0d9b03ced2209cc186049a0eac053333284e297a Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sat, 24 Oct 2015 08:05:27 -0700 Subject: [PATCH] Move `juxt`, `flow`, and `flowRight` to the `Utility` category mapping. --- lodash.js | 123 +++++++++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/lodash.js b/lodash.js index b7a34aeef..650ecbee0 100644 --- a/lodash.js +++ b/lodash.js @@ -8147,67 +8147,6 @@ return createWrapper(func, FLIP_FLAG); } - /** - * Creates a function that returns the result of invoking the provided - * functions with the `this` binding of the created function, where each - * successive invocation is supplied the return value of the previous. - * - * @static - * @memberOf _ - * @category Function - * @param {...Function} [funcs] Functions to invoke. - * @returns {Function} Returns the new function. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var addSquare = _.flow(_.add, square); - * addSquare(1, 2); - * // => 9 - */ - var flow = createFlow(); - - /** - * This method is like `_.flow` except that it creates a function that - * invokes the provided functions from right to left. - * - * @static - * @memberOf _ - * @category Function - * @param {...Function} [funcs] Functions to invoke. - * @returns {Function} Returns the new function. - * @example - * - * function square(n) { - * return n * n; - * } - * - * var addSquare = _.flowRight(square, _.add); - * addSquare(1, 2); - * // => 9 - */ - var flowRight = createFlow(true); - - /** - * Creates a function that invokes `iteratees` with the arguments provided - * to the created function and returns their results. - * - * @static - * @memberOf _ - * @category Function - * @param {Function[]} iteratees The iteratees to invoke. - * @returns {Function} Returns the new function. - * @example - * - * var juxted = _.juxt(Math.max, Math.min); - * - * juxted(1, 2, 3, 4); - * // => [4, 1] - */ - var juxt = createInvoker(arrayMap); - /** * Creates a function that memoizes the result of `func`. If `resolver` is * provided it determines the cache key for storing the result based on the @@ -12225,6 +12164,50 @@ */ var disj = createInvoker(arraySome); + + /** + * Creates a function that returns the result of invoking the provided + * functions with the `this` binding of the created function, where each + * successive invocation is supplied the return value of the previous. + * + * @static + * @memberOf _ + * @category Utility + * @param {...(Function|Function[])} [funcs] Functions to invoke. + * @returns {Function} Returns the new function. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flow(_.add, square); + * addSquare(1, 2); + * // => 9 + */ + var flow = createFlow(); + + /** + * This method is like `_.flow` except that it creates a function that + * invokes the provided functions from right to left. + * + * @static + * @memberOf _ + * @category Utility + * @param {...(Function|Function[])} [funcs] Functions to invoke. + * @returns {Function} Returns the new function. + * @example + * + * function square(n) { + * return n * n; + * } + * + * var addSquare = _.flowRight(square, _.add); + * addSquare(1, 2); + * // => 9 + */ + var flowRight = createFlow(true); + /** * This method returns the first argument provided to it. * @@ -12284,6 +12267,24 @@ : baseIteratee(func); } + /** + * Creates a function that invokes `iteratees` with the arguments provided + * to the created function and returns their results. + * + * @static + * @memberOf _ + * @category Utility + * @param {...(Function|Function[])} iteratees The iteratees to invoke. + * @returns {Function} Returns the new function. + * @example + * + * var juxted = _.juxt(Math.max, Math.min); + * + * juxted(1, 2, 3, 4); + * // => [4, 1] + */ + var juxt = createInvoker(arrayMap); + /** * Creates a function that performs a deep partial comparison between a given * object and `source`, returning `true` if the given object has equivalent