mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 02:48:21 +00:00
Add variantOf null check
This commit is contained in:
parent
43454b1641
commit
b360bdf978
1 changed files with 1 additions and 0 deletions
|
@ -16,6 +16,7 @@ export function isNullish(value: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function variantOf(enumValue: any) {
|
export function variantOf(enumValue: any) {
|
||||||
|
if (enumValue === null) return null;
|
||||||
if (typeof enumValue === 'string') return enumValue;
|
if (typeof enumValue === 'string') return enumValue;
|
||||||
else return Object.entries(enumValue)[0][0];
|
else return Object.entries(enumValue)[0][0];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue