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

Function isArray

packages/pluginutils/src/utils/ensureArray.ts:2–4  ·  view source on GitHub ↗
(arg: unknown)

Source from the content-addressed store, hash-verified

1// Helper since Typescript can't detect readonly arrays with Array.isArray
2function isArray(arg: unknown): arg is any[] | readonly any[] {
3 return Array.isArray(arg);
4}
5
6export default function ensureArray<T>(thing: readonly T[] | T | undefined | null): readonly T[] {
7 if (isArray(thing)) return thing;

Callers 1

ensureArrayFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected