Skip to content

Commit

Permalink
fix set validation for ints
Browse files Browse the repository at this point in the history
  • Loading branch information
danielecook committed Jun 30, 2020
1 parent 06757d8 commit 251ebc2
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/validate/sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,29 @@ func any(args ...interface{}) (interface{}, error) {
subVal, ok := val.([]interface{})
if ok {
for _, i := range subVal {
if args[0] == i {
return (bool)(true), nil
switch v := i.(type) {
// Handle integer comparison cases
case int:
if int64(args[0].(float64)) == int64(v) {
return (bool)(true), nil
}
default:
if args[0] == i {
return (bool)(true), nil
}
}
}
}
if args[0] == val {
return (bool)(true), nil
switch v := args[0].(type) {
// Handle integer comparison cases
case int:
if int64(args[0].(float64)) == int64(v) {
return (bool)(true), nil
}
default:
if args[0] == val {
return (bool)(true), nil
}
}
}
return (bool)(false), nil
Expand Down

0 comments on commit 251ebc2

Please sign in to comment.