Skip to content

Instantly share code, notes, and snippets.

@angrytoast
Created December 24, 2014 06:39
Show Gist options
  • Select an option

  • Save angrytoast/0df57176fa1b4fa89449 to your computer and use it in GitHub Desktop.

Select an option

Save angrytoast/0df57176fa1b4fa89449 to your computer and use it in GitHub Desktop.
JS string transform for english possessive
function(input) {
if(typeof input === 'string') {
input = input.trim();
input = (input.toLowerCase().slice(-1) === 's') ? input + "'" : input + "'s";
}
return input;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment