mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
12 lines
278 B
TypeScript
12 lines
278 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 normalizePath(str: string) {
|
|
return str.replace(/\\+/g, '/')
|
|
}
|