Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

noneOwnBy

Tests whether every own property of an object fails a test implemented by a predicate function.

Usage

var noneOwnBy = require( '@stdlib/object/none-own-by' );

noneOwnBy( object, predicate[, thisArg ] )

Tests whether every own property of an object fails a test implemented by a predicate function.

function isUnderage( age ) {
    return ( age < 18 );
}

var obj = {
    'a': 28,
    'b': 22,
    'c': 25
};

var bool = noneOwnBy( obj, isUnderage );
// returns true

If a predicate function returns a truthy value, the function immediately returns false.

function isUnderage( age ) {
    return ( age < 18 );
}

var obj = {
    'a': 12,
    'b': 22,
    'c': 25
};

var bool = noneOwnBy( obj, isUnderage );
// returns false

Notes

  • If the 1st argument is not an object or the second argument is not a function, the function throws a Type Error.

  • If provided an empty object, the function returns true.

    function truthy() {
        return true;
    }
    var bool = noneOwnBy( {}, truthy );
    // returns true

Examples

var noneOwnBy = require( '@stdlib/object/none-own-by' );

function isUnderage( age ) {
    return age < 18;
}

var obj = {
    'a': 26,
    'b': 20,
    'c': 25
};

var bool = noneOwnBy( obj, isUnderage );
// returns true

See Also

  • @stdlib/object/any-own-by: test whether whether any 'own' property of a provided object satisfies a predicate function.
  • @stdlib/object/every-own-by: test whether all own properties of an object pass a test implemented by a predicate function.
  • @stdlib/utils/none-by: test whether all elements in a collection fail a test implemented by a predicate function.
  • @stdlib/object/some-own-by: test whether some own properties of a provided object satisfy a predicate function for at least n properties.