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

@kablamo/kerosene-feature-flags

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kablamo/kerosene-feature-flags

A simple assertion style feature flag for use in CI/CD deployment pipelines, especially well suited to monorepos and Trunk Based Development.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
5
Created
Source

Kerosene Feature Flags

A simple assertion style feature flag for use in CI/CD deployment pipelines, especially well suited to monorepos and Trunk Based Development.

Feature Flags give you the ability to safely enable features in different environments, and for specific cohorts of people.

yarn add @kablamo/kerosene-feature-flags

Getting Started

With a Kerosene Feature Flag you define a flag as an assertion of conditions, and their expected values.

import { flag } from "@kablamo/kerosene-feature-flags";

const flags = {
    FEATURE123: flag(c => [
        c.condition("environment").must.be.any.of(["development", "staging"]),
        c.condition("group").must.be.exactly("users"),
    ]),
    FEATURE42: flag(c => [
        c.condition("environment").must.be.exactly("production"),
        c.condition("group").must.be.exactly("beta"),
    ]),
};

export { flags };

When you want to use the flags in your application, you import them, and execute them as a function, passing in an object with runtime information.

import { flags } from "./features";

const runtime = {
    environment: "production",
    group: "users",
    browser: "Firefox",
};

if (flags.FEATURE123(runtime)) {
    console.log("New feature");
} else {
    console.log("Old feature");
}
// output:
// New feature

if (flags.FEATURE42(runtime)) {
    console.log("New feature");
} else {
    console.log("Old feature");
}
// output:
// Old feature

Keywords

FAQs

Package last updated on 26 Feb 2019

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