JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25929
  • Score
    100M100P100Q151220F
  • License MIT

Lightweight ES Module implementation of reflect-metadata

Package Exports

  • @abraham/reflection

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@abraham/reflection) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Version Status Build Status Dependency 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.

  • reflect-metadata is 52 K without compression while reflection is about 3 K
  • reflection can be loaded with <script type="module" src="..."></script>

Install

npm install @abraham/reflection

Usage

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

If you want a globally available version.

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

API

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

Reflect.decorate(...);
Reflect.defineMetadata(...);
Reflect.getMetadata(...);
Reflect.getOwnMetadata(...);
Reflect.hasOwnMetadata(...);
Reflect.metadata(...);