time-to-botec

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

_getSymbolsIn.js (754B)


      1 var arrayPush = require('./_arrayPush'),
      2     getPrototype = require('./_getPrototype'),
      3     getSymbols = require('./_getSymbols'),
      4     stubArray = require('./stubArray');
      5 
      6 /* Built-in method references for those with the same name as other `lodash` methods. */
      7 var nativeGetSymbols = Object.getOwnPropertySymbols;
      8 
      9 /**
     10  * Creates an array of the own and inherited enumerable symbols of `object`.
     11  *
     12  * @private
     13  * @param {Object} object The object to query.
     14  * @returns {Array} Returns the array of symbols.
     15  */
     16 var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
     17   var result = [];
     18   while (object) {
     19     arrayPush(result, getSymbols(object));
     20     object = getPrototype(object);
     21   }
     22   return result;
     23 };
     24 
     25 module.exports = getSymbolsIn;