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

fix: Return 0 as number flag value instead of undefined #167

Merged
merged 2 commits into from
Jan 14, 2025

Conversation

rolodato
Copy link
Member

Couldn't figure out how to add a test case to https://github.com/Flagsmith/engine-test-data/blob/e43097ee273fa63dbb9589c02f89df3d10b51044/data/environment_n9fbf9h3v4fFgH3U3ngWhb.json - verified manually with the following test:

// test.cjs

const Flagsmith = require('./build/cjs').Flagsmith

const flagsmith = new Flagsmith({
    environmentKey: 'LMVKS7tqAcQrjtsDWLoe7g',
});

const flags = await flagsmith.getEnvironmentFlags();
const value = flags.getFeatureValue('zero');

console.log(value);

Before:

rolodato@rolosmith flagsmith-nodejs-client % bun run build && bun test.cjs
$ rm -rf ./build
$ tsc -b tsconfig.cjs.json tsconfig.esm.json && echo '{"type": "commonjs"}'> build/cjs/package.json
undefined

After:

rolodato@rolosmith flagsmith-nodejs-client % bun run build && bun test.cjs 
$ rm -rf ./build
$ tsc -b tsconfig.cjs.json tsconfig.esm.json && echo '{"type": "commonjs"}'> build/cjs/package.json
0

@rolodato rolodato merged commit d52fbac into main Jan 14, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

2 participants