
Security News
Static vs. Runtime Reachability: Insights from Latio’s On the Record Podcast
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
@statsig/client-core
Advanced tools
@statsig/client-core is a JavaScript library designed to help developers implement feature flags, dynamic configurations, and A/B testing in their applications. It allows for real-time feature management and experimentation, enabling teams to release features safely and measure their impact.
Feature Flags
This code demonstrates how to use @statsig/client-core to check if a feature flag is enabled for a specific user. The `checkGate` method is used to determine the status of a feature flag.
const { StatsigClient } = require('@statsig/client-core');
async function main() {
const client = new StatsigClient('client-api-key', { userID: 'user123' });
await client.initializeAsync();
const isFeatureEnabled = client.checkGate('new_feature');
console.log('Is new feature enabled:', isFeatureEnabled);
}
main();
Dynamic Configurations
This code shows how to retrieve dynamic configurations using @statsig/client-core. The `getConfig` method fetches configuration values that can be used to customize application behavior without deploying new code.
const { StatsigClient } = require('@statsig/client-core');
async function main() {
const client = new StatsigClient('client-api-key', { userID: 'user123' });
await client.initializeAsync();
const config = client.getConfig('button_color');
console.log('Button color config:', config.getValue('color', 'defaultColor'));
}
main();
A/B Testing
This example illustrates how to use @statsig/client-core for A/B testing. The `getExperiment` method is used to determine which variant of an experiment a user is assigned to, allowing for controlled testing of different features or configurations.
const { StatsigClient } = require('@statsig/client-core');
async function main() {
const client = new StatsigClient('client-api-key', { userID: 'user123' });
await client.initializeAsync();
const experiment = client.getExperiment('button_test');
console.log('Experiment variant:', experiment.getValue('variant', 'control'));
}
main();
LaunchDarkly is a feature management platform that provides similar functionality to @statsig/client-core, including feature flags, A/B testing, and dynamic configurations. It offers a robust set of tools for managing feature releases and experiments, with a focus on scalability and integration with various platforms.
Unleash is an open-source feature management solution that provides feature toggling capabilities similar to @statsig/client-core. It focuses on simplicity and flexibility, allowing developers to manage feature flags and experiments with ease. Unleash is a good alternative for teams looking for an open-source solution.
FAQs
Unknown package
The npm package @statsig/client-core receives a total of 375,375 weekly downloads. As such, @statsig/client-core popularity was classified as popular.
We found that @statsig/client-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers 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
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.