Casts value as an array if it's not one.
value
Returns the cast array.
5.0.0
castArray(1)// => [1]castArray({ 'a': 1 })// => [{ 'a': 1 }]castArray('abc')// => ['abc']castArray(null)// => [null]castArray(undefined)// => [undefined]castArray()// => []const array = [1, 2, 3]console.log(castArray(array) === array)// => true Copy
castArray(1)// => [1]castArray({ 'a': 1 })// => [{ 'a': 1 }]castArray('abc')// => ['abc']castArray(null)// => [null]castArray(undefined)// => [undefined]castArray()// => []const array = [1, 2, 3]console.log(castArray(array) === array)// => true
Casts
value
as an array if it's not one.