Fix flow and flowRight parameter handling (#4445)

* Enable flow and flowRight tests

* Remove flow and flowRight tests for default value and shortcut fusion

* Use native rest parameters / spread operator in flow and flowRight

* Fix syntax of flow and flowRight examples
This commit is contained in:
Luiz Américo
2019-08-28 20:06:45 -03:00
committed by John-David Dalton
parent e51a424513
commit 0e9d44eedb
4 changed files with 62 additions and 113 deletions

View File

@@ -10,15 +10,17 @@
* @see flowRight
* @example
*
* import add from 'lodash/add'
*
* function square(n) {
* return n * n
* }
*
* const addSquare = flow([add, square])
* const addSquare = flow(add, square)
* addSquare(1, 2)
* // => 9
*/
function flow(funcs) {
function flow(...funcs) {
const length = funcs ? funcs.length : 0
let index = length
while (index--) {