Skip to content
This repository has been archived by the owner on Dec 7, 2021. It is now read-only.

Commit

Permalink
Fixed wrong result when evaluating an expression
Browse files Browse the repository at this point in the history
  • Loading branch information
lelinhtinh committed Aug 18, 2020
1 parent 312518d commit 8a88101
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/js/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var utils = {
str.replace(/(?<!('|"))([+\-*/]*(?<!\w)0x[a-f\d]+[+\-*/]*)+(?!('|"))/gi, (m) => {
const notChain = m.match(/^(([+\-*/]+)((?<!\w)0x[a-f\d]+)|((?<!\w)0x[a-f\d]+)([+\-*/]+))$/i);
if (!notChain) return eval(m);
if (notChain[2]) return notChain[1] + eval(notChain[2]);
return eval(notChain[3]) + notChain[4];
if (notChain[3]) return notChain[2] + eval(notChain[3]);
return eval(notChain[4]) + notChain[5];
}),
};

0 comments on commit 8a88101

Please sign in to comment.