MCPcopy Create free account
hub / github.com/antfu/utils / toArray

Function toArray

src/array.ts:9–12  ·  view source on GitHub ↗
(array?: Nullable<Arrayable<T>>)

Source from the content-addressed store, hash-verified

7 * @category Array
8 */
9export function toArray<T>(array?: Nullable<Arrayable<T>>): Array<T> {
10 array = array ?? []
11 return Array.isArray(array) ? array : [array]
12}
13
14/**
15 * Convert `Arrayable<T>` to `Array<T>` and flatten it

Callers 3

array.test.tsFile · 0.90
flattenArrayableFunction · 0.85
mergeArrayableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected