Fixing issue with Replace All when replacement string includes source string.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Ad5001 2024-10-10 23:56:42 +02:00
parent 52f859349a
commit 54363b25bc
Signed by: Ad5001
GPG key ID: EF45F9C6AFE20160
2 changed files with 2 additions and 5 deletions

View file

@ -64,10 +64,7 @@ function arrayFlatMap(callbackFn, thisArg) {
* @return {String} * @return {String}
*/ */
function stringReplaceAll(from, to) { function stringReplaceAll(from, to) {
let str = this return this.split(from).join(to)
while(str.includes(from))
str = str.replace(from, to)
return str
} }

View file

@ -261,7 +261,7 @@ class LatexAPI extends Module {
throw new EvalError("Unknown operator " + item.value + ".") throw new EvalError("Unknown operator " + item.value + ".")
} }
break break
case Instruction.IOP3: // Thirdiary operator case Instruction.IOP3: // Ternary operator
n3 = nstack.pop() n3 = nstack.pop()
n2 = nstack.pop() n2 = nstack.pop()
n1 = nstack.pop() n1 = nstack.pop()