coalescing
The coalescing() function takes a value or an array and normalizes it into an array. If the value is not already an array, it is wrapped in an array.
Interactive example
Syntax
typescript
function coalescing<
GenericInput extends AnyValue
>(
input: GenericInput
): ArrayCoalescing<GenericInput>ArrayCoalescing returns an array if the input is not one, or keeps the input array. This guarantees the result is always an array.
Parameters
input: A value or an array of values.
Return value
An array. If input is already an array, it is returned as is. Otherwise, the value is wrapped in an array.
See also
find- Locates an element matching a predicatecoalesce(Number) - For other scalar types
