es7.object.lookup-setter.js 624 B

123456789101112131415161718
  1. 'use strict';
  2. var $export = require('./_export');
  3. var toObject = require('./_to-object');
  4. var toPrimitive = require('./_to-primitive');
  5. var getPrototypeOf = require('./_object-gpo');
  6. var getOwnPropertyDescriptor = require('./_object-gopd').f;
  7. // B.2.2.5 Object.prototype.__lookupSetter__(P)
  8. require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
  9. __lookupSetter__: function __lookupSetter__(P) {
  10. var O = toObject(this);
  11. var K = toPrimitive(P, true);
  12. var D;
  13. do {
  14. if (D = getOwnPropertyDescriptor(O, K)) return D.set;
  15. } while (O = getPrototypeOf(O));
  16. }
  17. });