MCPcopy Index your code
hub / github.com/rollup/plugins / ensureArray

Function ensureArray

packages/pluginutils/src/utils/ensureArray.ts:6–10  ·  view source on GitHub ↗
(thing: readonly T[] | T | undefined | null)

Source from the content-addressed store, hash-verified

4}
5
6export default function ensureArray<T>(thing: readonly T[] | T | undefined | null): readonly T[] {
7 if (isArray(thing)) return thing;
8 if (thing == null) return [];
9 return [thing];
10}

Callers 1

createFilterFunction · 0.85

Calls 1

isArrayFunction · 0.85

Tested by

no test coverage detected