@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.
LaunchDarkly's Node.js SDK is a feature management platform that allows you to control feature flags and manage feature releases. It provides a robust set of tools for feature flagging, similar to @openfeature/core, but is specific to the LaunchDarkly platform.
Flagr is an open-source feature flagging and A/B testing tool. It provides a RESTful API and a web UI for managing feature flags. While @openfeature/core provides a standard interface for feature flagging, Flagr offers a more comprehensive solution with a focus on experimentation and testing.
Shared js components (server and web)
OpenFeature is an open specification that provides a vendor-agnostic, community-driven API for feature flagging that works with your favorite feature flag management tool.
🔩 Shared JS components
[!IMPORTANT]
If you're developing a provider or hook, you probably do not want to use this package!
This package comprises the common types and interfaces of the OpenFeature server and web SDKs.
If you are developing a provider or a hook, you should instead utilize the server or web SDKs.
This package is useful if you need to reference the underlying types common to all the JS SDKs or if you're creating a utility that can be used for both server and web implementations.
Be sure to add this module as either a devDependency (if only build time assets such as types are required) or as a peerDependency with a permissive version expression.
The npm package @openfeature/core receives a total of 204,672 weekly downloads. As such, @openfeature/core popularity was classified as popular.
We found that @openfeature/core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 2 open source maintainers collaborating on the project.
Package last updated on 13 Feb 2025
Did you know?
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.
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.