Skip to content

Commit

Permalink
feat: fix parse JSON
Browse files Browse the repository at this point in the history
  • Loading branch information
AbigailDeng authored and AbigailDeng committed Aug 13, 2024
1 parent 46a3f30 commit 12eb30f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aelf-command",
"version": "0.1.47-beta.11",
"version": "0.1.48",
"description": "A CLI tools for AElf",
"main": "src/index.js",
"type": "module",
Expand Down
3 changes: 3 additions & 0 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ function parseJSON(str = '') {
let result = null;
try {
result = JSON.parse(str);
if (typeof result === 'number' && /^-?\d+(\.\d+)?[eE][+-]?\d+$/.test(String(result))) {
result = str;
}
} catch (e) {
result = str;
}
Expand Down

0 comments on commit 12eb30f

Please sign in to comment.