aboutsummaryrefslogtreecommitdiffstats
path: root/src/jsUtils.ts
diff options
context:
space:
mode:
authorLibravatar Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com>2021-09-04 20:39:08 +0530
committerLibravatar GitHub <noreply@github.com>2021-09-04 20:39:08 +0530
commit41982633c10c7c155918263b413fe86657e3722b (patch)
treef6821cc62969fecf1efdf5946318a11721ed0f99 /src/jsUtils.ts
parentchore: remove what's new functionality (#1864) (diff)
downloadferdium-app-41982633c10c7c155918263b413fe86657e3722b.tar.gz
ferdium-app-41982633c10c7c155918263b413fe86657e3722b.tar.zst
ferdium-app-41982633c10c7c155918263b413fe86657e3722b.zip
Refactoring to have consistent usage (prep for ts conversion) (#1821)
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);