Skip to content

Commit

Permalink
fix number validators accidentally returning true for empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
dcastil committed Aug 20, 2023
1 parent 650405d commit ac4fc9e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export function isArbitraryLength(value: string) {
}

export function isNumber(value: string) {
return !Number.isNaN(Number(value))
return Boolean(value) && !Number.isNaN(Number(value))
}

export function isArbitraryNumber(value: string) {
return getIsArbitraryValue(value, 'number', isNumber)
}

export function isInteger(value: string) {
return Number.isInteger(Number(value))
return Boolean(value) && Number.isInteger(Number(value))
}

export function isPercent(value: string) {
Expand Down

0 comments on commit ac4fc9e

Please sign in to comment.