stash/pkg/utils/boolean.go

15 lines
260 B
Go
Raw Normal View History

2019-02-11 06:39:21 +00:00
package utils
// Btoi transforms a boolean to an int. 1 for true, false otherwise
2019-02-11 06:39:21 +00:00
func Btoi(b bool) int {
if b {
return 1
}
return 0
}
// IsTrue returns true if the bool pointer is not nil and true.
func IsTrue(b *bool) bool {
return b != nil && *b
}