mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-24 11:08:16 +08:00
6 lines
188 B
TypeScript
6 lines
188 B
TypeScript
export function ensureArray<T>(thing: T | T[] | null | undefined): T[] {
|
|
if (Array.isArray(thing)) return thing
|
|
if (thing === null || thing === undefined) return []
|
|
return [thing]
|
|
}
|