es7.object.lookup-getter.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.4 Object.prototype.__lookupGetter__(P)
  8. require('./_descriptors') && $export($export.P + require('./_object-forced-pam'), 'Object', {
  9. __lookupGetter__: function __lookupGetter__(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.get;
  15. } while (O = getPrototypeOf(O));
  16. }
  17. });