mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 08:37: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
6
flow.js
6
flow.js
@@ -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--) {
|
||||
|
||||
Reference in New Issue
Block a user