Flagsmith / flagsmith-nodejs-client

Flagsmith Node JS Client. Flagsmith lets you manage features flags across web, mobile and server side applications. Get builds out faster. Control who has access to new features.

Home Page:https://flagsmith.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use `DefaultFlag`

matthewelwell opened this issue · comments

Both of the following snippets will log out undefined and attempting to instantiate a DefaultFlag object will throw an error, meaning that it's not possible to use the DefaultFlag constructor directly when defining default flag handler logic.

import { DefaultFlag } from "flagsmith-nodejs";

console.log(DefaultFlag);
const Flagsmith = require("flagsmith-nodejs");

console.log(Flagsmith.DefaultFlag);

Note that the current solution is to simply return an object in the same shape as the DefaultFlag class:

const handler = (featureName) => {
    return { value: "foo", enabled: true, isDefault: true }
}