UNPKG

ts-json-schema-generator

Version:

Generate JSON schema from your Typescript sources

8 lines (6 loc) 193 B
export function castArray<T>(input: undefined | T | T[]): undefined | T[] { if (input === undefined) { return undefined; } return Array.isArray(input) ? input : [input]; }