mirror of
https://github.com/hanzoai/calendar.git
synced 2026-09-24 22:42:24 +00:00
10 lines
180 B
TypeScript
10 lines
180 B
TypeScript
export function ensureArray<T>(val: unknown): T[] {
|
|
if (Array.isArray(val)) {
|
|
return val;
|
|
}
|
|
if (typeof val === "undefined") {
|
|
return [];
|
|
}
|
|
return [val] as T[];
|
|
}
|