Skip to content

Instantly share code, notes, and snippets.

@DerZyklop DerZyklop/genitive.ts
Last active Sep 6, 2017

Embed
What would you like to do?
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
You can’t perform that action at this time.