es.object.get-own-property-symbols.js 904 B

12345678910111213141516171819
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var NATIVE_SYMBOL = require('../internals/symbol-constructor-detection');
  4. var fails = require('../internals/fails');
  5. var getOwnPropertySymbolsModule = require('../internals/object-get-own-property-symbols');
  6. var toObject = require('../internals/to-object');
  7. // V8 ~ Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
  8. // https://bugs.chromium.org/p/v8/issues/detail?id=3443
  9. var FORCED = !NATIVE_SYMBOL || fails(function () { getOwnPropertySymbolsModule.f(1); });
  10. // `Object.getOwnPropertySymbols` method
  11. // https://tc39.es/ecma262/#sec-object.getownpropertysymbols
  12. $({ target: 'Object', stat: true, forced: FORCED }, {
  13. getOwnPropertySymbols: function getOwnPropertySymbols(it) {
  14. var $getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  15. return $getOwnPropertySymbols ? $getOwnPropertySymbols(toObject(it)) : [];
  16. }
  17. });