diff --git a/flect_test.go b/flect_test.go index 4ab6251..4dd7054 100644 --- a/flect_test.go +++ b/flect_test.go @@ -333,6 +333,7 @@ var singlePluralAssertions = []dict{ {"ID", "IDs", true, true}, {"IDS", "IDSes", true, true}, // id to ids (ID), ids to idses (IDS) is not supported + {"ids", "ids", true, true}, {"api", "apis", true, true}, {"API", "APIs", true, true}, {"html", "htmls", true, true}, @@ -343,6 +344,9 @@ var singlePluralAssertions = []dict{ {"SSH", "SSHs", true, true}, {"eia", "eias", true, true}, // ia {"EIA", "EIAs", true, true}, + {"https", "https", true, true}, + {"HTTPS", "HTTPSes", true, true}, + {"dns", "dns", true, true}, {"DNS", "DNSes", true, true}, } diff --git a/pluralize.go b/pluralize.go index d0ac77d..0eb664a 100644 --- a/pluralize.go +++ b/pluralize.go @@ -59,7 +59,8 @@ func (i Ident) Pluralize() Ident { } for _, r := range pluralRules { - if strings.HasSuffix(s, r.suffix) { + // Acronym parts are normalized to uppercase, so only replace an exact suffix. + if strings.HasSuffix(s, r.suffix) && strings.HasSuffix(i.Original, s) { return i.ReplaceSuffix(s, r.fn(s)) } } diff --git a/singularize.go b/singularize.go index d00cf4f..2f42450 100644 --- a/singularize.go +++ b/singularize.go @@ -56,7 +56,8 @@ func (i Ident) Singularize() Ident { } for _, r := range singularRules { - if strings.HasSuffix(s, r.suffix) { + // Acronym parts are normalized to uppercase, so only replace an exact suffix. + if strings.HasSuffix(s, r.suffix) && strings.HasSuffix(i.Original, s) { return i.ReplaceSuffix(s, r.fn(s)) } }