Redmage/views/utils/cx.go

18 lines
369 B
Go
Raw Normal View History

package utils
import "strings"
// CX is a helper function to generate a string of class names based
// on a map of class names and their conditions.
func CX(classes map[string]bool) string {
b := strings.Builder{}
for class, condition := range classes {
if condition {
b.WriteString(class)
b.WriteString(" ")
}
}
2024-05-02 23:22:11 +07:00
return strings.TrimSpace(b.String())
}