FurBall/uni_modules/tuniaoui-vue3/libs/lodash/cast-array.ts

9 lines
223 B
TypeScript

import type { Many } from './_common'
export function castArray<T>(value: Many<T>): T[] {
if (!value || (Array.isArray(value) && !value.length)) {
return []
}
return Array.isArray(value) ? value : [value as T]
}