Optimized Reused Values for Loops

This commit is contained in:
Onyx Azryn 2020-10-10 08:33:24 -05:00
parent 8ec42ca2e5
commit 234fcb09c2
19 changed files with 91 additions and 54 deletions

View file

@ -15,7 +15,8 @@
const basic = !(/[^\u0000-\u007f]/.test(name)); // basic chars and English rules can be applied
// split word into pseudo-syllables
for (let i=-1, syllable = ""; i < name.length; i += (syllable.length||1), syllable = "") {
let nameLength = name.length;
for (let i=-1, syllable = ""; i < nameLength; i += (syllable.length||1), syllable = "") {
let prev = name[i] || ""; // pre-onset letter
let v = 0; // 0 if no vowels in syllable