time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (2075B)


      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 # enumerablePropertiesIn
     22 
     23 > Return an array of an object's own and inherited enumerable property names and [symbols][@stdlib/symbol/ctor].
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var enumerablePropertiesIn = require( '@stdlib/utils/enumerable-properties-in' );
     31 ```
     32 
     33 #### enumerablePropertiesIn( obj )
     34 
     35 Returns an `array` of an object's own and inherited enumerable property names and [symbols][@stdlib/symbol/ctor].
     36 
     37 ```javascript
     38 var obj = {
     39     'a': 'a'
     40 };
     41 
     42 var props = enumerablePropertiesIn( obj );
     43 // returns [ 'a' ]
     44 ```
     45 
     46 </section>
     47 
     48 <!-- /.usage -->
     49 
     50 <section class="notes">
     51 
     52 </section>
     53 
     54 <!-- /.notes -->
     55 
     56 <section class="examples">
     57 
     58 ## Examples
     59 
     60 <!-- eslint no-undef: "error" -->
     61 
     62 ```javascript
     63 var hasSymbolSupport = require( '@stdlib/assert/has-symbol-support' );
     64 var Symbol = require( '@stdlib/symbol/ctor' );
     65 var enumerablePropertiesIn = require( '@stdlib/utils/enumerable-properties-in' );
     66 
     67 var hasSymbols;
     68 var props;
     69 var obj;
     70 
     71 hasSymbols = hasSymbolSupport();
     72 
     73 function Foo() {
     74     this.a = 'b';
     75     if ( hasSymbols ) {
     76         this[ Symbol( 'a' ) ] = 'b';
     77     }
     78     return this;
     79 }
     80 
     81 Foo.prototype.foo = 'bar';
     82 if ( hasSymbols ) {
     83     Foo.prototype[ Symbol( 'foo' ) ] = 'bar';
     84 }
     85 
     86 obj = new Foo();
     87 props = enumerablePropertiesIn( obj );
     88 
     89 console.log( props );
     90 // e.g., => [ 'a', 'foo', ... ]
     91 ```
     92 
     93 </section>
     94 
     95 <!-- /.examples -->
     96 
     97 <section class="links">
     98 
     99 [@stdlib/symbol/ctor]: https://www.npmjs.com/package/@stdlib/symbol-ctor
    100 
    101 </section>
    102 
    103 <!-- /.links -->