📜  Lodash _.overEvery() 方法

📅  最后修改于: 2022-05-13 01:56:43.890000             🧑  作者: Mango

Lodash _.overEvery() 方法

Lodash _.overEvery方法用于检查所有谓词在使用函数接收的参数调用时是否返回真值。

句法:

_.overEvery(predicates)

参数:此方法接受一个如上所述和如下所述的参数:

  • 谓词:要调用的谓词。

返回:此方法的新函数。

示例 1:

Javascript
// Requiring the lodash library  
const _ = require("lodash");              
  
// Use of _.overEvery() method 
var func = _.overEvery([Math.min,  Math.max]);
  
// Saving the result
let gfg = func(2, 4, -6, 8);
  
// Printing the output  
console.log(gfg);


Javascript
// Requiring the lodash library  
const _ = require("lodash");              
  
// Use of _.overEvery() method 
var func = _.overEvery([Boolean, isFinite]);
  
// Saving the result
let gfg1 = func(10);
let gfg2 = func(-5);
let gfg3 = func(null);
let gfg4 = func(NaN);
       
// Printing the output  
console.log(gfg1); 
console.log(gfg2); 
console.log(gfg3); 
console.log(gfg4);


输出:

true

示例 2:

Javascript

// Requiring the lodash library  
const _ = require("lodash");              
  
// Use of _.overEvery() method 
var func = _.overEvery([Boolean, isFinite]);
  
// Saving the result
let gfg1 = func(10);
let gfg2 = func(-5);
let gfg3 = func(null);
let gfg4 = func(NaN);
       
// Printing the output  
console.log(gfg1); 
console.log(gfg2); 
console.log(gfg3); 
console.log(gfg4);

输出:

true
true
false
false