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

decorating

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decorating

Helpers for decorating classes and properties

latest
Source
npmnpm
Version
1.2.2
Version published
Weekly downloads
65
-9.72%
Maintainers
1
Weekly downloads
 
Created
Source

Decorating

Helpers for decorating classes and properties

Build Status Coverage Status

ES3 target for TS is not supported.

import {propertyDecorator, classDecorator} from 'decorating'

const alwaysZero = propertyDecorator((target, property, desc) => {
  return {get: () => 0, set: () => {}};
});

const always = propertyDecorator((target, property, desc, value) => {
  return {get: () => value, set: () => {}};
});

const alwaysTwo = always(2);

class TestProps {
  @alwaysZero a;
  @alwaysZero() b;
  @always(1) c;
  @alwaysTwo d;
}

const banana = classDecorator(Class => {
  Class.whaaat = 'BANANA!';
});

const whaaat = classDecorator((Class, value='DEFAULT') => {
  Class.whaaat = value;
});

@banana class TestClass {}
@banana() class TestClass2 {}
@whaaat class TestClass3 {}
@whaaat() class TestClass4 {}
@whaaat('BANANA!') class TestClass5 {}

Keywords

decorate

FAQs

Package last updated on 26 Apr 2020

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