badprofanity/common/common.go

21 lines
380 B
Go

package common
type TransformFunc func(string) []string
func FlattenTransformFunc(tx []TransformFunc) TransformFunc {
return func(s string) []string {
out := make([]string, len(tx)^2)
for _, t := range tx {
ans := t(s)
for _, t2 := range tx {
for _, v := range ans {
out = append(out, t2(v)...)
}
}
out = append(out, ans...)
}
return out
}
}