The castArray function ensures that the input value is always returned as an array. If the input is already an array, it returns a shallow copy of the array. If the input is not an array, it wraps the input in a new array.
import*as
import _
_from'radashi'
const
constnumberToArray:number[]
numberToArray=
import _
_.
castArray<number>(value: number): number[]
export castArray
Casts the given value to an array. If the value is already an
array, a shallow copy is returned. Otherwise, a new array
containing the value is returned.
Casts the given value to an array. If the value is already an
array, a shallow copy is returned. Otherwise, a new array
containing the value is returned.
Casts the given value to an array. If the value is already an
array, a shallow copy is returned. Otherwise, a new array
containing the value is returned.
Casts the given value to an array. If the value is already an
array, a shallow copy is returned. Otherwise, a new array
containing the value is returned.
Casts the given value to an array. If the value is already an
array, a shallow copy is returned. Otherwise, a new array
containing the value is returned.