Skip to content

Change DECIMAL_REGEX to support floats that start with a dot #1086

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

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

fabian-hiller
Copy link
Owner

Fix #1072

@Copilot Copilot AI review requested due to automatic review settings March 17, 2025 00:52
Copy link

vercel bot commented Mar 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
valibot ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 17, 2025 0:54am

@fabian-hiller fabian-hiller self-assigned this Mar 17, 2025
@fabian-hiller fabian-hiller added the enhancement New feature or request label Mar 17, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request enhances the DECIMAL_REGEX to support floats that start with a dot, addressing issue #1072.

  • Updates the DECIMAL_REGEX in library/src/regex.ts with a revised regular expression and an ESLint disable comment.
  • Expands the test suite in library/src/actions/decimal/decimal.test.ts to validate floats starting with a dot and with sign prefixes.
  • Updates the changelog in library/CHANGELOG.md to document the changes.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
library/src/regex.ts Updated DECIMAL_REGEX to support floats starting with a dot with an ESLint comment for false positives.
library/src/actions/decimal/decimal.test.ts Added new tests for floats starting with a dot and with a sign; modified test names accordingly.
library/CHANGELOG.md Updated changelog to reflect the change in DECIMAL_REGEX functionality.

Copy link

pkg-pr-new bot commented Mar 17, 2025

Open in Stackblitz

npm i https://pkg.pr.new/valibot@1086

commit: 99939ea

@fabian-hiller fabian-hiller merged commit 1ecfd5b into main Mar 17, 2025
15 checks passed
@fabian-hiller fabian-hiller deleted the feat-change-decimal-regex branch March 17, 2025 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v.decimal() requires a leading zero to be considered a valid decimal
1 participant