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

@openfeature/js-sdk

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfeature/js-sdk

OpenFeature SDK for JavaScript

  • 1.1.0-experimental-86e7e170c5bf7988a8271e573b11109cb0dba044
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4K
increased by84.3%
Maintainers
2
Weekly downloads
 
Created
Source

OpenFeature SDK for JavaScript

a codecov npm version Known Vulnerabilities v0.5.1 CII Best Practices

This is the JavaScript implementation of OpenFeature, a vendor-agnostic abstraction library for evaluating feature flags.

We support multiple data types for flags (numbers, strings, booleans, objects) as well as hooks, which can alter the lifecycle of a flag evaluation.

This library is intended to be used in server-side contexts and has only experimental support for web usage.

Installation

npm install @openfeature/js-sdk

or

yarn add @openfeature/js-sdk

Usage

import { OpenFeature } from '@openfeature/js-sdk';

// configure a provider
OpenFeature.setProvider(new YourProviderOfChoice());

// create a client
const client = OpenFeature.getClient('my-app');

// get a bool value
const boolValue = await client.getBooleanValue('boolFlag', false);

// get a string value
const stringValue = await client.getStringValue('stringFlag', 'default');

// get an numeric value
const numberValue = await client.getNumberValue('intFlag', 1);

// get an object value
const object = await client.getObjectValue<MyObject>('objectFlag', {});

// add a value to the invocation context
const context: EvaluationContext = {
  myInvocationKey: 'myInvocationValue',
};
const contextAwareValue = await client.getBooleanValue('boolFlag', false, context);

For complete documentation, visit: https://docs.openfeature.dev/docs/category/concepts

Contributing

See CONTRIBUTING.md for details on how to contribute to the OpenFeature project.

Our community meetings are held regularly and open to everyone. Check the OpenFeature community calendar for specific dates and for the Zoom meeting links.

Thanks so much to our contributors.

Made with contrib.rocks.

License

Apache License 2.0

Keywords

FAQs

Package last updated on 13 Dec 2022

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