kubekey/vendor/github.com/gobuffalo/flect/singular_rules.go
github-actions[bot] 4f4b7333b8
Some checks failed
SyncVendor / sync vendor (push) Has been cancelled
Add vendor directory (#2450)
Co-authored-by: ks-ci-bot <ci-bot@kubesphere.io>
Signed-off-by: joyceliu <joyceliu@yunify.com>
2024-11-05 12:04:06 +08:00

27 lines
750 B
Go

package flect
var singularRules = []rule{}
// AddSingular adds a rule that will replace the given suffix with the replacement suffix.
// The name is confusing. This function will be deprecated in the next release.
func AddSingular(ext string, repl string) {
InsertSingularRule(ext, repl)
}
// InsertSingularRule inserts a rule that will replace the given suffix with
// the repl(acement) at the beginning of the list of the singularize rules.
func InsertSingularRule(suffix, repl string) {
singularMoot.Lock()
defer singularMoot.Unlock()
singularRules = append([]rule{{
suffix: suffix,
fn: simpleRuleFunc(suffix, repl),
}}, singularRules...)
singularRules = append([]rule{{
suffix: repl,
fn: noop,
}}, singularRules...)
}