Skip to content

Commit

Permalink
Merge pull request #53 from DrOctavius/main
Browse files Browse the repository at this point in the history
conv bool fixes
  • Loading branch information
DrOctavius authored Apr 27, 2023
2 parents 2eb0e3b + 495c4e7 commit 8dc9126
Showing 1 changed file with 33 additions and 22 deletions.
55 changes: 33 additions & 22 deletions core/helpers/conv/bool.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
package conv

import "strings"

func ParseBool(val interface{}) bool {
switch val {
case true:
return true
case false:
return false
case 1:
return true
case 0:
return false
case "yes":
return true
case "no":
return false
case "true":
return true
case "false":
return false
case "0":
return false
case "1":
return true
switch val.(type) {
case string:
sVal := strings.ToLower(val.(string))
switch sVal {
case "yes":
return true
case "no":
return false
case "true":
return true
case "false":
return false
case "0":
return false
case "1":
return true
default:
return false
}
default:
return false
switch val {
case true:
return true
case false:
return false
case 1:
return true
case 0:
return false
default:
return false
}
}
}

0 comments on commit 8dc9126

Please sign in to comment.