EASYAIuniappNewUI/node_modules/@tuniao/tnui-vue3-uniapp/libs/lodash/cast-array.ts
2025-02-08 18:50:38 +08:00

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]
}