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

characteristic

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

characteristic

feature flag util

  • 0.0.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Characteristic - Feature flag configuration for Node.js

Build Status

Feature flag implementation in Node.

Inspired by Etsy Feature API

API

var Feature = require("characteristic")();

Feature.isEnabled("my_feature");

It returns true if my_feature is enabled.

According to web application, use binding to apply feature flag on request object when request.user or request.group exists:

function(request, response, next) {
    var enabled = Feature.isEnabled.bind(request)("my_feature");
    // enabled is true if my_feature is enabled for current user
}

Configuration

It loads default configuration file from <project-root>/config/<node-env>.yml:

---
features:
  zero-downtime: on
  flying-phone: off
  super-power:
    users: [hulk, thor, superman]
  hero:
    groups: [shield, avengers]

Uses customized configuration file path:

var Feature = require("characteristic")("./foo/custom-config.yml");

Reload configuration:

Feature.reload();

// reload with new config path
Feature.reload("./bar/custom-config.yml");

Keywords

FAQs

Package last updated on 20 Jan 2015

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