Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use DefaultFlag #115

Open
matthewelwell opened this issue Mar 9, 2023 · 1 comment
Open

Cannot use DefaultFlag #115

matthewelwell opened this issue Mar 9, 2023 · 1 comment

Comments

@matthewelwell
Copy link
Contributor

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);
@matthewelwell
Copy link
Contributor Author

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 }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant