Fix minor issue with fusion name generation

pull/58/head
Flashfyre 2024-04-07 22:56:22 -04:00
parent 87aae2ff1c
commit 4531ef1ff2
1 changed files with 9 additions and 2 deletions

View File

@ -73,8 +73,15 @@ export function getFusedSpeciesName(speciesAName: string, speciesBName: string):
const lastCharA = fragA.slice(fragA.length - 1); const lastCharA = fragA.slice(fragA.length - 1);
const prevCharB = fragBMatch[1].slice(fragBMatch.length - 1); const prevCharB = fragBMatch[1].slice(fragBMatch.length - 1);
fragB = (/[\-']/.test(prevCharB) ? prevCharB : '') + fragBMatch[2] || prevCharB; fragB = (/[\-']/.test(prevCharB) ? prevCharB : '') + fragBMatch[2] || prevCharB;
if (lastCharA === fragB[0] && /[aiu]/.test(lastCharA)) if (lastCharA === fragB[0]) {
fragB = fragB.slice(1); if (/[aiu]/.test(lastCharA))
fragB = fragB.slice(1);
else {
const newCharMatch = new RegExp(`[^${lastCharA}]`).exec(fragB);
if (newCharMatch.index > 0)
fragB = fragB.slice(newCharMatch.index);
}
}
} else } else
fragB = speciesBName; fragB = speciesBName;
} else } else