Skip to content

flowRight

js
_.flowRight([funcs])

此方法与 _.flow 类似,不同之处在于它创建一个从右到左调用给定函数的函数。

¥This method is like _.flow except that it creates a function that invokes the given functions from right to left.

新增于

¥Since

3.0.0

参数

¥Arguments

  1. [funcs] (...(函数|函数[])):受保护的方法是:

    ¥[funcs] (...(Function|Function[])): The functions to invoke.

返回

¥Returns

(函数):返回新的复合函数。

¥(Function): Returns the new composite function.

示例

¥Example

js
function square(n) {
  return n * n;
}

var addSquare = _.flowRight([square, _.add]);
addSquare(1, 2);
// => 9

Lodash v4.17 中文网 - 粤ICP备13048890号