Fix numeric comparison in evaluate bug#424
Closed
laander wants to merge 3 commits intoreflagcom:mainfrom
Closed
Conversation
Fix numeric comparison in evaluate
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the numeric comparison bug in the Node SDK's evaluation function by correctly converting string representations of numbers to numeric values.
- Updated numeric comparisons in the evaluation function for GT and LT operators.
- Added test cases to validate the fix for numeric comparisons when values are provided as strings.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/flag-evaluation/test/index.test.ts | Added test cases to validate numeric comparisons. |
| packages/flag-evaluation/src/index.ts | Modified GT and LT operators to perform numeric conversions. |
roncohen
approved these changes
Jun 18, 2025
Contributor
Author
|
Superceded by #426 because this PR was created from another remote (forked repo) which meant that GH actions build and test wouldn't run |
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jun 18, 2025
In local evaluation for the Node SDK: Fix numeric comparison for GT/LT operators where casting strings to numbers wasn't being done correctly happen. That could result in situations where "2" > "10" == true Added test case Note: replaces #424 which was created from another remote (forked repo) which meant that GH actions build and test wouldn't run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In local evaluation for the Node SDK:
Fix numeric comparison for GT/LT operators where casting strings to numbers wasn't being done correctly happen.
That could result in situations where
"2" > "10" == trueAdded test case