toArray
The toArray utility function provides a consistent way to convert any value into an array format. It handles edge cases like null and undefined values, and ensures that the output is always an array.
Usage
ts
import { toArray } from '@vuetify/v0'
const value = 'Example Value'
const valueAsArray = toArray(value)
console.log(valueAsArray) // ['Example Value']Architecture
toArray is a pure transformation utility:
Reactivity
toArray is a pure transformer function. It does not track reactivity or return reactive values.
Tip
Use inside computed for reactivity Wrap in computed() if you need reactive array normalization:
ts
const items = computed(() => toArray(props.items)) The following API details are for the toArray composable.
Functions
Was this page helpful?