decorator-when
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Decorator When

NPM version NPM downloads Build status Test coverage

Simple decorator for short-cutting method execution.

Installation

npm install decorator-when --save

Usage

import { when } from "decorator-when";
 
class Demo {
  @when(Demo.prototype.should)
  method() {
    s.apply(this, arguments);
  }
  should() {
    return Math.random() > 0.5;
  }
}
 
new Demo().method();

License

MIT

Dependencies (0)

    Dev Dependencies (11)

    Package Sidebar

    Install

    npm i decorator-when

    Weekly Downloads

    1

    Version

    2.0.1

    License

    MIT

    Unpacked Size

    12.5 kB

    Total Files

    9

    Last publish

    Collaborators

    • blakeembrey