mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
12 lines
283 B
TypeScript
12 lines
283 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]
|
|
}
|
|
|
|
export function isEmptyObject(obj: object) {
|
|
return Object.keys(obj).length === 0
|
|
}
|