2016-10-10 03:43:44 +02:00
|
|
|
// 26.1.6 Reflect.get(target, propertyKey [, receiver])
|
2017-08-14 05:01:11 +02:00
|
|
|
var gOPD = require('./_object-gopd');
|
|
|
|
var getPrototypeOf = require('./_object-gpo');
|
|
|
|
var has = require('./_has');
|
|
|
|
var $export = require('./_export');
|
|
|
|
var isObject = require('./_is-object');
|
|
|
|
var anObject = require('./_an-object');
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
function get(target, propertyKey /* , receiver */) {
|
|
|
|
var receiver = arguments.length < 3 ? target : arguments[2];
|
|
|
|
var desc, proto;
|
|
|
|
if (anObject(target) === receiver) return target[propertyKey];
|
|
|
|
if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value')
|
2016-10-10 03:43:44 +02:00
|
|
|
? desc.value
|
|
|
|
: desc.get !== undefined
|
|
|
|
? desc.get.call(receiver)
|
|
|
|
: undefined;
|
2017-08-14 05:01:11 +02:00
|
|
|
if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver);
|
2016-10-10 03:43:44 +02:00
|
|
|
}
|
|
|
|
|
2017-08-14 05:01:11 +02:00
|
|
|
$export($export.S, 'Reflect', { get: get });
|