diff options
author | Vijay Raghavan Aravamudhan <vraravam@users.noreply.github.com> | 2021-09-04 20:39:08 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-04 20:39:08 +0530 |
commit | 41982633c10c7c155918263b413fe86657e3722b (patch) | |
tree | f6821cc62969fecf1efdf5946318a11721ed0f99 /src/jsUtils.ts | |
parent | chore: remove what's new functionality (#1864) (diff) | |
download | ferdium-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.ts | 3 |
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 @@ | |||
1 | export const ifUndefinedString = (source: string | undefined | null, defaultValue: string): string => (source !== undefined && source !== null ? source : defaultValue); | ||
2 | export const ifUndefinedBoolean = (source: boolean | undefined | null, defaultValue: boolean): boolean => Boolean(source !== undefined && source !== null ? source : defaultValue); | ||
3 | export const ifUndefinedNumber = (source: number | undefined | null, defaultValue: number): number => Number(source !== undefined && source !== null ? source : defaultValue); | ||