1 | var $ = require('../internals/export');
|
---|
2 | // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env`
|
---|
3 | var Set = require('../modules/es.set');
|
---|
4 | var ReflectMetadataModule = require('../internals/reflect-metadata');
|
---|
5 | var anObject = require('../internals/an-object');
|
---|
6 | var getPrototypeOf = require('../internals/object-get-prototype-of');
|
---|
7 | var iterate = require('../internals/iterate');
|
---|
8 |
|
---|
9 | var ordinaryOwnMetadataKeys = ReflectMetadataModule.keys;
|
---|
10 | var toMetadataKey = ReflectMetadataModule.toKey;
|
---|
11 |
|
---|
12 | var from = function (iter) {
|
---|
13 | var result = [];
|
---|
14 | iterate(iter, result.push, { that: result });
|
---|
15 | return result;
|
---|
16 | };
|
---|
17 |
|
---|
18 | var ordinaryMetadataKeys = function (O, P) {
|
---|
19 | var oKeys = ordinaryOwnMetadataKeys(O, P);
|
---|
20 | var parent = getPrototypeOf(O);
|
---|
21 | if (parent === null) return oKeys;
|
---|
22 | var pKeys = ordinaryMetadataKeys(parent, P);
|
---|
23 | return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
|
---|
24 | };
|
---|
25 |
|
---|
26 | // `Reflect.getMetadataKeys` method
|
---|
27 | // https://github.com/rbuckton/reflect-metadata
|
---|
28 | $({ target: 'Reflect', stat: true }, {
|
---|
29 | getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {
|
---|
30 | var targetKey = arguments.length < 2 ? undefined : toMetadataKey(arguments[1]);
|
---|
31 | return ordinaryMetadataKeys(anObject(target), targetKey);
|
---|
32 | }
|
---|
33 | });
|
---|