README.md (2560B)
1 <!-- 2 3 @license Apache-2.0 4 5 Copyright (c) 2018 The Stdlib Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 19 --> 20 21 # isNonEnumerableProperty 22 23 > Test if an object's own property is non-enumerable. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var isNonEnumerableProperty = require( '@stdlib/assert/is-nonenumerable-property' ); 31 ``` 32 33 #### isNonEnumerableProperty( value, property ) 34 35 Returns a `boolean` indicating if a `value` has a non-enumerable `property`. 36 37 ```javascript 38 var defineProperty = require( '@stdlib/utils/define-property' ); 39 40 var obj = { 41 'foo': 'bar' 42 }; 43 44 defineProperty( obj, 'beep', { 45 'configurable': false, 46 'enumerable': false, 47 'writable': true, 48 'value': 'boop' 49 }); 50 51 var bool = isNonEnumerableProperty( obj, 'beep' ); 52 // returns true 53 54 bool = isNonEnumerableProperty( obj, 'foo' ); 55 // returns false 56 ``` 57 58 </section> 59 60 <!-- /.usage --> 61 62 <section class="notes"> 63 64 ## Notes 65 66 - Value arguments other than `null` or `undefined` are coerced to `objects`. 67 68 ```javascript 69 var bool = isNonEnumerableProperty( 'beep', 'length' ); 70 // returns true 71 ``` 72 73 </section> 74 75 <!-- /.notes --> 76 77 <section class="examples"> 78 79 ## Examples 80 81 <!-- eslint-disable object-curly-newline --> 82 83 <!-- eslint no-undef: "error" --> 84 85 ```javascript 86 var isNonEnumerableProperty = require( '@stdlib/assert/is-nonenumerable-property' ); 87 88 var bool = isNonEnumerableProperty( [ 'a' ], 'length' ); 89 // returns true 90 91 bool = isNonEnumerableProperty( { 'a': 'b' }, 'a' ); 92 // returns false 93 94 bool = isNonEnumerableProperty( [ 'a' ], 0 ); 95 // returns false 96 97 bool = isNonEnumerableProperty( {}, 'toString' ); 98 // returns false 99 100 bool = isNonEnumerableProperty( {}, 'hasOwnProperty' ); 101 // returns false 102 103 bool = isNonEnumerableProperty( null, 'a' ); 104 // returns false 105 106 bool = isNonEnumerableProperty( void 0, 'a' ); 107 // returns false 108 109 bool = isNonEnumerableProperty( { 'null': false }, null ); 110 // returns false 111 112 bool = isNonEnumerableProperty( { '[object Object]': false }, {} ); 113 // returns false 114 ``` 115 116 </section> 117 118 <!-- /.examples --> 119 120 <section class="links"> 121 122 </section> 123 124 <!-- /.links -->