Skip to content

Instantly share code, notes, and snippets.

@ralt
Forked from Zirak/mk_awsm.js
Last active December 12, 2015 01:29
Show Gist options
  • Save ralt/4691816 to your computer and use it in GitHub Desktop.
Save ralt/4691816 to your computer and use it in GitHub Desktop.
//ths fnctn tks sntnc nd trns t t awsm
//md fr jvscrpt rm
// http://chat.stackoverflow.com/transcript/message/7491494#7491494
var mk_awsm = function(sntnc) {
return sntnc.split(' ').map(function(wrd) {
return 1 >= wrd.length ?
wrd :
2 == wrd.length ?
wrd[0] :
/:.*(.)/.test(wrd) ?
wrd.replace(/:.*(.)/, '$1') :
wrd.split('').map(function(c,i) {
return 0 != i && (
'a' == c ||
'e' == c ||
'o' == c ||
'u' == c ||
'i' == c ||
(1 != i % 2 && .15 > Math.random())
) ?
'' :
c
}).join('')
}).join(' ');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment