UNPKG

cpt-waffle-lotide

Version:
12 lines (10 loc) 308 B
const pigLatin = (string:string):string => { const words:string[] = string.split(' '); const result = words.map((word:string) => { const firstLetter:string = word[0]; const subWord:string = word.slice(1); return subWord + firstLetter + 'ay'; }) return result.join(' '); } export default pigLatin;