@knfcz/features-flag

1.0.0 • Public • Published

Simple features flag handler

Install with

npm i @knfcz/features-flag

Create a features.config.json in your project root folder

{
  "features": [
    {
      "name": "auth",
      "description": "Register and login",
      "enabled": true
    },
    {
      "name": "articles",
      "description": "Articles CRUD",
      "enabled": false
    }
  ]
}

Then, create a isFeatureEnabled.js file

const featuresFlag = require('@knfcz/features-flag');
const features = require('../../features.config.json');

export default featuresFlag(features);

And use it wherever you want

const isFeatureEnabled = require('../utils/isFeatureEnabled');


if(isFeatureEnabled('auth')) {
    // do some hot login stuff
}

Readme

Keywords

none

Package Sidebar

Install

npm i @knfcz/features-flag

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

1.42 kB

Total Files

3

Last publish

Collaborators

  • knfcz