1.0.1 • Published 7 months ago

@bitaffair/feama v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

Bitaffair/FeaMa

A basic feature flag manager based on MongoQuerySyntax.

Usage

const { Manager } = require("@bitaffair/feama");

const manager = new Manager();

manager.defineFeature('my-feature-a')
  .defaultValue(false)
  .rule({
    match: { plan: 'a' },
    value: true
  });

manager.getValue('my-feature-a') // false

manager.setContext({
  plan: 'a'
});

manager.getValue('my-feature-a') // true

const childScope = manager.child({
  plan: 'a'
});

childScope.getValue('my-feature-a') // true


// define custom resolver
manager.defineResolver({
  getValue(feature, context) {
    return {
      value: true
    }
  }
});
1.0.1

7 months ago

1.0.0

7 months ago

0.0.1

7 months ago