OwnPropertyKeys.js 706 B

12345678910111213141516171819202122
  1. 'use strict';
  2. var GetIntrinsic = require('get-intrinsic');
  3. var callBind = require('call-bind');
  4. var callBound = require('call-bind/callBound');
  5. var $ownKeys = GetIntrinsic('%Reflect.ownKeys%', true);
  6. var $pushApply = callBind.apply(GetIntrinsic('%Array.prototype.push%'));
  7. var $SymbolValueOf = callBound('Symbol.prototype.valueOf', true);
  8. var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true);
  9. var $gOPS = $SymbolValueOf ? GetIntrinsic('%Object.getOwnPropertySymbols%') : null;
  10. var keys = require('object-keys');
  11. module.exports = $ownKeys || function OwnPropertyKeys(source) {
  12. var ownKeys = ($gOPN || keys)(source);
  13. if ($gOPS) {
  14. $pushApply(ownKeys, $gOPS(source));
  15. }
  16. return ownKeys;
  17. };