Package Exports
- @stdlib/assert-is-nonconfigurable-property
- @stdlib/assert-is-nonconfigurable-property/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@stdlib/assert-is-nonconfigurable-property) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
isNonConfigurableProperty
Test if an object's own property is non-configurable.
Installation
npm install @stdlib/assert-is-nonconfigurable-propertyUsage
var isNonConfigurableProperty = require( '@stdlib/assert-is-nonconfigurable-property' );isNonConfigurableProperty( value, property )
Returns a boolean indicating if a value has a non-configurable property (i.e., a property which cannot be deleted and whose descriptor cannot be changed).
var defineProperty = require( '@stdlib/utils-define-property' );
var obj = {
'foo': 'bar'
};
defineProperty( obj, 'beep', {
'configurable': false,
'enumerable': true,
'writable': true,
'value': 'boop'
});
var bool = isNonConfigurableProperty( obj, 'beep' );
// returns true
bool = isNonConfigurableProperty( obj, 'foo' );
// returns falseNotes
Value arguments other than
nullorundefinedare coerced toobjects.var bool = isNonConfigurableProperty( 'beep', 'length' ); // returns true
Examples
var isNonConfigurableProperty = require( '@stdlib/assert-is-nonconfigurable-property' );
var bool = isNonConfigurableProperty( [ 'a' ], 'length' );
// returns true
bool = isNonConfigurableProperty( { 'a': 'b' }, 'a' );
// returns false
bool = isNonConfigurableProperty( [ 'a' ], 0 );
// returns false
bool = isNonConfigurableProperty( {}, 'toString' );
// returns false
bool = isNonConfigurableProperty( {}, 'hasOwnProperty' );
// returns false
bool = isNonConfigurableProperty( null, 'a' );
// returns false
bool = isNonConfigurableProperty( void 0, 'a' );
// returns false
bool = isNonConfigurableProperty( { 'null': false }, null );
// returns false
bool = isNonConfigurableProperty( { '[object Object]': false }, {} );
// returns falseNotice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2022. The Stdlib Authors.