GuardsasArrayasArray CallableasArray<T>(x: T | T[]): T[]Returns x as array if it is not an array type. ExampleasArray(1)// => [1]asArray([2, 3, 4])// => [2, 3, 4] AlternativesLodash - castArrayType parametersTThe value type.Parametersx: T | T[]The value to cast.Returns T[]x interpreted as array.
Returns
x
as array if it is not an array type.Example
Alternatives