1 | 'use strict';
|
---|
2 | // TODO: Remove from `core-js@4`
|
---|
3 | var $ = require('../internals/export');
|
---|
4 | var uncurryThis = require('../internals/function-uncurry-this');
|
---|
5 | var ReflectMetadataModule = require('../internals/reflect-metadata');
|
---|
6 | var anObject = require('../internals/an-object');
|
---|
7 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
---|
8 | var $arrayUniqueBy = require('../internals/array-unique-by');
|
---|
9 |
|
---|
10 | var arrayUniqueBy = uncurryThis($arrayUniqueBy);
|
---|
11 | var concat = uncurryThis([].concat);
|
---|
12 | var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys;
|
---|
13 | var toMetadataKey = ReflectMetadataModule.toKey;
|
---|
14 |
|
---|
15 | var ordinaryMetadataKeys = function (O, P) {
|
---|
16 | var oKeys = ordinaryOwnMetadataKeys(O, P);
|
---|
17 | var parent = getPrototypeOf(O);
|
---|
18 | if (parent === null) return oKeys;
|
---|
19 | var pKeys = ordinaryMetadataKeys(parent, P);
|
---|
20 | return pKeys.length ? oKeys.length ? arrayUniqueBy(concat(oKeys, pKeys)) : pKeys : oKeys;
|
---|
21 | };
|
---|
22 |
|
---|
23 | // `Reflect.getMetadataKeys` method
|
---|
24 | // https://github.com/rbuckton/reflect-metadata
|
---|
25 | $({ target: 'Reflect', stat: true }, {
|
---|
26 | getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {
|
---|
27 | var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]);
|
---|
28 | return ordinaryMetadataKeys(anObject(target), targetKey);
|
---|
29 | }
|
---|
30 | });
|
---|