New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@featurevisor/sdk

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@featurevisor/sdk

Featurevisor SDK for Node.js and the browser

0.0.4
Source
npm
Version published
Maintainers
1
Created
Source

@featurevisor/sdk

Universal Featurevisor SDK for both Node.js and the browser.

Visit https://featurevisor.com for more information.

Installation

$ npm install --save @featurevisor/sdk

Usage

Initialize the SDK:

import { FeaturevisorSDK } from "@featurevisor/sdk";

const datafileContent = fetch(datafileURL).then((res) => res.json());

const sdk = new FeaturevisorSDK({
  // required
  datafile: datafileContent,

 // optional
 onActivation: (featureKey, variant, attributes, captureAttributes) => {
   console.log(`Feature ${featureKey} activated with variant ${variant}`);
 },
});

API

getVariation

getVariation(featureKey: string, attributes: Attributes): VariationValue

getVariable

getVariable(featureKey: string, variableKey: string, attributes: Attributes): VariableValue

activate

activate(featureKey: string, attributes: Attributes): VariationValue

Same as getVariation, but also calls the onActivation callback.

This is a convenience method meant to be called when you know the User has been exposed to your Feature, and you also want to track the activation.

License

MIT © Fahad Heylaal

Keywords

featurevisor

FAQs

Package last updated on 05 Mar 2023

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