Lodash - over 方法

语法

_.over([iteratees=[_.identity]])

创建一个函数,该函数使用收到的参数调用迭代器并返回其结果。

参数

  • [iteratees=[_.identity]] (...(Function|Function[])) − 要调用的迭代器。

输出

  • (Function) − 返回新函数。

示例

var _ = require('lodash');
var func = _.over([Math.max, Math.min]);
 
console.log(func(1, 2, 3, 4));

将上述程序保存在tester.js中。运行以下命令执行该程序。

命令

\>node tester.js

输出

[ 4, 1 ]

lodash_util.html