選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

_getSymbols.js 886B

123456789101112131415161718192021222324252627282930
  1. var arrayFilter = require('./_arrayFilter'),
  2. stubArray = require('./stubArray');
  3. /** Used for built-in method references. */
  4. var objectProto = Object.prototype;
  5. /** Built-in value references. */
  6. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  7. /* Built-in method references for those with the same name as other `lodash` methods. */
  8. var nativeGetSymbols = Object.getOwnPropertySymbols;
  9. /**
  10. * Creates an array of the own 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 getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  17. if (object == null) {
  18. return [];
  19. }
  20. object = Object(object);
  21. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  22. return propertyIsEnumerable.call(object, symbol);
  23. });
  24. };
  25. module.exports = getSymbols;