🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

reflect-metadata

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reflect-metadata

Polyfill for Metadata Reflection API

0.2.2
latest
Version published
Weekly downloads
12M
-22.99%
Maintainers
1
Weekly downloads
 
Created

What is reflect-metadata?

The reflect-metadata npm package is a library that allows developers to perform metadata reflection operations in JavaScript. It is based on the metadata reflection API that is proposed for ECMAScript and is used by frameworks like Angular and decorators to add and read metadata annotations.

What are reflect-metadata's main functionalities?

Metadata Reflection

Allows defining metadata on a class or property. The code sample shows how to define custom metadata on a class 'MyClass' with a key 'custom' and a value 'metadataValue'.

Reflect.defineMetadata('custom', 'metadataValue', MyClass);

Metadata Retrieval

Enables retrieval of metadata from a class or property. The code sample demonstrates how to retrieve metadata from a class 'MyClass' using the key 'custom'.

let metadataValue = Reflect.getMetadata('custom', MyClass);

Metadata Deletion

Provides functionality to delete metadata from a class or property. The code sample illustrates how to delete metadata associated with a class 'MyClass' using the key 'custom'.

Reflect.deleteMetadata('custom', MyClass);

Other packages similar to reflect-metadata

FAQs

Package last updated on 29 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts