mezon-js 2.13.60 → 2.13.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mezon-js.cjs.js +7 -3
- package/dist/mezon-js.esm.mjs +7 -3
- package/package.json +1 -1
- package/utils.ts +7 -3
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -715,11 +715,15 @@ function b64DecodeUnicode(str) {
|
|
|
715
715
|
}
|
|
716
716
|
function safeJSONParse(jsonStr) {
|
|
717
717
|
try {
|
|
718
|
-
|
|
719
|
-
return parsedData;
|
|
718
|
+
return JSON.parse(jsonStr);
|
|
720
719
|
} catch (error) {
|
|
721
720
|
if (jsonStr !== "") {
|
|
722
|
-
|
|
721
|
+
const fixedJsonStr = jsonStr.replace(/\n/g, "\\n");
|
|
722
|
+
try {
|
|
723
|
+
return JSON.parse(fixedJsonStr);
|
|
724
|
+
} catch (e) {
|
|
725
|
+
console.error("Error parsing JSON:", jsonStr, error);
|
|
726
|
+
}
|
|
723
727
|
}
|
|
724
728
|
return { t: jsonStr };
|
|
725
729
|
}
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -681,11 +681,15 @@ function b64DecodeUnicode(str) {
|
|
|
681
681
|
}
|
|
682
682
|
function safeJSONParse(jsonStr) {
|
|
683
683
|
try {
|
|
684
|
-
|
|
685
|
-
return parsedData;
|
|
684
|
+
return JSON.parse(jsonStr);
|
|
686
685
|
} catch (error) {
|
|
687
686
|
if (jsonStr !== "") {
|
|
688
|
-
|
|
687
|
+
const fixedJsonStr = jsonStr.replace(/\n/g, "\\n");
|
|
688
|
+
try {
|
|
689
|
+
return JSON.parse(fixedJsonStr);
|
|
690
|
+
} catch (e) {
|
|
691
|
+
console.error("Error parsing JSON:", jsonStr, error);
|
|
692
|
+
}
|
|
689
693
|
}
|
|
690
694
|
return { t: jsonStr };
|
|
691
695
|
}
|
package/package.json
CHANGED
package/utils.ts
CHANGED
|
@@ -50,11 +50,15 @@ export function b64DecodeUnicode(str: string) {
|
|
|
50
50
|
|
|
51
51
|
export function safeJSONParse(jsonStr: string) {
|
|
52
52
|
try {
|
|
53
|
-
|
|
54
|
-
return parsedData;
|
|
53
|
+
return JSON.parse(jsonStr);
|
|
55
54
|
} catch (error) {
|
|
56
55
|
if (jsonStr !== "") {
|
|
57
|
-
|
|
56
|
+
const fixedJsonStr = jsonStr.replace(/\n/g, "\\n");
|
|
57
|
+
try {
|
|
58
|
+
return JSON.parse(fixedJsonStr);
|
|
59
|
+
} catch (e) {
|
|
60
|
+
console.error('Error parsing JSON:', jsonStr, error);
|
|
61
|
+
}
|
|
58
62
|
}
|
|
59
63
|
return {t: jsonStr}; // Handle the error gracefully or throw an exception if necessary
|
|
60
64
|
}
|