mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
update select to handle display property
This commit is contained in:
@ -4,6 +4,23 @@ export function isApiError(data: Record<string, unknown>): data is APIError {
|
||||
return 'error' in data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Type guard to determine if a value is not null, undefined, or empty.
|
||||
*/
|
||||
export function isTruthy<V extends string | number | boolean | null | undefined>(
|
||||
value: V,
|
||||
): value is NonNullable<V> {
|
||||
const badStrings = ['', 'null', 'undefined'];
|
||||
if (typeof value === 'string' && !badStrings.includes(value)) {
|
||||
return true;
|
||||
} else if (typeof value === 'number') {
|
||||
return true;
|
||||
} else if (typeof value === 'boolean') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the CSRF token from cookie storage.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user