Files
kubesphere/vendor/github.com/gobuffalo/flect/singular_rules.go
KubeSphere CI Bot 447a51f08b feat: kubesphere 4.0 (#6115)
* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

* feat: kubesphere 4.0

Signed-off-by: ci-bot <ci-bot@kubesphere.io>

---------

Signed-off-by: ci-bot <ci-bot@kubesphere.io>
Co-authored-by: ks-ci-bot <ks-ci-bot@example.com>
Co-authored-by: joyceliu <joyceliu@yunify.com>
2024-09-06 11:05:52 +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...)
}