castAsArray

Casts any value to an array.

This function accepts any value and returns an array of that value.

import { castAsArray } from '1loc'

const stringValue = 'me'
const arrValue = [2, 3, 4]

castAsArray(value) // ['me']
castAsArray(arrValue) // [2, 3, 4]

Last updated