Join us to discuss the challenges, solutions and best practices for in-house JavaScript code sharing. Tuesday, 12/17 at 10am PT/1pm ET.Sign up here »

@abraham/reflection

0.7.0 • Public • Published

Version Status Build Status Dependency Status npm bundle size (minified + gzip)

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.

  • ES module
    • reflection can be loaded with <script type="module" src="..."></script>
  • Size (uncompressed)

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

Install

npm install @abraham/reflection

Usage

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

You can also import Reflection:

import { Reflection as Reflect } from '@abraham/reflection';
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.hasMetadata(...);
Reflect.getOwnMetadata(...);
Reflect.hasOwnMetadata(...);
Reflect.metadata(...);

Install

npm i @abraham/reflection

DownloadsWeekly Downloads

1,236

Version

0.7.0

License

MIT

Unpacked Size

29.9 kB

Total Files

12

Last publish

Collaborators

  • avatar