Last active
March 6, 2021 12:04
-
-
Save Bradshaw/7755ca69a9c73214b521f63ffe3c3caf to your computer and use it in GitHub Desktop.
a8e() - abbreviate everything!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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