francescov1 / mongoose-tsgen

A plug-n-play Typescript generator for Mongoose.
105 stars 25 forks source link

Poor Plural to Singular Renaming #79

Closed CodeYimin closed 2 years ago

CodeYimin commented 2 years ago

In the current state, the plugin would rename "Classes" to "Classe" when converting from plural to singular. Clearly classe is not a proper word.

To fix this it's quite simple. Simply check if the word ends with "sses". If yes, remove "es". This would properly rename words like "glasses", "passes", "classes", "masses", etc, while words like "vases", "houses" are still properly renamed, since they end in "ses", not "sses".

There are a few words that don't follow this rule: https://www.thefreedictionary.com/words-that-end-in-sse (I don't even know what any of these words mean) However there are way too many that do: https://www.thefreedictionary.com/words-that-end-in-ss