Skip to content

Commit

Permalink
chore: small code optimisation
Browse files Browse the repository at this point in the history
  • Loading branch information
ergoz committed Oct 28, 2022
1 parent 258a130 commit 21a68fd
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions plural.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,25 @@ type Number interface {
// Noun function to make pluralization for noun
func Noun[n Number](num n, oneWord, twoWord, ThreeWord string) string {
switch getNounPluralForm(num) {
case 0:
return oneWord
case 1:
return twoWord
case 2:
return ThreeWord
default:
return oneWord
}
return ""
}

// Verb function to make pluralization for verb
func Verb[n Number](num n, oneWord, twoWord, ThreeWord string) string {
switch getVerbPluralForm(num) {
case 0:
return oneWord
case 1:
return twoWord
case 2:
return ThreeWord
default:
return oneWord
}
return ""
}

func getNounPluralForm[n Number](a n) int {
Expand Down

0 comments on commit 21a68fd

Please sign in to comment.