2.1.0 • Published 4 years ago

@decorize/core v2.1.0

Weekly downloads
1,019
License
MIT
Repository
github
Last release
4 years ago

chat build quality coverage dependencies min+gzip typescript

The library contains utilities for creating decorators and registering them during their usage.

Install

npm install @decorize/core --save

Usage

Create class decorator:

import { classLegacyDecorator } from '@decorize/core';

classLegacyDecorator('<decoratorID>', (target: object) => '<logic here>');

Create accessor decorator:

import { accessorLegacyDecorator } from '@decorize/core';

accessorLegacyDecorator('<decoratorID>', (target: object, property: PropertyKey, description: PropertyDescriptor) => {
  '<logic here>';
});

Create method decorator:

import { methodLegacyDecorator } from '@decorize/core';

methodLegacyDecorator('<decoratorID>', (target: object, property: PropertyKey, description: PropertyDescriptor) => {
  '<logic here>';
});

Create parameter decorator:

import { parameterLegacyDecorator } from '@decorize/core';

parameterLegacyDecorator('<decoratorID>', (target: object, method: PropertyKey, paramIdx: number) => {
  '<logic here>';
});

Create property decorator:

import { propertyLegacyDecorator } from '@decorize/core';

propertyLegacyDecorator('<decoratorID>', (target: object, property: PropertyKey) => {
  '<logic here>';
});

Metadata

The library provides a wrapper around reflect-metadata with backup implementation for the assignment of the decorator's metadata to the class.

Future

We are actively supporting the package, so please contact us at GitHub or Gitter if you have any suggestions or questions.