@org-quicko/core 2.0.0 → 2.0.2

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.
@@ -99,6 +99,12 @@ class JSONArray extends Array {
99
99
  super();
100
100
  if (array) {
101
101
  for (let item of Object.values(array)) {
102
+ // Handle undefined BEFORE JSON.parse to prevent crash
103
+ // JSON.stringify(undefined) returns "undefined" which is not valid JSON
104
+ if (item === undefined) {
105
+ this.push(undefined);
106
+ continue;
107
+ }
102
108
  item = JSON.parse(JSON.stringify(item));
103
109
  if (item == null) {
104
110
  this.push(item);
@@ -1 +1 @@
1
- {"version":3,"file":"JSONObject.js","sources":["../../../src/types/JSONObject.ts"],"sourcesContent":["import { BaseException, IllegalArgumentException } from '../exceptions';\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | null\n | undefined\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n | Object\n\nexport class JSONObject extends Map<string, JSONValue> {\n\n\n constructor(object?: { [x: string]: JSONValue }) {\n super()\n if (object) {\n for (const [key, value] of Object.entries(object)) {\n if (value === null || value === undefined) {\n // ignore\n } else if (value.constructor == Object) {\n this.set(key, new JSONObject(value as { [x: string]: JSONValue }));\n } else if (value.constructor == Array) {\n this.set(key, new JSONArray(value));\n } else {\n this.set(key, value)\n }\n }\n }\n\n\n }\n\n getJSONObject(key: string): JSONObject {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONObject) {\n return super.get(key) as JSONObject\n } else {\n throw new IllegalArgumentException('Value cannot be converted to JSONObject')\n }\n }\n\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getString(key: string): string {\n if (super.has(key)) {\n try {\n if (typeof super.get(key) === 'string') {\n return super.get(key) as string;\n }\n\n throw new IllegalArgumentException('Value cannot be converted to string')\n } catch (e) {\n throw new IllegalArgumentException('Value cannot be converted to string', e)\n }\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getNumber(key: string): number {\n if (super.has(key)) {\n const number = Number(super.get(key));\n if (!isNaN(number)) {\n return number;\n }\n throw new IllegalArgumentException('Value cannot be converted to number')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getBoolean(key: string): boolean {\n if (super.has(key)) {\n if (typeof super.get(key) === 'boolean') {\n return super.get(key) as boolean;\n } else if (super.get(key) === 'true' || super.get(key) === 'false') {\n return Boolean(super.get(key));\n }\n throw new IllegalArgumentException('Value cannot be converted to boolean')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getArray(key: string): JSONArray {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONArray) {\n return super.get(key) as JSONArray;\n }\n else if (super.get(key) instanceof Array) {\n return new JSONArray(super.get(key) as Array<JSONValue>);\n }\n throw new IllegalArgumentException('Value cannot be converted to array')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n public toJSON(): { [x: string]: JSONValue } {\n const obj: { [x: string]: JSONValue } = {};\n for (const [key, value] of this.entries()) {\n if (value == null) {\n obj[key] = value;\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n obj[key] = value.toJSON();\n } else {\n obj[key] = value\n }\n }\n return obj;\n }\n}\n\n\nexport class JSONArray extends Array<JSONValue> {\n\n constructor(array?: Array<JSONValue>) {\n super();\n if (array) {\n for (let item of Object.values(array)) {\n item = JSON.parse(JSON.stringify(item))\n\n if (item == null) {\n this.push(item);\n }\n else if (item.constructor == Object) {\n this.push(new JSONObject(item as { [x: string]: JSONValue }));\n }\n else if (item.constructor == Array) {\n this.push(new JSONArray(item));\n }\n else {\n this.push(item)\n }\n }\n }\n }\n\n public toJSON(): Array<JSONValue> {\n const arr: Array<JSONValue> = [];\n for (const value of this) {\n if (value == null) {\n arr.push(value);\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n arr.push(value.toJSON());\n } else {\n arr.push(value)\n }\n }\n return arr;\n }\n}"],"names":[],"mappings":";;;AAWM,MAAO,UAAW,SAAQ,GAAsB,CAAA;AAGlD,IAAA,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C,IAAI,CAAC,CAAC;AAEvC,gBAAA,IAAI,IAAI,IAAI,IAAI,EAAE;AACd,oBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnB;AACK,qBAAA,IAAI,IAAI,CAAC,WAAW,IAAI,MAAM,EAAE;oBACjC,IAAI,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAkC,CAAC,CAAC;gBACjE;AACK,qBAAA,IAAI,IAAI,CAAC,WAAW,IAAI,KAAK,EAAE;oBAChC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;gBAClC;qBACK;AACD,oBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnB;YACJ;QACJ;IACJ;IAEO,MAAM,GAAA;QACT,MAAM,GAAG,GAAqB,EAAE;AAChC,QAAA,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE;AACtB,YAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACf,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;iBAAO,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,SAAS,EAAE;gBAClE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5B;iBAAO;AACH,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;QACJ;AACA,QAAA,OAAO,GAAG;IACd;AACH;;;;"}
1
+ {"version":3,"file":"JSONObject.js","sources":["../../../src/types/JSONObject.ts"],"sourcesContent":["import { BaseException, IllegalArgumentException } from '../exceptions';\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | null\n | undefined\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n | Object\n\nexport class JSONObject extends Map<string, JSONValue> {\n\n constructor(object?: { [x: string]: JSONValue }) {\n super()\n if (object) {\n for (const [key, value] of Object.entries(object)) {\n if (value === null || value === undefined) {\n // ignore\n } else if (value.constructor == Object) {\n this.set(key, new JSONObject(value as { [x: string]: JSONValue }));\n } else if (value.constructor == Array) {\n this.set(key, new JSONArray(value));\n } else {\n this.set(key, value)\n }\n }\n }\n }\n\n getJSONObject(key: string): JSONObject {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONObject) {\n return super.get(key) as JSONObject\n } else {\n throw new IllegalArgumentException('Value cannot be converted to JSONObject')\n }\n }\n\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getString(key: string): string {\n if (super.has(key)) {\n try {\n if (typeof super.get(key) === 'string') {\n return super.get(key) as string;\n }\n\n throw new IllegalArgumentException('Value cannot be converted to string')\n } catch (e) {\n throw new IllegalArgumentException('Value cannot be converted to string', e)\n }\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getNumber(key: string): number {\n if (super.has(key)) {\n const number = Number(super.get(key));\n if (!isNaN(number)) {\n return number;\n }\n throw new IllegalArgumentException('Value cannot be converted to number')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getBoolean(key: string): boolean {\n if (super.has(key)) {\n if (typeof super.get(key) === 'boolean') {\n return super.get(key) as boolean;\n } else if (super.get(key) === 'true' || super.get(key) === 'false') {\n return Boolean(super.get(key));\n }\n throw new IllegalArgumentException('Value cannot be converted to boolean')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getArray(key: string): JSONArray {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONArray) {\n return super.get(key) as JSONArray;\n }\n else if (super.get(key) instanceof Array) {\n return new JSONArray(super.get(key) as Array<JSONValue>);\n }\n throw new IllegalArgumentException('Value cannot be converted to array')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n public toJSON(): { [x: string]: JSONValue } {\n const obj: { [x: string]: JSONValue } = {};\n for (const [key, value] of this.entries()) {\n if (value == null) {\n obj[key] = value;\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n obj[key] = value.toJSON();\n } else {\n obj[key] = value\n }\n }\n return obj;\n }\n}\n\n\nexport class JSONArray extends Array<JSONValue> {\n\n constructor(array?: Array<JSONValue>) {\n super();\n if (array) {\n for (let item of Object.values(array)) {\n // Handle undefined BEFORE JSON.parse to prevent crash\n // JSON.stringify(undefined) returns \"undefined\" which is not valid JSON\n if (item === undefined) {\n this.push(undefined);\n continue;\n }\n\n item = JSON.parse(JSON.stringify(item))\n\n if (item == null) {\n this.push(item);\n }\n else if (item.constructor == Object) {\n this.push(new JSONObject(item as { [x: string]: JSONValue }));\n }\n else if (item.constructor == Array) {\n this.push(new JSONArray(item));\n }\n else {\n this.push(item)\n }\n }\n }\n }\n\n public toJSON(): Array<JSONValue> {\n const arr: Array<JSONValue> = [];\n for (const value of this) {\n if (value == null) {\n arr.push(value);\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n arr.push(value.toJSON());\n } else {\n arr.push(value)\n }\n }\n return arr;\n }\n}"],"names":[],"mappings":";;;AAWM,MAAO,UAAW,SAAQ,GAAsB,CAAA;AAElD,IAAA,WAAA,CAAY,MAAmC,EAAA;AAC3C,QAAA,KAAK,EAAE;QACP,IAAI,MAAM,EAAE;AACR,YAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AAEpC,qBAAA,IAAI,KAAK,CAAC,WAAW,IAAI,MAAM,EAAE;oBACpC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,KAAmC,CAAC,CAAC;gBACtE;AAAO,qBAAA,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,EAAE;oBACnC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;gBACvC;qBAAO;AACH,oBAAA,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;gBACxB;YACJ;QACJ;IACJ;AAEA,IAAA,aAAa,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MAAM,KAAK,IAAI,IAAI,EAAE;AACtB,YAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACf,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;iBAAO,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,SAAS,EAAE;gBAClE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5B;iBAAO;AACH,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;QACJ;AACA,QAAA,OAAO,GAAG;IACd;AACH;;;;"}
@@ -101,6 +101,12 @@ class JSONArray extends Array {
101
101
  super();
102
102
  if (array) {
103
103
  for (let item of Object.values(array)) {
104
+ // Handle undefined BEFORE JSON.parse to prevent crash
105
+ // JSON.stringify(undefined) returns "undefined" which is not valid JSON
106
+ if (item === undefined) {
107
+ this.push(undefined);
108
+ continue;
109
+ }
104
110
  item = JSON.parse(JSON.stringify(item));
105
111
  if (item == null) {
106
112
  this.push(item);
@@ -1 +1 @@
1
- {"version":3,"file":"JSONObject.cjs","sources":["../../../src/types/JSONObject.ts"],"sourcesContent":["import { BaseException, IllegalArgumentException } from '../exceptions';\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | null\n | undefined\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n | Object\n\nexport class JSONObject extends Map<string, JSONValue> {\n\n\n constructor(object?: { [x: string]: JSONValue }) {\n super()\n if (object) {\n for (const [key, value] of Object.entries(object)) {\n if (value === null || value === undefined) {\n // ignore\n } else if (value.constructor == Object) {\n this.set(key, new JSONObject(value as { [x: string]: JSONValue }));\n } else if (value.constructor == Array) {\n this.set(key, new JSONArray(value));\n } else {\n this.set(key, value)\n }\n }\n }\n\n\n }\n\n getJSONObject(key: string): JSONObject {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONObject) {\n return super.get(key) as JSONObject\n } else {\n throw new IllegalArgumentException('Value cannot be converted to JSONObject')\n }\n }\n\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getString(key: string): string {\n if (super.has(key)) {\n try {\n if (typeof super.get(key) === 'string') {\n return super.get(key) as string;\n }\n\n throw new IllegalArgumentException('Value cannot be converted to string')\n } catch (e) {\n throw new IllegalArgumentException('Value cannot be converted to string', e)\n }\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getNumber(key: string): number {\n if (super.has(key)) {\n const number = Number(super.get(key));\n if (!isNaN(number)) {\n return number;\n }\n throw new IllegalArgumentException('Value cannot be converted to number')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getBoolean(key: string): boolean {\n if (super.has(key)) {\n if (typeof super.get(key) === 'boolean') {\n return super.get(key) as boolean;\n } else if (super.get(key) === 'true' || super.get(key) === 'false') {\n return Boolean(super.get(key));\n }\n throw new IllegalArgumentException('Value cannot be converted to boolean')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getArray(key: string): JSONArray {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONArray) {\n return super.get(key) as JSONArray;\n }\n else if (super.get(key) instanceof Array) {\n return new JSONArray(super.get(key) as Array<JSONValue>);\n }\n throw new IllegalArgumentException('Value cannot be converted to array')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n public toJSON(): { [x: string]: JSONValue } {\n const obj: { [x: string]: JSONValue } = {};\n for (const [key, value] of this.entries()) {\n if (value == null) {\n obj[key] = value;\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n obj[key] = value.toJSON();\n } else {\n obj[key] = value\n }\n }\n return obj;\n }\n}\n\n\nexport class JSONArray extends Array<JSONValue> {\n\n constructor(array?: Array<JSONValue>) {\n super();\n if (array) {\n for (let item of Object.values(array)) {\n item = JSON.parse(JSON.stringify(item))\n\n if (item == null) {\n this.push(item);\n }\n else if (item.constructor == Object) {\n this.push(new JSONObject(item as { [x: string]: JSONValue }));\n }\n else if (item.constructor == Array) {\n this.push(new JSONArray(item));\n }\n else {\n this.push(item)\n }\n }\n }\n }\n\n public toJSON(): Array<JSONValue> {\n const arr: Array<JSONValue> = [];\n for (const value of this) {\n if (value == null) {\n arr.push(value);\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n arr.push(value.toJSON());\n } else {\n arr.push(value)\n }\n }\n return arr;\n }\n}"],"names":["IllegalArgumentException","BaseException"],"mappings":";;;;;AAWM,MAAO,UAAW,SAAQ,GAAsB,CAAA;AAGlD,IAAA,WAAA,CAAY,MAAmC,EAAA;AAC3C,QAAA,KAAK,EAAE;QACP,IAAI,MAAM,EAAE;AACR,YAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AAEpC,qBAAA,IAAI,KAAK,CAAC,WAAW,IAAI,MAAM,EAAE;oBACpC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,KAAmC,CAAC,CAAC;gBACtE;AAAO,qBAAA,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,EAAE;oBACnC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;gBACvC;qBAAO;AACH,oBAAA,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;gBACxB;YACJ;QACJ;IAGJ;AAEA,IAAA,aAAa,CAAC,GAAW,EAAA;AACrB,QAAA,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YAChB,IAAI,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,YAAY,UAAU,EAAE;AACtC,gBAAA,OAAO,KAAK,CAAC,GAAG,CAAC,GAAG,CAAe;YACvC;iBAAO;AACH,gBAAA,MAAM,IAAIA,iDAAwB,CAAC,yCAAyC,CAAC;YACjF;QACJ;AAEA,QAAA,MAAM,IAAIC,2BAAa,CAAC,mBA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],"sourcesContent":["import { BaseException, IllegalArgumentException } from '../exceptions';\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | null\n | undefined\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n | Object\n\nexport class JSONObject extends Map<string, JSONValue> {\n\n constructor(object?: { [x: string]: JSONValue }) {\n super()\n if (object) {\n for (const [key, value] of Object.entries(object)) {\n if (value === null || value === undefined) {\n // ignore\n } else if (value.constructor == Object) {\n this.set(key, new JSONObject(value as { [x: string]: JSONValue }));\n } else if (value.constructor == Array) {\n this.set(key, new JSONArray(value));\n } else {\n this.set(key, value)\n }\n }\n }\n }\n\n getJSONObject(key: string): JSONObject {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONObject) {\n return super.get(key) as JSONObject\n } else {\n throw new IllegalArgumentException('Value cannot be converted to JSONObject')\n }\n }\n\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getString(key: string): string {\n if (super.has(key)) {\n try {\n if (typeof super.get(key) === 'string') {\n return super.get(key) as string;\n }\n\n throw new IllegalArgumentException('Value cannot be converted to string')\n } catch (e) {\n throw new IllegalArgumentException('Value cannot be converted to string', e)\n }\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getNumber(key: string): number {\n if (super.has(key)) {\n const number = Number(super.get(key));\n if (!isNaN(number)) {\n return number;\n }\n throw new IllegalArgumentException('Value cannot be converted to number')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getBoolean(key: string): boolean {\n if (super.has(key)) {\n if (typeof super.get(key) === 'boolean') {\n return super.get(key) as boolean;\n } else if (super.get(key) === 'true' || super.get(key) === 'false') {\n return Boolean(super.get(key));\n }\n throw new IllegalArgumentException('Value cannot be converted to boolean')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getArray(key: string): JSONArray {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONArray) {\n return super.get(key) as JSONArray;\n }\n else if (super.get(key) instanceof Array) {\n return new JSONArray(super.get(key) as Array<JSONValue>);\n }\n throw new IllegalArgumentException('Value cannot be converted to array')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n public toJSON(): { [x: string]: JSONValue } {\n const obj: { [x: string]: JSONValue } = {};\n for (const [key, value] of this.entries()) {\n if (value == null) {\n obj[key] = value;\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n obj[key] = value.toJSON();\n } else {\n obj[key] = value\n }\n }\n return obj;\n }\n}\n\n\nexport class JSONArray extends Array<JSONValue> {\n\n constructor(array?: Array<JSONValue>) {\n super();\n if (array) {\n for (let item of Object.values(array)) {\n // Handle undefined BEFORE JSON.parse to prevent crash\n // JSON.stringify(undefined) returns \"undefined\" which is not valid JSON\n if (item === undefined) {\n this.push(undefined);\n continue;\n }\n\n item = JSON.parse(JSON.stringify(item))\n\n if (item == null) {\n this.push(item);\n }\n else if (item.constructor == Object) {\n this.push(new JSONObject(item as { [x: string]: JSONValue }));\n }\n else if (item.constructor == Array) {\n this.push(new JSONArray(item));\n }\n else {\n this.push(item)\n }\n }\n }\n }\n\n public toJSON(): Array<JSONValue> {\n const arr: Array<JSONValue> = [];\n for (const value of this) {\n if (value == null) {\n arr.push(value);\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n arr.push(value.toJSON());\n } else {\n arr.push(value)\n }\n }\n return arr;\n }\n}"],"names":["IllegalArgumentException","BaseException"],"mappings":";;;;;AAWM,MAAO,UAAW,SAAQ,GAAsB,CAAA;AAElD,IAAA,WAAA,CAAY,MAAmC,EAAA;AAC3C,QAAA,KAAK,EAAE;QACP,IAAI,MAAM,EAAE;AACR,YAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AAEpC,qBAAA,IAAI,KAAK,CAAC,WAAW,IAAI,MAAM,EAAE;oBACpC,IAAI,CAAC,GAAG,C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AI,CAAC,IAAI,UAAU,CAAC,IAAkC,CAAC,CAAC;gBACjE;AACK,qBAAA,IAAI,IAAI,CAAC,WAAW,IAAI,KAAK,EAAE;oBAChC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;gBAClC;qBACK;AACD,oBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnB;YACJ;QACJ;IACJ;IAEO,MAAM,GAAA;QACT,MAAM,GAAG,GAAqB,EAAE;AAChC,QAAA,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE;AACtB,YAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACf,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;iBAAO,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,SAAS,EAAE;gBAClE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5B;iBAAO;AACH,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;QACJ;AACA,QAAA,OAAO,GAAG;IACd;AACH;;;;;"}
@@ -99,6 +99,12 @@ class JSONArray extends Array {
99
99
  super();
100
100
  if (array) {
101
101
  for (let item of Object.values(array)) {
102
+ // Handle undefined BEFORE JSON.parse to prevent crash
103
+ // JSON.stringify(undefined) returns "undefined" which is not valid JSON
104
+ if (item === undefined) {
105
+ this.push(undefined);
106
+ continue;
107
+ }
102
108
  item = JSON.parse(JSON.stringify(item));
103
109
  if (item == null) {
104
110
  this.push(item);
@@ -1 +1 @@
1
- {"version":3,"file":"JSONObject.js","sources":["../../../src/types/JSONObject.ts"],"sourcesContent":["import { BaseException, IllegalArgumentException } from '../exceptions';\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | null\n | undefined\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n | Object\n\nexport class JSONObject extends Map<string, JSONValue> {\n\n\n constructor(object?: { [x: string]: JSONValue }) {\n super()\n if (object) {\n for (const [key, value] of Object.entries(object)) {\n if (value === null || value === undefined) {\n // ignore\n } else if (value.constructor == Object) {\n this.set(key, new JSONObject(value as { [x: string]: JSONValue }));\n } else if (value.constructor == Array) {\n this.set(key, new JSONArray(value));\n } else {\n this.set(key, value)\n }\n }\n }\n\n\n }\n\n getJSONObject(key: string): JSONObject {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONObject) {\n return super.get(key) as JSONObject\n } else {\n throw new IllegalArgumentException('Value cannot be converted to JSONObject')\n }\n }\n\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getString(key: string): string {\n if (super.has(key)) {\n try {\n if (typeof super.get(key) === 'string') {\n return super.get(key) as string;\n }\n\n throw new IllegalArgumentException('Value cannot be converted to string')\n } catch (e) {\n throw new IllegalArgumentException('Value cannot be converted to string', e)\n }\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getNumber(key: string): number {\n if (super.has(key)) {\n const number = Number(super.get(key));\n if (!isNaN(number)) {\n return number;\n }\n throw new IllegalArgumentException('Value cannot be converted to number')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getBoolean(key: string): boolean {\n if (super.has(key)) {\n if (typeof super.get(key) === 'boolean') {\n return super.get(key) as boolean;\n } else if (super.get(key) === 'true' || super.get(key) === 'false') {\n return Boolean(super.get(key));\n }\n throw new IllegalArgumentException('Value cannot be converted to boolean')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getArray(key: string): JSONArray {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONArray) {\n return super.get(key) as JSONArray;\n }\n else if (super.get(key) instanceof Array) {\n return new JSONArray(super.get(key) as Array<JSONValue>);\n }\n throw new IllegalArgumentException('Value cannot be converted to array')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n public toJSON(): { [x: string]: JSONValue } {\n const obj: { [x: string]: JSONValue } = {};\n for (const [key, value] of this.entries()) {\n if (value == null) {\n obj[key] = value;\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n obj[key] = value.toJSON();\n } else {\n obj[key] = value\n }\n }\n return obj;\n }\n}\n\n\nexport class JSONArray extends Array<JSONValue> {\n\n constructor(array?: Array<JSONValue>) {\n super();\n if (array) {\n for (let item of Object.values(array)) {\n item = JSON.parse(JSON.stringify(item))\n\n if (item == null) {\n this.push(item);\n }\n else if (item.constructor == Object) {\n this.push(new JSONObject(item as { [x: string]: JSONValue }));\n }\n else if (item.constructor == Array) {\n this.push(new JSONArray(item));\n }\n else {\n this.push(item)\n }\n }\n }\n }\n\n public toJSON(): Array<JSONValue> {\n const arr: Array<JSONValue> = [];\n for (const value of this) {\n if (value == null) {\n arr.push(value);\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n arr.push(value.toJSON());\n } else {\n arr.push(value)\n }\n }\n return arr;\n }\n}"],"names":[],"mappings":";;;AAWM,MAAO,UAAW,SAAQ,GAAsB,CAAA;AAGlD,IAAA,WAAA,CAAY,MAAmC,EAAA;AAC3C,QAAA,KAAK,EAAE;QACP,IAAI,MAAM,EAAE;AACR,YAAA,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBAC/C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,EAAE;AAEpC,qBAAA,IAAI,KAAK,CAAC,WAAW,IAAI,MAAM,EAAE;oBACpC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,KAAmC,CAAC,CAAC;gBACtE;AAAO,qBAAA,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,EAAE;oBACnC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;gBACvC;qBAAO;AACH,oBAAA,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC;gBACxB;YACJ;QACJ;IAGJ;AAEA,IAAA,aAAa,CAAC,GAAW,EA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;iBAAO,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,SAAS,EAAE;gBAClE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5B;iBAAO;AACH,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;QACJ;AACA,QAAA,OAAO,GAAG;IACd;AACH;;;;"}
1
+ {"version":3,"file":"JSONObject.js","sources":["../../../src/types/JSONObject.ts"],"sourcesContent":["import { BaseException, IllegalArgumentException } from '../exceptions';\n\nexport type JSONValue =\n | string\n | number\n | boolean\n | null\n | undefined\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n | Object\n\nexport class JSONObject extends Map<string, JSONValue> {\n\n constructor(object?: { [x: string]: JSONValue }) {\n super()\n if (object) {\n for (const [key, value] of Object.entries(object)) {\n if (value === null || value === undefined) {\n // ignore\n } else if (value.constructor == Object) {\n this.set(key, new JSONObject(value as { [x: string]: JSONValue }));\n } else if (value.constructor == Array) {\n this.set(key, new JSONArray(value));\n } else {\n this.set(key, value)\n }\n }\n }\n }\n\n getJSONObject(key: string): JSONObject {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONObject) {\n return super.get(key) as JSONObject\n } else {\n throw new IllegalArgumentException('Value cannot be converted to JSONObject')\n }\n }\n\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getString(key: string): string {\n if (super.has(key)) {\n try {\n if (typeof super.get(key) === 'string') {\n return super.get(key) as string;\n }\n\n throw new IllegalArgumentException('Value cannot be converted to string')\n } catch (e) {\n throw new IllegalArgumentException('Value cannot be converted to string', e)\n }\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getNumber(key: string): number {\n if (super.has(key)) {\n const number = Number(super.get(key));\n if (!isNaN(number)) {\n return number;\n }\n throw new IllegalArgumentException('Value cannot be converted to number')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getBoolean(key: string): boolean {\n if (super.has(key)) {\n if (typeof super.get(key) === 'boolean') {\n return super.get(key) as boolean;\n } else if (super.get(key) === 'true' || super.get(key) === 'false') {\n return Boolean(super.get(key));\n }\n throw new IllegalArgumentException('Value cannot be converted to boolean')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n getArray(key: string): JSONArray {\n if (super.has(key)) {\n if (super.get(key) instanceof JSONArray) {\n return super.get(key) as JSONArray;\n }\n else if (super.get(key) instanceof Array) {\n return new JSONArray(super.get(key) as Array<JSONValue>);\n }\n throw new IllegalArgumentException('Value cannot be converted to array')\n }\n throw new BaseException(`Value for Key: '${key}' not found`);\n }\n\n public toJSON(): { [x: string]: JSONValue } {\n const obj: { [x: string]: JSONValue } = {};\n for (const [key, value] of this.entries()) {\n if (value == null) {\n obj[key] = value;\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n obj[key] = value.toJSON();\n } else {\n obj[key] = value\n }\n }\n return obj;\n }\n}\n\n\nexport class JSONArray extends Array<JSONValue> {\n\n constructor(array?: Array<JSONValue>) {\n super();\n if (array) {\n for (let item of Object.values(array)) {\n // Handle undefined BEFORE JSON.parse to prevent crash\n // JSON.stringify(undefined) returns \"undefined\" which is not valid JSON\n if (item === undefined) {\n this.push(undefined);\n continue;\n }\n\n item = JSON.parse(JSON.stringify(item))\n\n if (item == null) {\n this.push(item);\n }\n else if (item.constructor == Object) {\n this.push(new JSONObject(item as { [x: string]: JSONValue }));\n }\n else if (item.constructor == Array) {\n this.push(new JSONArray(item));\n }\n else {\n this.push(item)\n }\n }\n }\n }\n\n public toJSON(): Array<JSONValue> {\n const arr: Array<JSONValue> = [];\n for (const value of this) {\n if (value == null) {\n arr.push(value);\n } else if (value instanceof JSONObject || value instanceof JSONArray) {\n arr.push(value.toJSON());\n } else {\n arr.push(value)\n }\n }\n return arr;\n }\n}"],"names":[],"mappings":";;;AAWM,MAAO,UAAW,SAAQ,GAAsB,CAAA;AAElD,IAAA,WAAA,CAAY,MAAmC,EAAA;AAC3C,QAAA,KAAK,EAAE;Q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IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AAEvC,gBAAA,IAAI,IAAI,IAAI,IAAI,EAAE;AACd,oBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnB;AACK,qBAAA,IAAI,IAAI,CAAC,WAAW,IAAI,MAAM,EAAE;oBACjC,IAAI,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,IAAkC,CAAC,CAAC;gBACjE;AACK,qBAAA,IAAI,IAAI,CAAC,WAAW,IAAI,KAAK,EAAE;oBAChC,IAAI,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;gBAClC;qBACK;AACD,oBAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACnB;YACJ;QACJ;IACJ;IAEO,MAAM,GAAA;QACT,MAAM,GAAG,GAAqB,EAAE;AAChC,QAAA,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE;AACtB,YAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACf,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;iBAAO,IAAI,KAAK,YAAY,UAAU,IAAI,KAAK,YAAY,SAAS,EAAE;gBAClE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;YAC5B;iBAAO;AACH,gBAAA,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC;YACnB;QACJ;AACA,QAAA,OAAO,GAAG;IACd;AACH;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@org-quicko/core",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A library in typescript for common entities and utilities across Quicko",
5
5
  "author": "Quicko",
6
6
  "main": "dist/cjs/build/node/index.cjs",