_getSymbolsIn.js 754 B

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