@onivoro/isomorphic-common 22.0.0 → 22.0.1
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/cjs/lib/functions/try-json-parse.d.ts +1 -0
- package/dist/cjs/lib/functions/try-json-parse.js +14 -0
- package/dist/cjs/lib/functions/try-json-stringify.d.ts +1 -0
- package/dist/cjs/lib/functions/try-json-stringify.js +14 -0
- package/dist/esm/lib/functions/try-json-parse.d.ts +1 -0
- package/dist/esm/lib/functions/try-json-parse.js +14 -0
- package/dist/esm/lib/functions/try-json-stringify.d.ts +1 -0
- package/dist/esm/lib/functions/try-json-stringify.js +14 -0
- package/dist/types/lib/functions/try-json-parse.d.ts +1 -0
- package/dist/types/lib/functions/try-json-stringify.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryJsonParse<T>(parseable: string | null | undefined): T | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryJsonParse = tryJsonParse;
|
|
4
|
+
function tryJsonParse(parseable) {
|
|
5
|
+
if (typeof parseable === 'undefined') {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(parseable);
|
|
10
|
+
}
|
|
11
|
+
catch (_e) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryJsonStringify<T>(object: T | null | undefined, fmtr?: any, spaces?: number): string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryJsonStringify = tryJsonStringify;
|
|
4
|
+
function tryJsonStringify(object, fmtr, spaces) {
|
|
5
|
+
if (typeof object === 'undefined') {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return JSON.stringify(object, fmtr, spaces);
|
|
10
|
+
}
|
|
11
|
+
catch (_e) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryJsonParse<T>(parseable: string | null | undefined): T | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryJsonParse = tryJsonParse;
|
|
4
|
+
function tryJsonParse(parseable) {
|
|
5
|
+
if (typeof parseable === 'undefined') {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return JSON.parse(parseable);
|
|
10
|
+
}
|
|
11
|
+
catch (_e) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryJsonStringify<T>(object: T | null | undefined, fmtr?: any, spaces?: number): string | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tryJsonStringify = tryJsonStringify;
|
|
4
|
+
function tryJsonStringify(object, fmtr, spaces) {
|
|
5
|
+
if (typeof object === 'undefined') {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
return JSON.stringify(object, fmtr, spaces);
|
|
10
|
+
}
|
|
11
|
+
catch (_e) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryJsonParse<T>(parseable: string | null | undefined): T | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function tryJsonStringify<T>(object: T | null | undefined, fmtr?: any, spaces?: number): string | null;
|