mirror of
https://github.com/swc-project/swc.git
synced 2024-12-22 13:11:31 +03:00
19 lines
475 B
JavaScript
19 lines
475 B
JavaScript
|
import "reflect-metadata";
|
||
|
|
||
|
const Test = (target) => {
|
||
|
const metadata = Reflect.getMetadataKeys(target).reduce((metadata, key) => {
|
||
|
const { [key]: values = [] } = metadata;
|
||
|
|
||
|
const all = Reflect.getMetadata(key, target);
|
||
|
const own = Reflect.getOwnMetadata(key, target);
|
||
|
|
||
|
return {
|
||
|
...metadata,
|
||
|
[key]: [{ all, own }, ...values],
|
||
|
};
|
||
|
}, {});
|
||
|
|
||
|
console.dir(metadata, { depth: 5 });
|
||
|
};
|
||
|
|
||
|
export class Foo { }
|