Skip to content

Commit 15d55d7

Browse files
committed
Remove commas when creating token
1 parent 2b1af8b commit 15d55d7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/parser.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ function createToken(buffer: string, type: TokenType) {
2727

2828
if (type === TokenType.NUM) {
2929
// This can happen if users simply type ".", which get parsed as number.
30-
if (isNaN(+buffer)) throw ExprError.invalidExpression();
31-
return new ExprNumber(+buffer);
30+
const numberWithoutCommas = buffer.replace(/,/g, '');
31+
if (isNaN(+numberWithoutCommas)) throw ExprError.invalidExpression();
32+
return new ExprNumber(+numberWithoutCommas);
3233
}
3334

3435
if (type === TokenType.VAR) {

0 commit comments

Comments
 (0)