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.htm
廣告