aboutsummaryrefslogtreecommitdiffstats
path: root/src/jsUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsUtils.ts')
-rw-r--r--src/jsUtils.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/jsUtils.ts b/src/jsUtils.ts
index f6a1df2fe..0095028ef 100644
--- a/src/jsUtils.ts
+++ b/src/jsUtils.ts
@@ -3,15 +3,15 @@ export const ifUndefined = <T>(
3 defaultValue: T, 3 defaultValue: T,
4): T => source ?? defaultValue; 4): T => source ?? defaultValue;
5 5
6export const convertToJSON = (data: string | any | undefined | null) => 6export const convertToJSON = (data?: string | any | 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;
8 8
9export const cleanseJSObject = (data: any | undefined | null) => 9export const cleanseJSObject = (data?: any | null) =>
10 JSON.parse(JSON.stringify(data)); 10 JSON.parse(JSON.stringify(data));
11 11
12export const isEscKeyPress = (keyCode: number) => keyCode === 27; 12export const isEscKeyPress = (keyCode: number) => keyCode === 27;
13 13
14export const safeParseInt = (text: string | number | undefined | null) => { 14export const safeParseInt = (text?: string | number | null) => {
15 if (text === undefined || text === null) { 15 if (text === undefined || text === null) {
16 return 0; 16 return 0;
17 } 17 }