MCPcopy Create free account
hub / github.com/middleapi/orpc / toArray

Function toArray

packages/shared/src/array.ts:1–3  ·  view source on GitHub ↗
(value: T)

Source from the content-addressed store, hash-verified

1export function toArray<T>(value: T): T extends readonly any[] ? T : Exclude<T, undefined | null>[] {
2 return (Array.isArray(value) ? value : value === undefined || value === null ? [] : [value]) as any
3}
4
5export function splitInHalf<T>(arr: readonly T[]): [T[], T[]] {
6 const half = Math.ceil(arr.length / 2)

Callers 15

constructorMethod · 0.90
constructorMethod · 0.90
#executeBatchMethod · 0.90
createFormActionFunction · 0.90
useServerActionFunction · 0.90
mergeStandardHeadersFunction · 0.90
interceptMethod · 0.90
initMethod · 0.90
constructorMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected