roboto-js 1.4.45 → 1.4.46

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.
@@ -151,8 +151,14 @@ var RbtUser = exports["default"] = /*#__PURE__*/function () {
151
151
  value: function _deepUnpackJson(value) {
152
152
  if (typeof value === 'string') {
153
153
  try {
154
- var parsed = JSON.parse(value);
155
- return this._deepUnpackJson(parsed); // Recursively parse if the result is a string, object, or array
154
+ // Only parse as JSON if it's not a large number
155
+ // https://chatgpt.com/c/6745902c-edf4-800c-ab52-31bf27dde2bd
156
+ //
157
+ if (!/^\d{16,}$/.test(value)) {
158
+ var parsed = JSON.parse(value);
159
+ // Recursively parse if the result is a string, object, or array
160
+ return this._deepUnpackJson(parsed);
161
+ }
156
162
  } catch (e) {
157
163
  return value; // Return the original string if parsing fails
158
164
  }
@@ -92,8 +92,14 @@ export default class RbtUser {
92
92
  _deepUnpackJson(value) {
93
93
  if (typeof value === 'string') {
94
94
  try {
95
- const parsed = JSON.parse(value);
96
- return this._deepUnpackJson(parsed); // Recursively parse if the result is a string, object, or array
95
+ // Only parse as JSON if it's not a large number
96
+ // https://chatgpt.com/c/6745902c-edf4-800c-ab52-31bf27dde2bd
97
+ //
98
+ if (!/^\d{16,}$/.test(value)) {
99
+ const parsed = JSON.parse(value);
100
+ // Recursively parse if the result is a string, object, or array
101
+ return this._deepUnpackJson(parsed);
102
+ }
97
103
  } catch (e) {
98
104
  return value; // Return the original string if parsing fails
99
105
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roboto-js",
3
- "version": "1.4.45",
3
+ "version": "1.4.46",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/cjs/index.cjs",
package/src/rbt_user.js CHANGED
@@ -112,8 +112,15 @@ export default class RbtUser {
112
112
  _deepUnpackJson(value){
113
113
  if (typeof value === 'string') {
114
114
  try {
115
- const parsed = JSON.parse(value);
116
- return this._deepUnpackJson(parsed); // Recursively parse if the result is a string, object, or array
115
+
116
+ // Only parse as JSON if it's not a large number
117
+ // https://chatgpt.com/c/6745902c-edf4-800c-ab52-31bf27dde2bd
118
+ //
119
+ if (!/^\d{16,}$/.test(value)) {
120
+ const parsed = JSON.parse(value);
121
+ // Recursively parse if the result is a string, object, or array
122
+ return this._deepUnpackJson(parsed);
123
+ }
117
124
  } catch (e) {
118
125
  return value; // Return the original string if parsing fails
119
126
  }