Skip to content

Commit

Permalink
fix: template string compare issue
Browse files Browse the repository at this point in the history
  • Loading branch information
An0nie committed Apr 27, 2023
1 parent 3f9dc03 commit 6aacf77
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/javascript/JavascriptParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,11 +545,13 @@ class JavascriptParser extends Parser {
const rightSuffix = getSuffix(right.parts);
const lenPrefix = Math.min(leftPrefix.length, rightPrefix.length);
const lenSuffix = Math.min(leftSuffix.length, rightSuffix.length);
if (
leftPrefix.slice(0, lenPrefix) !==
rightPrefix.slice(0, lenPrefix) ||
leftSuffix.slice(-lenSuffix) !== rightSuffix.slice(-lenSuffix)
) {
const prefixMismatch =
lenPrefix > 0 &&
leftPrefix.slice(0, lenPrefix) !== rightPrefix.slice(0, lenPrefix);
const suffixMismatch =
lenSuffix > 0 &&
leftSuffix.slice(-lenSuffix) !== rightSuffix.slice(-lenSuffix);
if (prefixMismatch || suffixMismatch) {
return res
.setBoolean(!eql)
.setSideEffects(
Expand Down

0 comments on commit 6aacf77

Please sign in to comment.