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

ez-options-js

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ez-options-js

an agnostic feature flag implementation that enables you to overload in code, querystring and api, like launchdarkly

  • 0.1.3
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

Options

an agnostic feature flag implementation that enables you to overload in code, querystring and api, like launchdarkly

I'm calling this "Options", since featureflags is taken the goal is to develop an agnostic approach that is not dependent on react, redux, etc.

It should allow the developer to specify options (flags) in multiple ways...

  • first they can be initialized in config.options
  • but those can be overloaded by process.env
  • and then overloaded by sessionStorage (prior changes)
  • and then overloaded by a querystring (in case we want to overload it now, dynamically)
  • and all can be changed dynamically in the code and gui (logic trumps all)
  • and you can extend this object to include remote options, like launchdarkly feature flags, etc.

Usage... http://your-domain.com?options=flag1,-flag2,+flag3&flag4=four would turn flag1 On (true), and flag2 and flag3 Off (false)

  options will look something like {
      flag1: true,
      flag2: false,
      flag3: true,
      flag4: 'four',
  }

usage

npm install ez-options-js
import theOptions from 'ez-options-js'

describe('Options', () => {
  test('Options.options', () => {
    expect(Object.keys(theOptions.list).length).toBeGreaterThan(0)
  })
  test('addQueryString', async () => {
      theOptions.set({})
      expect(theOptions.list).toEqual({})
      theOptions.addQueryString('options=flag1,-flag2,+flag3&flag4=four')
      expect(theOptions.list.flag1).toBeTruthy()
      expect(theOptions.list.flag2).toBeFalsy()
      expect(theOptions.list.flag3).toBeTruthy()
      expect(theOptions.list.flag4).toBe('four')
  })

  ...

npm

https://www.npmjs.com/package/ez-options-js

git

https://github.com/chadsteele/options/

Keywords

FAQs

Package last updated on 28 Feb 2021

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