Files
kubesphere/vendor/github.com/gobuffalo/flect/singular_rules.go
hongming fe6c5de00f update dependencies
Signed-off-by: hongming <talonwan@yunify.com>
2021-01-04 15:35:32 +08:00

24 lines
490 B
Go

package flect
var singularRules = []rule{}
// AddSingular adds a rule that will replace the given suffix with the replacement suffix.
func AddSingular(ext string, repl string) {
singularMoot.Lock()
defer singularMoot.Unlock()
singularRules = append(singularRules, rule{
suffix: ext,
fn: func(s string) string {
s = s[:len(s)-len(ext)]
return s + repl
},
})
singularRules = append(singularRules, rule{
suffix: repl,
fn: func(s string) string {
return s
},
})
}