npm.io
0.1.0 • Published 5 years ago

feature-flag-decorator

Licence
MIT
Version
0.1.0
Deps
0
Size
10 kB
Vulns
0
Weekly
0

feature-flag-decorator

A simple decorator that will only execute the wrapped method if the given feature flag is set. (e.g.: @FeatureFlag('DEBUG_COLLISIONS') will only let a method execute if process.env.DEBUG_COLLISIONS has been set to a truthy value)


Installation

yarn add feature-flag-decorator or npm install feature-flag-decorator


Usage example

import FeatureFlag from 'feature-flag-decorator';

class MyClass {
  @FeatureFlag('DEBUG_COLLISIONS')
  debugMyCollisions(): void {
    console.log("Hey, I'm debugging some collisions here!");
  }
}