mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
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:
committed by
John-David Dalton
parent
e51a424513
commit
0e9d44eedb
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user