Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1001 bytes
|
Line | |
---|
1 | var $ = require('../internals/export');
|
---|
2 | var isObject = require('../internals/is-object');
|
---|
3 | var anObject = require('../internals/an-object');
|
---|
4 | var has = require('../internals/has');
|
---|
5 | var getOwnPropertyDescriptorModule = require('../internals/object-get-own-property-descriptor');
|
---|
6 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
---|
7 |
|
---|
8 | // `Reflect.get` method
|
---|
9 | // https://tc39.es/ecma262/#sec-reflect.get
|
---|
10 | function get(target, propertyKey /* , receiver */) {
|
---|
11 | var receiver = arguments.length < 3 ? target : arguments[2];
|
---|
12 | var descriptor, prototype;
|
---|
13 | if (anObject(target) === receiver) return target[propertyKey];
|
---|
14 | if (descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey)) return has(descriptor, 'value')
|
---|
15 | ? descriptor.value
|
---|
16 | : descriptor.get === undefined
|
---|
17 | ? undefined
|
---|
18 | : descriptor.get.call(receiver);
|
---|
19 | if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver);
|
---|
20 | }
|
---|
21 |
|
---|
22 | $({ target: 'Reflect', stat: true }, {
|
---|
23 | get: get
|
---|
24 | });
|
---|
Note:
See
TracBrowser
for help on using the repository browser.