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.

es.object.lookup-setter.js 911B

1234567891011121314151617181920212223
  1. 'use strict';
  2. var $ = require('../internals/export');
  3. var DESCRIPTORS = require('../internals/descriptors');
  4. var FORCED = require('../internals/object-prototype-accessors-forced');
  5. var toObject = require('../internals/to-object');
  6. var toPropertyKey = require('../internals/to-property-key');
  7. var getPrototypeOf = require('../internals/object-get-prototype-of');
  8. var getOwnPropertyDescriptor = require('../internals/object-get-own-property-descriptor').f;
  9. // `Object.prototype.__lookupSetter__` method
  10. // https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__
  11. if (DESCRIPTORS) {
  12. $({ target: 'Object', proto: true, forced: FORCED }, {
  13. __lookupSetter__: function __lookupSetter__(P) {
  14. var O = toObject(this);
  15. var key = toPropertyKey(P);
  16. var desc;
  17. do {
  18. if (desc = getOwnPropertyDescriptor(O, key)) return desc.set;
  19. } while (O = getPrototypeOf(O));
  20. }
  21. });
  22. }