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
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unleash-client

Unleash Client for Node

  • 1.0.0-beta.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
229K
decreased by-6.03%
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 10 Nov 2016

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