项目作者: abraham

项目描述 :
Lightweight (3K) ES Module implementation of reflect-metadata
高级语言: TypeScript
项目地址: git://github.com/abraham/reflection.git
创建时间: 2018-07-23T16:00:38Z
项目社区:https://github.com/abraham/reflection

开源协议:MIT License

下载


@abraham/reflection"">Version Status
Build Status
@abraham/reflection"">npm bundle size (minified + gzip)
Coverage Status

Reflection

Lightweight ES Module implementation of reflect-metadata to work with TypeScript’s experimental decorator support.

Why?

The main reason for this library is to provide a much smaller implementation that can be included as a module.

Read about how to drop 20K from your production Angular app by switching to this.

Install

  1. npm install @abraham/reflection

Usage

  1. import '@abraham/reflection';
  2. Reflect.defineMetadata(metadataKey, metadataValue, target);

You can also import Reflection:

  1. import { Reflection as Reflect } from '@abraham/reflection';
  2. Reflect.defineMetadata(metadataKey, metadataValue, target);

API

Reflection does not currently cover the complete API surface of reflect-metadata. The following methods are available:

  1. Reflect.decorate(...);
  2. Reflect.defineMetadata(...);
  3. Reflect.getMetadata(...);
  4. Reflect.hasMetadata(...);
  5. Reflect.getOwnMetadata(...);
  6. Reflect.hasOwnMetadata(...);
  7. Reflect.metadata(...);