New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openfeature/core

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openfeature/core

Shared OpenFeature JS components (server and web)

  • 1.7.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
209K
increased by20.04%
Maintainers
2
Weekly downloads
 
Created

What is @openfeature/core?

@openfeature/core is a package that provides a standard interface for feature flagging in applications. It allows developers to control feature releases and manage feature flags in a consistent way across different environments and providers.

What are @openfeature/core's main functionalities?

Feature Flag Evaluation

This feature allows you to evaluate feature flags using the OpenFeature client. In this example, the `getBooleanValue` method is used to retrieve the value of a boolean feature flag named 'my-feature-flag'. If the flag is not set, it defaults to `false`.

const { OpenFeature } = require('@openfeature/core');

const client = OpenFeature.getClient();

async function evaluateFlag() {
  const value = await client.getBooleanValue('my-feature-flag', false);
  console.log(`Feature flag value: ${value}`);
}
evaluateFlag();

Contextual Evaluation

This feature allows you to evaluate feature flags with additional context, such as user information. The context can influence the result of the feature flag evaluation, enabling more personalized feature delivery.

const { OpenFeature } = require('@openfeature/core');

const client = OpenFeature.getClient();

async function evaluateFlagWithContext() {
  const context = { userId: '12345' };
  const value = await client.getBooleanValue('my-feature-flag', false, context);
  console.log(`Feature flag value with context: ${value}`);
}
evaluateFlagWithContext();

Event Handling

This feature allows you to handle events related to the OpenFeature client. In this example, an event handler is added for the 'ready' event, which is triggered when the OpenFeature client is ready to use.

const { OpenFeature } = require('@openfeature/core');

const client = OpenFeature.getClient();

client.addHandler('ready', () => {
  console.log('OpenFeature client is ready');
});

Other packages similar to @openfeature/core

Keywords

FAQs

Package last updated on 18 Feb 2025

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