time-to-botec

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

main.js (1373B)


      1 /**
      2 * @license Apache-2.0
      3 *
      4 * Copyright (c) 2018 The Stdlib Authors.
      5 *
      6 * Licensed under the Apache License, Version 2.0 (the "License");
      7 * you may not use this file except in compliance with the License.
      8 * You may obtain a copy of the License at
      9 *
     10 *    http://www.apache.org/licenses/LICENSE-2.0
     11 *
     12 * Unless required by applicable law or agreed to in writing, software
     13 * distributed under the License is distributed on an "AS IS" BASIS,
     14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15 * See the License for the specific language governing permissions and
     16 * limitations under the License.
     17 */
     18 
     19 'use strict';
     20 
     21 // MODULES //
     22 
     23 var propertyNames = require( './../../property-names' );
     24 var propertySymbols = require( './../../property-symbols' );
     25 
     26 
     27 // MAIN //
     28 
     29 /**
     30 * Returns an array of an object's own enumerable and non-enumerable property names and symbols.
     31 *
     32 * @param {*} value - input object
     33 * @returns {Array} a list of own property names and symbols
     34 *
     35 * @example
     36 * var obj = {
     37 *     'beep': 'boop',
     38 *     'foo': 3.14
     39 * };
     40 *
     41 * var props = properties( obj );
     42 * // e.g., returns [ 'beep', 'foo' ]
     43 */
     44 function properties( value ) {
     45 	var out;
     46 	var tmp;
     47 	var i;
     48 
     49 	out = propertyNames( value );
     50 	tmp = propertySymbols( value );
     51 	for ( i = 0; i < tmp.length; i++ ) {
     52 		out.push( tmp[ i ] );
     53 	}
     54 	return out;
     55 }
     56 
     57 
     58 // EXPORTS //
     59 
     60 module.exports = properties;