@ztimson/utils 0.27.8 → 0.27.10

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/json.d.ts ADDED
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Parse JSON but return the original string if it fails
3
+ *
4
+ * @param {any} json JSON string to parse
5
+ * @param fallback Fallback value if unable to parse, defaults to original string
6
+ * @return {string | T} Object if successful, original string otherwise
7
+ */
8
+ export declare function JSONAttemptParse<T1, T2>(json: T2, fallback?: T1): T1 | T2;
9
+ /**
10
+ * Stringifies objects & skips primitives
11
+ *
12
+ * @param {any} obj Object to convert to serializable value
13
+ * @return {string | T} Serialized value
14
+ */
15
+ export declare function JSONSerialize<T1>(obj: T1): T1 | string;
16
+ /**
17
+ * Convert an object to a JSON string avoiding any circular references.
18
+ *
19
+ * @param obj Object to convert to JSON
20
+ * @param {number} space Format the JSON with spaces
21
+ * @return {string} JSON string
22
+ */
23
+ export declare function JSONSanitize(obj: any, space?: number): string;
package/dist/objects.d.ts CHANGED
@@ -140,25 +140,3 @@ export declare function mixin(target: any, constructors: any[]): void;
140
140
  * @returns {{}}
141
141
  */
142
142
  export declare function objectMap<T>(obj: any, fn: (key: string, value: any) => any): T;
143
- /**
144
- * Parse JSON but return the original string if it fails
145
- *
146
- * @param {any} json JSON string to parse
147
- * @return {string | T} Object if successful, original string otherwise
148
- */
149
- export declare function JSONAttemptParse<T1, T2>(json: T2): T1 | T2;
150
- /**
151
- * Stringifies objects & skips primitives
152
- *
153
- * @param {any} obj Object to convert to serializable value
154
- * @return {string | T} Serialized value
155
- */
156
- export declare function JSONSerialize<T1>(obj: T1): T1 | string;
157
- /**
158
- * Convert an object to a JSON string avoiding any circular references.
159
- *
160
- * @param obj Object to convert to JSON
161
- * @param {number} space Format the JSON with spaces
162
- * @return {string} JSON string
163
- */
164
- export declare function JSONSanitize(obj: any, space?: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztimson/utils",
3
- "version": "0.27.8",
3
+ "version": "0.27.10",
4
4
  "description": "Utility library",
5
5
  "author": "Zak Timson",
6
6
  "license": "MIT",