mezon-js 2.9.97 → 2.9.99

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.
@@ -716,19 +716,7 @@ function b64DecodeUnicode(str) {
716
716
  }
717
717
  function safeJSONParse(jsonString) {
718
718
  try {
719
- const unescapedJSON = jsonString.replace(/\\./g, (match) => {
720
- switch (match) {
721
- case '\\"':
722
- return '"';
723
- case "\\n":
724
- return "\n";
725
- case "\\t":
726
- return " ";
727
- default:
728
- return match[1];
729
- }
730
- });
731
- const parsedData = JSON.parse(unescapedJSON);
719
+ const parsedData = JSON.parse(jsonString);
732
720
  return parsedData;
733
721
  } catch (error) {
734
722
  console.error("Error parsing JSON:", jsonString, error);
@@ -682,19 +682,7 @@ function b64DecodeUnicode(str) {
682
682
  }
683
683
  function safeJSONParse(jsonString) {
684
684
  try {
685
- const unescapedJSON = jsonString.replace(/\\./g, (match) => {
686
- switch (match) {
687
- case '\\"':
688
- return '"';
689
- case "\\n":
690
- return "\n";
691
- case "\\t":
692
- return " ";
693
- default:
694
- return match[1];
695
- }
696
- });
697
- const parsedData = JSON.parse(unescapedJSON);
685
+ const parsedData = JSON.parse(jsonString);
698
686
  return parsedData;
699
687
  } catch (error) {
700
688
  console.error("Error parsing JSON:", jsonString, error);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.97",
4
+ "version": "2.9.99",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/utils.ts CHANGED
@@ -49,20 +49,8 @@ export function b64DecodeUnicode(str: string) {
49
49
  }
50
50
 
51
51
  export function safeJSONParse(jsonString: string) {
52
- try {
53
- // Step 1: Unescape JSON strings to handle double-escaped characters
54
- const unescapedJSON = jsonString.replace(/\\./g, (match) => {
55
- switch (match) {
56
- case '\\"': return '"';
57
- case '\\n': return '\n';
58
- case '\\t': return '\t';
59
- // Add more escape sequences as needed
60
- default: return match[1]; // Remove the backslash
61
- }
62
- });
63
-
64
- // Step 2: Parse the unescaped JSON
65
- const parsedData = JSON.parse(unescapedJSON);
52
+ try {
53
+ const parsedData = JSON.parse(jsonString);
66
54
 
67
55
  return parsedData;
68
56
  } catch (error) {