aboutsummaryrefslogtreecommitdiffstats
path: root/src/jsUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsUtils.ts')
-rw-r--r--src/jsUtils.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jsUtils.ts b/src/jsUtils.ts
index 0cc83bb91..47473a538 100644
--- a/src/jsUtils.ts
+++ b/src/jsUtils.ts
@@ -1,7 +1,7 @@
1export const ifUndefined = <T>( 1export const ifUndefined = <T>(
2 source: undefined | null | T, 2 source: undefined | null | T,
3 defaultValue: T, 3 defaultValue: T,
4): T => (source !== undefined && source !== null ? source : defaultValue); 4): T => source ?? defaultValue;
5 5
6export const convertToJSON = (data: string | any | undefined | null) => 6export const convertToJSON = (data: string | any | undefined | null) =>
7 data && typeof data === 'string' && data.length > 0 ? JSON.parse(data) : data; 7 data && typeof data === 'string' && data.length > 0 ? JSON.parse(data) : data;