isNonEnumerableProperty
Test if an object's own property is non-enumerable.
Usage
var isNonEnumerableProperty = require( '@stdlib/assert/is-nonenumerable-property' );
isNonEnumerableProperty( value, property )
Returns a boolean
indicating if a value
has a non-enumerable property
.
var defineProperty = require( '@stdlib/utils/define-property' );
var obj = {
'foo': 'bar'
};
defineProperty( obj, 'beep', {
'configurable': false,
'enumerable': false,
'writable': true,
'value': 'boop'
});
var bool = isNonEnumerableProperty( obj, 'beep' );
// returns true
bool = isNonEnumerableProperty( obj, 'foo' );
// returns false
Notes
Value arguments other than
null
orundefined
are coerced toobjects
.var bool = isNonEnumerableProperty( 'beep', 'length' ); // returns true
Examples
var isNonEnumerableProperty = require( '@stdlib/assert/is-nonenumerable-property' );
var bool = isNonEnumerableProperty( [ 'a' ], 'length' );
// returns true
bool = isNonEnumerableProperty( { 'a': 'b' }, 'a' );
// returns false
bool = isNonEnumerableProperty( [ 'a' ], 0 );
// returns false
bool = isNonEnumerableProperty( {}, 'toString' );
// returns false
bool = isNonEnumerableProperty( {}, 'hasOwnProperty' );
// returns false
bool = isNonEnumerableProperty( null, 'a' );
// returns false
bool = isNonEnumerableProperty( void 0, 'a' );
// returns false
bool = isNonEnumerableProperty( { 'null': false }, null );
// returns false
bool = isNonEnumerableProperty( { '[object Object]': false }, {} );
// returns false