Skip to content

Commit 1d91276

Browse files
authored
Merge pull request #89 from AElfProject/fix/parseJSON
feat: fix parse JSON
2 parents 46a3f30 + 12eb30f commit 1d91276

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aelf-command",
3-
"version": "0.1.47-beta.11",
3+
"version": "0.1.48",
44
"description": "A CLI tools for AElf",
55
"main": "src/index.js",
66
"type": "module",

src/utils/utils.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ function parseJSON(str = '') {
225225
let result = null;
226226
try {
227227
result = JSON.parse(str);
228+
if (typeof result === 'number' && /^-?\d+(\.\d+)?[eE][+-]?\d+$/.test(String(result))) {
229+
result = str;
230+
}
228231
} catch (e) {
229232
result = str;
230233
}

0 commit comments

Comments
 (0)