npm install feature-flag``bash`
npm install feature-flag
In order to get started you simply need to create a `features.yaml` file at the root of your project and use the following code.
`js
var feature = require('../index');
feature.load();
if (feature.isEnabled('myfeature')) {
// Do something
}
`
`js`
feature.addProvider(feature.Providers.YamlProvider({ path: './features.yaml' }));
feature.load(); # You must call load after you add the providers
Basic usage:
`
feature.isEnabled('feature');
feature.isEnabledForUser('feature', 'jane@example.com');
feature.isEnabledForBucket('feature', 'groups', 'group1');
var world = {
users: 'jane@example.com',
groups: ['group1', 'group2']
}
feature.isEnabledFor('feature', world);
`
`yamlSimple Features - always on or off
feature1: on
feature2: off
feature1a:
- enabled: on
feature2a:
- enabled: off
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
This project is licensed under the MIT license. See the LICENSE file for more info.