Lodash _.overEvery() Method
Last Updated :
03 Nov, 2023
Lodash _.overEvery method is used to check if all the predicates return truth when invoked with the arguments the function receives.
Syntax:
_.overEvery(predicates);
Parameters:
- predicates: The predicates to invoke.
Returns:
This method is a new function.
Example 1: In this example, we are checking whether the given values of an array follow the given condition in a function or not.
Javascript
const _ = require( "lodash" );
let func = _.overEvery([(Math.min, Math.max)]);
let gfg = func(2, 4, -6, 8);
console.log(gfg);
|
Output:
true
Example 2: In this example, we are checking whether the given values of an array follow the given condition in a function or not.
Javascript
const _ = require( "lodash" );
let func = _.overEvery([Boolean, isFinite]);
let gfg1 = func(10);
let gfg2 = func(-5);
let gfg3 = func( null );
let gfg4 = func(NaN);
console.log(gfg1);
console.log(gfg2);
console.log(gfg3);
console.log(gfg4);
|
Output:
true
true
false
false
Share your thoughts in the comments
Please Login to comment...