Skip to content

Use Number.isNaN instead of global isNaN in saxy XML parser - #1235

Open
pavankumar-vh wants to merge 1 commit into
CodebuffAI:mainfrom
pavankumar-vh:fix/saxy-isnan-type-safety
Open

Use Number.isNaN instead of global isNaN in saxy XML parser#1235
pavankumar-vh wants to merge 1 commit into
CodebuffAI:mainfrom
pavankumar-vh:fix/saxy-isnan-type-safety

Conversation

@pavankumar-vh

Copy link
Copy Markdown

Overview

Fix type safety issue in common/src/util/saxy.ts by using Number.isNaN instead of the global isNaN function.

Bug Description

The global isNaN() function coerces non-numbers to numbers first, which can lead to unexpected results.

Fix

Changed isNaN(value) to Number.isNaN(value) for more predictable and safer type checking.

Testing

No existing tests for this function, but the fix improves type safety.

Files Changed

  • common/src/util/saxy.ts - Use Number.isNaN instead of global isNaN

Scope

This change only touches common/ which is an approved contribution area per the Contributing Guide.

The global isNaN() function coerces non-numbers to numbers first, which can
lead to unexpected results. Using Number.isNaN is more predictable and safer
for type checking.
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.

1 participant