MCPcopy Create free account
hub / github.com/DavidWells/analytics / ensureArray

Function ensureArray

packages/analytics-core/src/utils/ensureArray.js:3–7  ·  view source on GitHub ↗
(singleOrArray)

Source from the content-addressed store, hash-verified

1import { isArray } from '@analytics/type-utils'
2
3export default function ensureArray(singleOrArray) {
4 if (!singleOrArray) return []
5 if (isArray(singleOrArray)) return singleOrArray
6 return [singleOrArray]
7}

Callers 2

analyticsFunction · 0.50
enhanceDispatchFunction · 0.50

Calls 1

isArrayFunction · 0.50

Tested by

no test coverage detected