Created
July 14, 2021 01:05
-
-
Save greyivy/dacefb652877497d103afa4552b71405 to your computer and use it in GitHub Desktop.
Piglatinize code golf (w/ capitalization and punctuation)
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
z=/([\s-])/;module.exports=s=>s.split(z).map(x=>z.test(x)?x:(s=>([,b,w,v,c,a]=/^(\W*)(([aeiouAEIOU]?)([a-z]?)[\w]+)(\W*)$/.exec(s),f=w[1],v?`${b}${w}way${a}`:`${b}${f[`to${c?'Low':'Upp'}erCase`]()}${w.slice(2)}${w[0].toLowerCase()}ay${a}`))(x)).join('') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment