Skip to content

Instantly share code, notes, and snippets.

View greyivy's full-sized avatar
🌱

Ivy greyivy

🌱
View GitHub Profile
@greyivy
greyivy / piglatinize.js
Created July 14, 2021 01:05
Piglatinize code golf (w/ capitalization and punctuation)
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('')