@knfcz/features-flag
v1.0.0
Published
Pretty simple feature flag manager
Downloads
1
Readme
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
}