aboutsummaryrefslogtreecommitdiffstats
path: root/src/jsUtils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/jsUtils.ts')
-rw-r--r--src/jsUtils.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/jsUtils.ts b/src/jsUtils.ts
new file mode 100644
index 000000000..b1baad7c5
--- /dev/null
+++ b/src/jsUtils.ts
@@ -0,0 +1,3 @@
1export const ifUndefinedString = (source: string | undefined | null, defaultValue: string): string => (source !== undefined && source !== null ? source : defaultValue);
2export const ifUndefinedBoolean = (source: boolean | undefined | null, defaultValue: boolean): boolean => Boolean(source !== undefined && source !== null ? source : defaultValue);
3export const ifUndefinedNumber = (source: number | undefined | null, defaultValue: number): number => Number(source !== undefined && source !== null ? source : defaultValue);