Lodash教程

Lodash flowRight method

语法

_.flowRight([funcs])
This method is like _.flow except that it creates a function that invokes the given functions from right to left.

参数

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

输出

(Function) − Returns the new composite function.

实例

var _ = require('lodash');
function square(n) {
   return n * n;
}
var addAndSquare = _.flowRight([square, _.add]);
var result = addAndSquare(3, 2);
console.log(result);
Save the above program in tester.js. Run the following command to execute this program.

Command

\>node tester.js

输出

25
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4