ITADN

t2.at is not a function

#3873ClosedLongLoveRong 创建于 2026-01-19
question
L
LongLoveRongcommented
**Marked version:** **Describe the bug** it happens when i use uni-app to develop an ai-chat app.i use this "mark" from the component "up-markdown" which comes from uview-plus. When i use the debugger to detect this error,i notice a function called "inlineTokens",i am sure this function cause this problem.Function .at() is added since ECMAScript 2022,maybe older js compiler cannot read this function? Most interesting thing is when i use debugger mode,this situation did not happen.However,when i use normal mode to compiler my project,it happened. inlineTokens(e3, t2 = []) { var _a2, _b, _c; let n2 = e3, r2 = null; if (this.tokens.links) { let e4 = Object.keys(this.tokens.links); if (e4.length > 0) for (; null != (r2 = this.tokenizer.rules.inline.reflinkSearch.exec(n2)); ) e4.includes(r2[0].slice(r2[0].lastIndexOf("[") + 1, -1)) && (n2 = n2.slice(0, r2.index) + "[" + "a".repeat(r2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)); } for (; null != (r2 = this.tokenizer.rules.inline.anyPunctuation.exec(n2)); ) n2 = n2.slice(0, r2.index) + "++" + n2.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); for (; null != (r2 = this.tokenizer.rules.inline.blockSkip.exec(n2)); ) n2 = n2.slice(0, r2.index) + "[" + "a".repeat(r2[0].length - 2) + "]" + n2.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); let s2 = false, l2 = ""; for (; e3; ) { let r3; if (s2 || (l2 = ""), s2 = false, (_b = (_a2 = this.options.extensions) == null ? void 0 : _a2.inline) == null ? void 0 : _b.some((n3) => !!(r3 = n3.call({ lexer: this }, e3, t2)) && (e3 = e3.substring(r3.raw.length), t2.push(r3), true))) continue; if (r3 = this.tokenizer.escape(e3)) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } if (r3 = this.tokenizer.tag(e3)) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } if (r3 = this.tokenizer.link(e3)) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } if (r3 = this.tokenizer.reflink(e3, this.tokens.links)) { e3 = e3.substring(r3.raw.length); let n3 = t2.at(-1); "text" === r3.type && "text" === (n3 == null ? void 0 : n3.type) ? (n3.raw += r3.raw, n3.text += r3.text) : t2.push(r3); continue; } if (r3 = this.tokenizer.emStrong(e3, n2, l2)) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } if (r3 = this.tokenizer.codespan(e3)) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } if (r3 = this.tokenizer.br(e3)) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } if (r3 = this.tokenizer.del(e3)) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } if (r3 = this.tokenizer.autolink(e3)) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } if (!this.state.inLink && (r3 = this.tokenizer.url(e3))) { e3 = e3.substring(r3.raw.length), t2.push(r3); continue; } let i2 = e3; if ((_c = this.options.extensions) == null ? void 0 : _c.startInline) { let t3, n3 = 1 / 0, r4 = e3.slice(1); this.options.extensions.startInline.forEach((e4) => { t3 = e4.call({ lexer: this }, r4), "number" == typeof t3 && t3 >= 0 && (n3 = Math.min(n3, t3)); }), n3 < 1 / 0 && n3 >= 0 && (i2 = e3.substring(0, n3 + 1)); } if (r3 = this.tokenizer.inlineText(i2)) { e3 = e3.substring(r3.raw.length), "_" !== r3.raw.slice(-1) && (l2 = r3.raw.slice(-1)), s2 = true; let n3 = t2.at(-1); "text" === (n3 == null ? void 0 : n3.type) ? (n3.raw += r3.raw, n3.text += r3.text) : t2.push(r3); } else if (e3) { let t3 = "Infinite loop on byte: " + e3.charCodeAt(0); if (this.options.silent) { console.error(t3); break; } throw new Error(t3); } } return t2; }
关闭于 2026-01-30 1 条评论