Skip to content

Normalize x-model boolean parsing for case and whitespace#4754

Closed
utsavsomaiya wants to merge 1 commit intoalpinejs:mainfrom
utsavsomaiya:boolean-parser-trim-case
Closed

Normalize x-model boolean parsing for case and whitespace#4754
utsavsomaiya wants to merge 1 commit intoalpinejs:mainfrom
utsavsomaiya:boolean-parser-trim-case

Conversation

@utsavsomaiya
Copy link

Summary

  • normalize .boolean string parsing in safeParseBoolean by trimming whitespace and lowercasing before token checks
  • keep existing fallback behavior for unknown/non-empty strings
  • add Vitest coverage for mixed-case and whitespace-wrapped boolean tokens
  • document .boolean matching behavior as case-insensitive and whitespace-tolerant

Why

Currently, values like " FALSE " are treated as truthy because string matching is exact. This change makes .boolean parsing more predictable for common user input.

Testing

  • npm run vitest
  • npm run build

@utsavsomaiya utsavsomaiya deleted the boolean-parser-trim-case branch February 28, 2026 02:15
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