Test whether all properties (own and inherited) of an object pass a test implemented by a predicate function.
var everyInBy = require( '@stdlib/object/every-in-by' );Tests whether all properties (own and inherited) of an object pass a test implemented by a predicate function.
var o;
var bool;
function isPositive( v ) {
return ( v > 0 );
}
o = {
'a': 1,
'b': 2,
'c': 3
};
bool = everyInBy( o, isPositive );
// returns trueIf provided an empty object, the function returns true.
function isPositive( v ) {
return ( v > 0 );
}
var bool = everyInBy( {}, isPositive );
// returns truevar randu = require( '@stdlib/random/base/randu' );
var everyInBy = require( '@stdlib/object/every-in-by' );
var bool;
var o;
var i;
function isPositive( v ) {
return ( v > 0 );
}
o = {};
for ( i = 0; i < 100; i++ ) {
o[ i ] = ( randu() < 0.95 );
}
bool = everyInBy( o, isPositive );
// returns <boolean>@stdlib/object/none-in-by: test whether every property in an object fails a test implemented by a predicate function.@stdlib/object/some-in-by: test whether an object contains at least n properties (own and inherited) which pass a test implemented by a predicate function.@stdlib/object/every-own-by: test whether all own properties of an object pass a test implemented by a predicate function.
84b30fb2c4455b9cdc27d8010487631a4568c0cf