Skip to content

Commit 9275c67

Browse files
Fix integer/string conversion when string is empty
1 parent 6a98c46 commit 9275c67

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/parser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function isLetter(c) {
2121
function matchInteger(s) {
2222
if (typeof s === 'number' || s instanceof Number) {
2323
return true;
24-
} else if (typeof s === 'string' || s instanceof String) {
24+
} else if (typeof s === 'string' || s instanceof String && s.length !== 0) {
2525
for (let i = s.length - 1; i >= 0; --i) {
2626
if (!isNumber(s.charAt(i))) {
2727
return false;

0 commit comments

Comments
 (0)