Skip to main content
Module

x/mandarinets/main-core/reflectMetadata.ts>Reflect.getMetadata

Mandarine.TS is a typescript, decorator-driven framework that allows you to create server-side applications. Mandarine.TS provides a range of built-in solutions such as Dependency Injection, Components, ORM and more. Under its umbrella, Mandarine.TS has 4 modules: Core, Data, Security and MVC, these modules will offer you the requirements to build a Mandarine-powered application.
Latest
function Reflect.getMetadata
import { Reflect } from "https://deno.land/x/mandarinets@v2.3.2/main-core/reflectMetadata.ts";
const { getMetadata } = Reflect;

Gets the metadata value for the provided metadata key on the target object or its prototype chain.

Examples

class Example { }

// constructor result = Reflect.getMetadata("custom:annotation", Example);

Parameters

metadataKey: any

A key used to store and retrieve metadata.

target: any

The target object on which the metadata is defined.

Returns

any

The metadata value for the metadata key if found; otherwise, undefined.

Gets the metadata value for the provided metadata key on the target object or its prototype chain.

Examples

class Example { // property declarations are not part of ES6, though they are valid in TypeScript: // static staticProperty; // property;

static staticMethod(p) { } method(p) { } }

// property (on constructor)
result = Reflect.getMetadata("custom:annotation", Example, "staticProperty");

// property (on prototype)
result = Reflect.getMetadata("custom:annotation", Example.prototype, "property");

// method (on constructor)
result = Reflect.getMetadata("custom:annotation", Example, "staticMethod");

// method (on prototype)
result = Reflect.getMetadata("custom:annotation", Example.prototype, "method");

Parameters

metadataKey: any

A key used to store and retrieve metadata.

target: any

The target object on which the metadata is defined.

propertyKey: string | symbol

The property key for the target.

Returns

any

The metadata value for the metadata key if found; otherwise, undefined.