Security News
cURL Project and Go Security Teams Reject CVSS as Broken
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
launchdarkly-js-client-sdk
Advanced tools
The launchdarkly-js-client-sdk is a JavaScript SDK for LaunchDarkly, a feature management platform that allows developers to control the release of features to users. This SDK enables you to manage feature flags, perform A/B testing, and roll out new features gradually.
Initialize the client
This code initializes the LaunchDarkly client with your environment key and a user object. The client is ready to be used once the 'ready' event is fired.
const LDClient = require('launchdarkly-js-client-sdk');
const client = LDClient.initialize('YOUR_ENVIRONMENT_KEY', { key: 'user_key' });
client.on('ready', () => {
console.log('LaunchDarkly client is ready');
});
Evaluate feature flags
This code evaluates a feature flag and returns its value. If the feature flag is enabled, it will log 'Feature is enabled'; otherwise, it will log 'Feature is disabled'.
client.on('ready', () => {
const showFeature = client.variation('your-feature-flag-key', false);
if (showFeature) {
console.log('Feature is enabled');
} else {
console.log('Feature is disabled');
}
});
Track custom events
This code tracks a custom event with a specified key and optional data. This can be useful for analytics and monitoring user interactions.
client.track('custom-event-key', { customData: 'value' });
Identify users
This code identifies a new user with a unique key and optional attributes. This is useful for targeting specific users with feature flags.
client.identify({ key: 'new_user_key', name: 'New User' }).then(() => {
console.log('User identified');
});
Unleash is an open-source feature management solution. The unleash-client package provides similar functionality to LaunchDarkly, allowing you to manage feature flags and control feature rollouts. However, Unleash is self-hosted, which means you need to manage the infrastructure yourself.
ConfigCat is a feature flag and configuration management service. The configcat-js package allows you to manage feature flags and configurations in your JavaScript applications. ConfigCat offers a hosted solution with a user-friendly interface, similar to LaunchDarkly.
Flagsmith is an open-source feature flag and remote config service. The flagsmith package provides similar functionality to LaunchDarkly, including feature flag management and user targeting. Flagsmith can be used as a hosted service or self-hosted, offering flexibility in deployment.
This file contains the launchdarkly-js-client-sdk
package, which is the standard interface for the LaunchDarkly SDK for browser JavaScript. It is described in the main README.
This package automatically imports launchdarkly-js-sdk-common
, which provides much of the underlying implementation.
[2.11.0] - 2019-06-06
FAQs
LaunchDarkly SDK for JavaScript
The npm package launchdarkly-js-client-sdk receives a total of 773,098 weekly downloads. As such, launchdarkly-js-client-sdk popularity was classified as popular.
We found that launchdarkly-js-client-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.