📜  Loadsh _.overEvery() 方法

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

Loadsh _.overEvery() 方法

Lodash 是一个基于 underscore.js 的 JavaScript 库。 Lodash 有助于处理数组、字符串、对象、数字等。

_.overEvery()方法用于创建一个函数,该函数负责检查所有谓词在使用传递给它的参数调用时是否返回 true。

句法:

_.overEvery(predicates)

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

  • predicates 要调用的谓词

返回值:它返回一个新函数。

示例 1:

Javascript
// Requiring the lodash library  
const _ = require("lodash");            
      
// Function call
var myReturnedFunction = _.overEvery([Boolean, isFinite]);
   
// Printing the value returned from function call
console.log(myReturnedFunction('1'));


Javascript
// Requiring the lodash library  
const _ = require("lodash");            
      
// Function call
var myReturnedFunction = _.overEvery([Boolean, isFinite]);
   
// Printing the value returned from function call
console.log(myReturnedFunction(null));


Javascript
// Requiring the lodash library  
const _ = require("lodash");            
      
// Function call
var myReturnedFunction = _.overEvery([Boolean, isFinite]);
   
// Printing the value returned from function call
console.log(myReturnedFunction(Infinity));


输出:

true

示例 2:

Javascript

// Requiring the lodash library  
const _ = require("lodash");            
      
// Function call
var myReturnedFunction = _.overEvery([Boolean, isFinite]);
   
// Printing the value returned from function call
console.log(myReturnedFunction(null));

输出:

false

示例 3:

Javascript

// Requiring the lodash library  
const _ = require("lodash");            
      
// Function call
var myReturnedFunction = _.overEvery([Boolean, isFinite]);
   
// Printing the value returned from function call
console.log(myReturnedFunction(Infinity));

输出:

false

参考: https://lodash.com/docs/4.17.15#overEvery