Gathering detailed insights and metrics for reflect-metadata
Gathering detailed insights and metrics for reflect-metadata
Gathering detailed insights and metrics for reflect-metadata
Gathering detailed insights and metrics for reflect-metadata
@inversifyjs/reflect-metadata-utils
Reflect metadata utils
babel-plugin-transform-typescript-metadata
Babel plugin to emit decorator metadata like typescript compiler
@types/reflect-metadata
TypeScript definitions for reflect-metadata
@rxap/reflect-metadata
Provides utilities for working with Reflect Metadata. It includes functions for setting, getting, and manipulating metadata on objects and properties. This package also offers functionalities for change detection using proxies and metadata.
Prototype for a Metadata Reflection API for ECMAScript
npm install reflect-metadata
Typescript
Module System
Node Version
NPM Version
99.7
Supply Chain
99.2
Quality
76.1
Maintenance
100
Vulnerability
88
License
v0.2.1
Updated on Dec 14, 2023
reflect-metadata 0.2.0
Updated on Dec 13, 2023
reflect-metadata 0.2.0-pre.0
Updated on Dec 13, 2023
reflect-metadata 0.1.14
Updated on Dec 13, 2023
reflect-metadata 0.1.13
Updated on Dec 13, 2023
reflect-metadata v0.1.12
Updated on Jan 16, 2018
TypeScript (92.3%)
HTML (6.91%)
JavaScript (0.79%)
Total Downloads
1,941,619,811
Last Day
720,567
Last Week
14,929,098
Last Month
64,923,572
Last Year
687,139,994
Apache-2.0 License
3,297 Stars
134 Commits
185 Forks
45 Watchers
7 Branches
27 Contributors
Updated on Jun 29, 2025
Minified
Minified + Gzipped
Latest Version
0.2.2
Package Id
reflect-metadata@0.2.2
Unpacked Size
235.51 kB
Size
32.64 kB
File Count
11
NPM Version
6.14.6
Node Version
10.22.0
Published on
Mar 29, 2024
Cumulative downloads
Total Downloads
Last Day
1.4%
720,567
Compared to previous day
Last Week
-7.3%
14,929,098
Compared to previous week
Last Month
1%
64,923,572
Compared to previous month
Last Year
62.1%
687,139,994
Compared to previous year
NOTE: Now that both Decorators and
Decorator Metadata have achieved Stage 3 within TC39, the API
proposed below is no longer being considered for standardization. However, this package will continue to support
projects that leverage TypeScript's legacy --experimentalDecorators
option as some projects may not be able to migrate
to use standard decorators.
npm install reflect-metadata
1// - Modifies global `Reflect` object (or defines one in ES5 runtimes). 2// - Supports ESM and CommonJS. 3// - Contains internal polyfills for `Map`, `Set`, and `WeakMap` for older runtimes. 4import "reflect-metadata"; 5 6// - Modifies global `Reflect` object (or defines one in ES5 runtimes). 7// - Supports ESM and CommonJS. 8// - Requires runtime support for `"exports"` in `package.json`. 9// - Does not include internal polyfills. 10import "reflect-metadata/lite";
1// - Modifies global `Reflect` object (or defines one in ES5 runtimes). 2// - Contains internal polyfills for `Map`, `Set`, and `WeakMap` for older runtimes. 3require("reflect-metadata"); 4 5// - Modifies global `Reflect` object (or defines one in ES5 runtimes). 6// - Requires runtime support for `"exports"` in `package.json`. 7// - Does not include internal polyfills. 8require("reflect-metadata/lite");
<script>
HTML
1<!-- Modifies global `Reflect` object (or defines one in ES5 runtimes). --> 2<!-- Contains internal polyfills for `Map`, `Set`, and `WeakMap` for older runtimes. --> 3<script src="path/to/reflect-metadata/Reflect.js"></script> 4 5<!-- Modifies global `Reflect` object (or defines one in ES5 runtimes). --> 6<!-- Does not include internal polyfills. --> 7<script src="path/to/reflect-metadata/ReflectLite.js"></script>
Script
1// - Makes types available in your editor. 2/// <reference path="path/to/reflect-metadata/standalone.d.ts" /> 3
1class C { 2 @Reflect.metadata(metadataKey, metadataValue) 3 method() { 4 } 5}
1Reflect.defineMetadata(metadataKey, metadataValue, C.prototype, "method");
1let obj = new C(); 2let metadataValue = Reflect.getMetadata(metadataKey, obj, "method");
1// define metadata on an object or property
2Reflect.defineMetadata(metadataKey, metadataValue, target);
3Reflect.defineMetadata(metadataKey, metadataValue, target, propertyKey);
4
5// check for presence of a metadata key on the prototype chain of an object or property
6let result = Reflect.hasMetadata(metadataKey, target);
7let result = Reflect.hasMetadata(metadataKey, target, propertyKey);
8
9// check for presence of an own metadata key of an object or property
10let result = Reflect.hasOwnMetadata(metadataKey, target);
11let result = Reflect.hasOwnMetadata(metadataKey, target, propertyKey);
12
13// get metadata value of a metadata key on the prototype chain of an object or property
14let result = Reflect.getMetadata(metadataKey, target);
15let result = Reflect.getMetadata(metadataKey, target, propertyKey);
16
17// get metadata value of an own metadata key of an object or property
18let result = Reflect.getOwnMetadata(metadataKey, target);
19let result = Reflect.getOwnMetadata(metadataKey, target, propertyKey);
20
21// get all metadata keys on the prototype chain of an object or property
22let result = Reflect.getMetadataKeys(target);
23let result = Reflect.getMetadataKeys(target, propertyKey);
24
25// get all own metadata keys of an object or property
26let result = Reflect.getOwnMetadataKeys(target);
27let result = Reflect.getOwnMetadataKeys(target, propertyKey);
28
29// delete metadata from an object or property
30let result = Reflect.deleteMetadata(metadataKey, target);
31let result = Reflect.deleteMetadata(metadataKey, target, propertyKey);
32
33// apply metadata via a decorator to a constructor
34@Reflect.metadata(metadataKey, metadataValue)
35class C {
36 // apply metadata via a decorator to a method (property)
37 @Reflect.metadata(metadataKey, metadataValue)
38 method() {
39 }
40}
1function ParamTypes(...types) { 2 return (target, propertyKey) => { 3 const symParamTypes = Symbol.for("design:paramtypes"); 4 if (propertyKey === undefined) { 5 target[symParamTypes] = types; 6 } 7 else { 8 const symProperties = Symbol.for("design:properties"); 9 let properties, property; 10 if (Object.prototype.hasOwnProperty.call(target, symProperties)) { 11 properties = target[symProperties]; 12 } 13 else { 14 properties = target[symProperties] = {}; 15 } 16 if (Object.prototype.hasOwnProperty.call(properties, propertyKey)) { 17 property = properties[propertyKey]; 18 } 19 else { 20 property = properties[propertyKey] = {}; 21 } 22 property[symParamTypes] = types; 23 } 24 }; 25}
1function ParamTypes(...types) { 2 // as propertyKey is effectively optional, its easier to use here 3 return (target, propertyKey) => { Reflect.defineMetadata("design:paramtypes", types, target, propertyKey); } 4 5 // vs. having multiple overloads with the target and key in the front: 6 // 7 // return (target, propertyKey) => { 8 // if (propertyKey === undefined) { 9 // Reflect.defineMetadata(target, "design:paramtypes", types); 10 // } 11 // else { 12 // Reflect.defineMetadata(target, propertyKey, "design:paramtypes", types); 13 // } 14 // } 15 // 16 // vs. having a different methods for the class or a property: 17 // 18 // return (target, propertyKey) => { 19 // if (propertyKey === undefined) { 20 // Reflect.defineMetadata(target, "design:paramtypes", types); 21 // } 22 // else { 23 // Reflect.definePropertyMetadata(target, propertyKey, "design:paramtypes", types); 24 // } 25 // } 26}
"experimentalDecorators": true
to your tsconfig.json file."emitDecoratorMetadata": true
to your tsconfig.json file.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
Found 3/15 approved changesets -- score normalized to 2
Reason
branch protection is not maximal on development and all release branches
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More