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

launchdarkly-node-server-sdk

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

launchdarkly-node-server-sdk

LaunchDarkly Server-Side SDK for Node.js

  • 7.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
820K
increased by6.69%
Maintainers
1
Weekly downloads
 
Created

What is launchdarkly-node-server-sdk?

The launchdarkly-node-server-sdk is a feature flag management tool that allows developers to control the release of features to users. It provides a way to manage feature flags, target specific user segments, and perform A/B testing. This SDK is designed for server-side applications.

What are launchdarkly-node-server-sdk's main functionalities?

Initialize the SDK

This code initializes the LaunchDarkly client with your SDK key and waits for the client to be fully initialized before proceeding.

const LaunchDarkly = require('launchdarkly-node-server-sdk');
const client = LaunchDarkly.init('YOUR_SDK_KEY');
client.waitForInitialization().then(() => {
  console.log('LaunchDarkly client initialized');
}).catch(err => {
  console.error('LaunchDarkly client failed to initialize', err);
});

Evaluate a feature flag

This code evaluates a feature flag for a specific user and returns the flag's value. The default value is used if the flag is not found.

const user = { key: 'user-key-123' };
client.variation('your-feature-flag-key', user, false).then(flagValue => {
  if (flagValue) {
    console.log('Feature is enabled for this user');
  } else {
    console.log('Feature is disabled for this user');
  }
});

Track custom events

This code tracks a custom event for a specific user, which can be used for analytics and A/B testing purposes.

client.track('custom-event-key', user, { customData: 'value' });

Close the client

This code gracefully shuts down the LaunchDarkly client, ensuring that all pending events are sent before closing.

client.close().then(() => {
  console.log('LaunchDarkly client closed');
});

Other packages similar to launchdarkly-node-server-sdk

Keywords

FAQs

Package last updated on 01 Mar 2024

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