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

@@ -11,16 +11,18 @@ import flow from './flow.js'
* @see flow
* @example
*
* import add from 'lodash/add'
*
* function square(n) {
* return n * n
* }
*
* const addSquare = flowRight([square, add])
* const addSquare = flowRight(square, add)
* addSquare(1, 2)
* // => 9
*/
function flowRight(funcs) {
return flow(funcs.reverse())
function flowRight(...funcs) {
return flow(...funcs.reverse())
}
export default flowRight