Skip to content

Commit

Permalink
fix: improve handling of partial ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
markdumay committed Feb 5, 2024
1 parent 97441c1 commit 5b03992
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions layouts/partials/utilities/IsInvalidArgs.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@
{{ $error = true }}
{{ end }}
{{ else if and (or $def.options.min $def.options.max) (in (slice "int" "float" "float64") $actual) }}
{{ if or (lt $val $def.options.min) (gt $val $def.options.max) }}
{{ warnf "[%s] argument '%s': value '%s' out of range [%d, %d]" $structure (string $key) (string $val) $def.options.min $def.options.max}}
{{ if or
(and $def.options.min (lt $val $def.options.min))
(and $def.options.max (gt $val $def.options.max))
}}
{{ $min := (string (or $def.options.min "-")) }}
{{ $max := (string (or $def.options.max "-")) }}
{{ warnf "[%s] argument '%s': value '%s' out of range [%s, %s]" $structure (string $key) (string $val) $min $max }}
{{ $error = true }}
{{ end }}
{{ end }}
Expand Down

0 comments on commit 5b03992

Please sign in to comment.