[79a0317] | 1 | 'use strict';
|
---|
| 2 | // TODO: Remove from `core-js@4`
|
---|
| 3 | var $ = require('../internals/export');
|
---|
| 4 | var ReflectMetadataModule = require('../internals/reflect-metadata');
|
---|
| 5 | var anObject = require('../internals/an-object');
|
---|
| 6 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
---|
| 7 |
|
---|
| 8 | var ordinaryHasOwnMetadata = ReflectMetadataModule.has;
|
---|
| 9 | var ordinaryGetOwnMetadata = ReflectMetadataModule.get;
|
---|
| 10 | var toMetadataKey = ReflectMetadataModule.toKey;
|
---|
| 11 |
|
---|
| 12 | var ordinaryGetMetadata = function (MetadataKey, O, P) {
|
---|
| 13 | var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
|
---|
| 14 | if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P);
|
---|
| 15 | var parent = getPrototypeOf(O);
|
---|
| 16 | return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
|
---|
| 17 | };
|
---|
| 18 |
|
---|
| 19 | // `Reflect.getMetadata` method
|
---|
| 20 | // https://github.com/rbuckton/reflect-metadata
|
---|
| 21 | $({ target: 'Reflect', stat: true }, {
|
---|
| 22 | getMetadata: function getMetadata(metadataKey, target /* , targetKey */) {
|
---|
| 23 | var targetKey = arguments.length < 3 ? undefined : toMetadataKey(arguments[2]);
|
---|
| 24 | return ordinaryGetMetadata(metadataKey, anObject(target), targetKey);
|
---|
| 25 | }
|
---|
| 26 | });
|
---|