mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
Optimized Reused Values for Loops
This commit is contained in:
parent
8ec42ca2e5
commit
234fcb09c2
19 changed files with 91 additions and 54 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue