safe-get-built-in.js 470 B

12345678910111213
  1. 'use strict';
  2. var global = require('../internals/global');
  3. var DESCRIPTORS = require('../internals/descriptors');
  4. // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe
  5. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  6. // Avoid NodeJS experimental warning
  7. module.exports = function (name) {
  8. if (!DESCRIPTORS) return global[name];
  9. var descriptor = getOwnPropertyDescriptor(global, name);
  10. return descriptor && descriptor.value;
  11. };