Skip to content

Instantly share code, notes, and snippets.

@DerZyklop
Last active September 6, 2017 12:38
Show Gist options
  • Save DerZyklop/2885792ad63110971e2749237fd8f09f to your computer and use it in GitHub Desktop.
Save DerZyklop/2885792ad63110971e2749237fd8f09f to your computer and use it in GitHub Desktop.
Add the correct genitive ending to a given name.
/**
* Add the correct genitive ending to a given name.
*/
private addGenitiveEnding(name : string) : string {
if (name.charAt(name.length - 1).match(/[s|z|ß|x]/)) {
return name + '’';
} else {
return name + 's';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment