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