
Security News
Node.js TSC Votes to Stop Distributing Corepack
Corepack will be phased out from future Node.js releases following a TSC vote.
@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 157,763 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 7 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
Corepack will be phased out from future Node.js releases following a TSC vote.
Research
Security News
Research uncovers Black Basta's plans to exploit package registries for ransomware delivery alongside evidence of similar attacks already targeting open source ecosystems.
Security News
Oxlint's beta release introduces 500+ built-in linting rules while delivering twice the speed of previous versions, with future support planned for custom plugins and improved IDE integration.