Skip to content

Instantly share code, notes, and snippets.

@Bradshaw
Last active March 6, 2021 12:04
Show Gist options
  • Save Bradshaw/7755ca69a9c73214b521f63ffe3c3caf to your computer and use it in GitHub Desktop.
Save Bradshaw/7755ca69a9c73214b521f63ffe3c3caf to your computer and use it in GitHub Desktop.
a8e() - abbreviate everything!
let a8e = s=>s
.split(/([^a-zA-Z])/)
.map(s=>s.length>4 ? s[0]+(s.length-2)+s[s.length-1] : s)
.reduce((a,c)=>a+c)
a8e("abbreviate() for javascript: abbreviate everything!")
// ➡ a8e() for j8t: a8e e8g!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment