New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

extend-metadata

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

extend-metadata

Extend class with its metadata

latest
Source
npmnpm
Version
1.1.3
Version published
Maintainers
1
Created
Source

extend-metadata

Travis Coverage Status node npm

GitHub top language GitHub code size in bytes David David

license GitHub last commit semantic-release

Description

Extend/override metadata of parent classes.

Installation

npm install extend-metadata

API

@Extend() - class decorator. Use it to extend all parent classes metadata.

@Override() - property/method decorator. Use it to extend particular metadata.

Usage

Extend

@AddClassMetadata()
class Animal {
    @AddPropertyMetadata()
    property: Type;

    @AddMethodMetadata()
    method(): Type {}
}

@Extend()
class Cat extends Animal { // has the same metadata
    property: Type; // also has the same metadata

    @AddAnotherMethodMetadata()
    method(): Type { // has another metadata
        return super.method();
    }
}

Override

@AddClassMetadata()
class Animal {
    @AddPropertyMetadata()
    property: Type;

    @AddMethodMetadata()
    method(): Type {}
}

class Cat extends Animal { // doesn't have metadata from Animal
    @Override()
    property: Type; // has the same metadata

    method(): Type { // no metadata
        return super.method();
    }
}

Requirements

reflect-metadata: ^0.1.13

License

extend-metadata is MIT licensed.

Keywords

extend

FAQs

Package last updated on 30 Jan 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts