Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 18, 2024 via pnpm

reflect-metadata 0.2.1

Polyfill for Metadata Reflection API
Package summary
Share
0
issues
1
license
1
Apache-2.0
Package created
14 Apr 2015
Version published
14 Dec 2023
Maintainers
1
Total deps
1
Direct deps
0
License
Apache-2.0

Issues

0
This package has no issues

Licenses

Apache License 2.0

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
1 Packages, Including:
reflect-metadata@0.2.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of reflect-metadata 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does reflect-metadata do?

The reflect-metadata is a popular npm package that serves as a polyfill for the Metadata Reflection API. This tool is designed to augment classes and their members during the definition phase using a declarative syntax. Its primary function is to allow developers to add additional, consistent metadata to a class. This metadata can then be accessed not just on the object itself, but also through a Proxy, further enhancing its flexibility and usability.

How do you use reflect-metadata?

To use reflect-metadata, you first need to install it using npm with the command npm install reflect-metadata. Once installed, you can define metadata declaratively on a class using the @Reflect.metadata(metadataKey, metadataValue) syntax as shown below:

class C {
  @Reflect.metadata('metadataKey', 'metadataValue')
  method() {
  }
}

If you prefer an imperative approach, you can use Reflect.defineMetadata(metadataKey, metadataValue, C.prototype, "method"); as follows:

Reflect.defineMetadata('metadataKey', 'metadataValue', C.prototype, 'method');

To introspect the metadata, the following syntax is used:

let obj = new C();
let metadataValue = Reflect.getMetadata('metadataKey', obj, 'method');

Besides defining and retrieving metadata, the API also allows you to check for the presence of a metadata key and delete metadata from an object or property.

Where are the reflect-metadata docs?

As a JavaScript and SEO expert, I found that the detailed documentation for reflect-metadata can be found here. This documentation goes over the detailed proposal for the API, it's background, goals, syntax and semantics, API usage, and also discusses potential issues and alternatives. It's an excellent resource for both beginners and advanced users who want to leverage the full potential of the reflect-metadata npm package.