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

@huddle01/feature-flags

Package Overview
Dependencies
Maintainers
8
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huddle01/feature-flags

Unleash the Power of Controlled Feature Rollouts in Your Typescript Projects

  • 0.0.3-alpha.1
  • alpha
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
8
Weekly downloads
 
Created
Source

Huddle01 Feature Flags

https://huddle01-assets-frontend.s3.amazonaws.com/general/huddle01-logo-blue.svg

Community · Documentation

NOTE: Request for access to the huddle01-client pkg on Huddle01's discord or reach out to the team.

Feature Flags

Feature Flags are necessary for multiple usecases, when you need to hide certain features from the end-user for cases like

  • Paid features specific to clients.
  • Upcoming feature which is still in development so we hide it for incremental dev

Getting flags from Edge Config :

After installing the package, you can fetch the feature flags

import { getEdgeFeatFlags } from '@huddle01/feature-flags';

const featFlags = await getEdgeFeatFlags(configUrl);

console.log({ featFlags });
// Output
{
    "feature-1": {
        enabledFor: ["axit.eth"];
    };
    "feature-2": {
        enabledFor: ["*"]; // enabled for everyone in huddle01 team
    };
}

Syncing Flags to state :

Once you've fetched the feature flags you need to sync them to state which can be done using the useSyncFlags() hook.

import { useSyncFlags } from '@huddle01/feature-flags';

const App = () => {
  useSyncFlags(featFlags);

  return <></>;
};

Using feature flags :

Once you've synced the feature flags you can use a feature flag in the following way:

import { useSyncFlags } from '@huddle01/feature-flags';

const App = () => {
  const { enabledFor, isEnabled } = useFeatureFlag({
    key: 'feature-1',
    address: 'axit.eth',
  });

  console.log({ enabledFor, isEnabled });

  return <></>;
};
// Output
{
  enabledFor: ['axit.eth'];
  isEnabled: true;
}

💡 For more information head to https://huddle01.com/docs

💡 For any help reach out to us on Discord

FAQs

Package last updated on 30 Jan 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