Skip to content

Commit 529d4a6

Browse files
committed
Fix code3
1 parent 77dd2cd commit 529d4a6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/core.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,11 @@ export async function compress(input, options) {
388388
if (typeof JUSTCstr != 'undefined' && JUSTCstr.length < str.length && str == JSON.stringify(obj)) {
389389
str = JUSTCstr;
390390
code3 = 1;
391-
} else {
391+
} else if (str.startsWith('{') && str.endsWith('}')) {
392392
str = str.slice(1,-1);
393393
code3 = 5;
394394
}
395-
} else if (typeof obj == 'object' && Array.isArray(obj)) {
395+
} else if (typeof obj == 'object' && Array.isArray(obj) && str.startsWith('[') && str.endsWith(']')) {
396396
/* JSON Array (as string) */
397397
str = str.slice(1,-1);
398398
code3 = 3;

0 commit comments

Comments
 (0)