castArrayIfExists
Cast a non-nullish value into an array
94 bytes
Usage
The castArrayIfExists
function ensures that a non-nullish 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. Nullish values (null or undefined) are passed through as is.