lbry.go/validator/bool.go
Mark Beamer Jr afffa668a9 -Added API Server to lbry.go
-Removed dependency on internal apis
-Moved over only required packages.
-Adjusted slack.go to be generic instead of hard coding channel name.
-Moved over travis package from internal-apis
-Added Repository struct for webhook and an IsMatch method. It is possible for any repository to send a webhook to the api and it will trigger a deploy. We should check against the owner, repo and branch.
-Renamed package to api
-removed util.Debugging from server.go
-Added an ErrorHandling function that be used as interface for slack for internal-apis
-Added Map for Header settings that can be set before the serving
-Merged slack code from lbryio/boardbot
-Cleaned up the slack.go code so it made more sense and flowed better
-Removed gitignore entry for `.idea`, should be global
-Removed debugging.go
-Added option for private vs public repository for getting travis public key.
-separated private vs public into if else.
-Changed HeaderSettings to not be pointer.
-Changed ErrorHandler to be named LogErrorFunc
-removed logrus dependency, created loginfo function to handle non-error information.
-Added Daemon Types and adjusted peer_list to be in line with v20
-Fixed rpcclient library usage for latest version to prevent build errors.
-Changed inputs to LogError and LogInfo so that other implementations can make this customizable.
2018-05-27 11:30:04 -04:00

34 lines
602 B
Go

package validator
var (
truthyValues = []string{"1", "yes", "y", "true"}
falseyValues = []string{"0", "no", "n", "false"}
)
// todo: consider using strconv.ParseBool instead
func IsTruthy(value string) bool {
for _, e := range truthyValues {
if e == value {
return true
}
}
return false
}
func IsFalsey(value string) bool {
for _, e := range falseyValues {
if e == value {
return true
}
}
return false
}
func IsBoolString(value string) bool {
return IsTruthy(value) || IsFalsey(value)
}
func GetBoolStringValues() []string {
return append(truthyValues, falseyValues...)
}