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

unleash-client

Package Overview
Dependencies
Maintainers
3
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unleash-client

Unleash Client for Node

  • 6.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
215K
decreased by-12.11%
Maintainers
3
Weekly downloads
Ā 
Created

What is unleash-client?

The unleash-client npm package is a feature toggle system that allows you to control the release of features in your application. It helps you manage feature flags, enabling or disabling features without deploying new code.

What are unleash-client's main functionalities?

Initialize Unleash Client

This code initializes the Unleash client with the necessary configuration, including the URL of the Unleash server, the application name, and the instance ID.

const { UnleashClient } = require('unleash-client');

const unleash = new UnleashClient({
  url: 'http://unleash.herokuapp.com/api/',
  appName: 'my-app',
  instanceId: 'my-instance-id',
});
unleash.start();

Check if a feature is enabled

This code checks if a specific feature toggle (in this case, 'someFeature') is enabled and logs the result.

const isEnabled = unleash.isEnabled('someFeature');
console.log(`Feature is enabled: ${isEnabled}`);

Register custom strategies

This code demonstrates how to register a custom strategy with the Unleash client. Custom strategies allow you to define your own logic for enabling or disabling features.

unleash.on('ready', () => {
  unleash.registerStrategy(new CustomStrategy());
});

class CustomStrategy {
  constructor() {
    this.name = 'custom';
  }

  isEnabled(parameters, context) {
    // Custom logic to determine if the feature is enabled
    return true;
  }
}

Other packages similar to unleash-client

Keywords

FAQs

Package last updated on 08 Nov 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