You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
num() accepts values with trailing characters like "10_000", "30s", and "0x10" and returns a truncated number #261
Since #160 switched num() from +input to parseFloat(input) to reject empty strings, num() stops parsing at the first character parseFloat does not recognize instead of rejecting the value.
Actual: cleanEnv succeeds and returns 10, 30, 0, and 1.2.
Expected: cleanEnv should throw an EnvError for malformed numeric strings like "10_000", "30s", and "1.2.3" (and either parse "0x10" as 16 or reject it), matching the README description of num() ("42", "0.23", "1e5"). Checking input.trim() === '' before coercing with Number(input) would reject both empty strings and trailing characters.
Tested on envalid 9.0.0 (main commit 8ab2075), Node v26.13.0.
Activity
af commentedon Nov 10, 2026
@trackoor thanks, #262 should fix this, lmk if there are any cases it doesn't cover
trackoor commentedon Nov 10, 2026
Thanks for the quick fix! #262 covers all the cases I had, closing.