mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-11 20:10:24 +00:00
Improve ensureArray and use it in tracing (#8785)
* Improve ensureArray and use it in tracing * Fix typing Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
export const ensureArray = (value?: any) => {
|
||||
if (!value || Array.isArray(value)) {
|
||||
export function ensureArray(value: undefined): undefined;
|
||||
export function ensureArray<T>(value: T | T[]): T[];
|
||||
export function ensureArray(value) {
|
||||
if (value === undefined || Array.isArray(value)) {
|
||||
return value;
|
||||
}
|
||||
return [value];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user