Uh oh!
There was an error while loading. Please reload this page.
feat(isFloat) Fix , passing as float - #2020
Closed
frederike-ramin wants to merge 1 commit into
Closed
Conversation
Codecov Report
@@ Coverage Diff @@## master #2020 +/- ##
=========================================
Coverage 100.00% 100.00% =========================================
Files 104 104 Lines 2203 2203 Branches 477 477 =========================================
Hits 2203 2203
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
WikiRik
approved these changes
Aug 8, 2022
rubiin
approved these changes
Aug 9, 2022
frederike-ramin
commented
Oct 4, 2022
ContributorAuthor
@rubiin do I still need to do anything to have this PR merged? |
rubiin
commented
Oct 17, 2022
Member
Waiting for further approvals from @profnandaa |
| @@ -5,7 +5,7 @@ export default function isFloat(str, options) { | |||
| assertString(str); | |||
| options = options || {}; | |||
| const float = new RegExp(`^(?:[-+])?(?:[0-9]+)?(?:\\${options.locale ? decimal[options.locale] : '.'}[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$`); | |||
Contributor
There was a problem hiding this comment.
Suggested change
| constfloat=newRegExp(`^(?:[-+])?(?:[0-9]+)?(?:\\${options.locale ? decimal[options.locale] : '.'}[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$`); | |
| // largely derived from ECMAScript, with optional leading sign and allowing unnecessary leading zeroes | |
| // but not underscore separators | |
| // https://tc39.es/ecma262/multipage/ecmascript-language-lexical-grammar.html#prod-DecimalLiteral | |
| constfloat=newRegExp(`^[-+]?(?:[0-9]+|(?=.[0-9]))(?:\\${options.locale ? decimal[options.locale] : '.'}[0-9]*)?(?:[eE][-+]?[0-9]+)?$`); |
(and if you take this suggestion, then the following if is unnecessary)
profnandaa
approved these changes
Feb 1, 2023
profnandaa
commented
Feb 2, 2023
Member
merging in #2164 |
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 freeto 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.
Similar to #752: Only passing
,as string will result in a positive outcome ofisFloat. This simply catches the case similar to.and+etc.Checklist