Skip to content
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

[BUG]: min() function doesn't work with a string of numbers only #118

Open
giosifelis opened this issue Jun 9, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@giosifelis
Copy link

Describe the bug

The function min(5) doesn't work if the value is a string of numbers ONLY ie: '123'.

To Reproduce
Steps to reproduce the behavior:

  1. use min(5) with input '123'
  2. the output will be valid:true

Expected behavior
the output on the above example should be valid: false

Solution

change: const val = isNaN(value) ? value.length : parseFloat(value);
to: const val = typeof value === 'string' ? value.length : isNaN(value) ? 0 : parseFloat(value)

@giosifelis giosifelis added the bug Something isn't working label Jun 9, 2024
@giosifelis
Copy link
Author

I just saw multiple issues for this. #103, #88

I have a proposed solution in the description above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants