Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

define-built-in.js 979B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. var isCallable = require('../internals/is-callable');
  3. var definePropertyModule = require('../internals/object-define-property');
  4. var makeBuiltIn = require('../internals/make-built-in');
  5. var defineGlobalProperty = require('../internals/define-global-property');
  6. module.exports = function (O, key, value, options) {
  7. if (!options) options = {};
  8. var simple = options.enumerable;
  9. var name = options.name !== undefined ? options.name : key;
  10. if (isCallable(value)) makeBuiltIn(value, name, options);
  11. if (options.global) {
  12. if (simple) O[key] = value;
  13. else defineGlobalProperty(key, value);
  14. } else {
  15. try {
  16. if (!options.unsafe) delete O[key];
  17. else if (O[key]) simple = true;
  18. } catch (error) { /* empty */ }
  19. if (simple) O[key] = value;
  20. else definePropertyModule.f(O, key, {
  21. value: value,
  22. enumerable: false,
  23. configurable: !options.nonConfigurable,
  24. writable: !options.nonWritable
  25. });
  26. } return O;
  27. };