Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

confab-features

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

confab-features

Runtime feature gating for confab applications

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

confab-features

Build
Status Coverage
Status

Feature gates for confab. Declare a list of features that can be toggled on and off:

var confab = require('confab');
var features = require('confab-features');

var config = confab([
  features([
    'new_ui'
  ])
]);

Run the app with gates set by either a previous transformation or environment overrides:

$ CONFIG_FEATURES_NEW_UI=true \
  node app.js

Then, inside the app, retrieve the feature configurations from a processed confab config:

if (config.features.new_ui) {
  renderNewUi();
}
else {
  renderLegacyUi();
}

The full list of configured features is available by invoking config.features directly:

config.features().forEach(function (feature) {
  console.log(feature.key, feature.description);
});

API

confab-features exports:

features(items: Array<Object|String>, opts: Map<String, any>): Map<String, Boolean>

Note that items may contain both string keys and simple object with a key and (optional) description of the feature:

[
  'new_ui',
  { key: 'new_campaign', description: 'A switch to flip' }
]
opts
NameTypeDescription
configKeyStringThe config key for 'features' and environment variables (default: 'features')
validateBooleanThrow on undeclared or invalid feature settings (default: true)

Quis configiet ipsos configes?

Development

Clone this repository:

$ git clone git@github.com:rjz/confab-features.git

...and copy, fork, customize, and whatever you need to do.

Testing

Lint and run test suite:

$ npm test

License

MIT

Keywords

FAQs

Package last updated on 11 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc