Lodash _.overEvery() Method
Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc.
The _.overEvery() method is used to create a function that is responsible for checking if all the predicates return true when invoked with the arguments which are passed to it.
Syntax:
_.overEvery(predicates)
Parameters: This method accepts one parameter as mentioned above and described below:
- predicates: The predicates to invoke.
Return Value: It returns a new function.
Example 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' )); |
Output:
true
Example 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 )); |
Output:
false
Example 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)); |
Output:
false
Reference: https://lodash.com/docs/4.17.15#overEvery
Please Login to comment...