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:
- use
min(5) with input '123'
- 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)
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:
min(5)with input'123'valid:trueExpected behavior
the output on the above example should be
valid: falseSolution
change:
const val = isNaN(value) ? value.length : parseFloat(value);to:
const val = typeof value === 'string' ? value.length : isNaN(value) ? 0 : parseFloat(value)