define-global-property.js 371 B

12345678910111213
  1. 'use strict';
  2. var global = require('../internals/global');
  3. // eslint-disable-next-line es/no-object-defineproperty -- safe
  4. var defineProperty = Object.defineProperty;
  5. module.exports = function (key, value) {
  6. try {
  7. defineProperty(global, key, { value: value, configurable: true, writable: true });
  8. } catch (error) {
  9. global[key] = value;
  10. } return value;
  11. };