ensureArray.ts 187 Bytes Raw Blame History Permalink 1 2 3 4 5 export default function ensureArray<T>(thing: Array<T> | T | undefined | null): Array<T> { if (Array.isArray(thing)) return thing; if (thing == undefined) return []; return [thing]; }