Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ameer/1b94793573e2a90f2cb05d639bba28c4 to your computer and use it in GitHub Desktop.
Save ameer/1b94793573e2a90f2cb05d639bba28c4 to your computer and use it in GitHub Desktop.
Have you ever seen those very long names which truncated into little ones? Like i18n for Internationalization? Here is a fun function for doing this using j8t (aka JavaScript).
function trimmer(word){
const len = word.length
const number = len - 2
return (word.charAt(0) + number + word.charAt(len - 1)).toLowerCase()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment