Sha256: 818e22a4da281a11e91c957d068831fff7a03b573c3c85a133edb63e9dc1a414
Contents?: true
Size: 521 Bytes
Versions: 141
Compression:
Stored size: 521 Bytes
Contents
'use strict'; module.exports = { translate: function (english) { var words = english.split(' '); var translated = []; function translateWord(word) { var parts = word.match(/^([^aeiou]?qu|[^aeiou]*)(.+)/); var beginning = parts[1]; var ending = parts[2]; if (beginning.length === 0) { translated.push(word + 'ay'); } else { translated.push(ending + beginning + 'ay'); } } words.forEach( translateWord ); return translated.join(' '); } };
Version data entries
141 entries across 141 versions & 1 rubygems
Version | Path |
---|---|
trackler-2.2.1.38 | tracks/javascript/exercises/pig-latin/example.js |