Let's try mozilla's fixedCharAt function

master
Chloe Fontenot 🏳️‍⚧️ 2023-04-30 22:56:54 +07:00
parent e0b3279cc1
commit 025ee853b0
1 changed files with 21 additions and 30 deletions

@ -217,25 +217,16 @@ function charIterate(input) {
let temp = input.split('');
for (let i = 0; i < stringLength; ++i) {
let compareString = temp.join("");
//console.log(surrogatePairs.exec(compareString), compareString);
let stringEval = undefined, stringEvalIndex = undefined;
try {
while ((stringEval = surrogatePairs.exec(compareString)) !== null) {
stringEvalIndex = stringEval.index;
//console.log("emoji is at index", stringEvalIndex);
}
} catch (e) {
console.log(e);
console.log("Handling exception...");
}
if (stringEvalIndex == i) {
stringLength--;
temp.splice(i, 1);
//console.log("Decreasing stringLength variable to", stringLength);
}
}
if (charIterateState == undefined) {
console.log("undefined! setting to zero");
@ -299,7 +290,7 @@ function design5(input) {
outputLine += fixedCharAt(input, charIterate(input)) + space + input + space + spaceOffset + fixedCharAt(input, charIterate(input));
}
//console.log(i, j, outputLine);
console.log(i, j, outputLine);
if (lineHasInput) {
outputString += outputLine + "\n";
}