-
Notifications
You must be signed in to change notification settings - Fork 0
Arrays
Utility tools for working with Dynamic-Length Arrays.
type ArrayifyType <T> = any[];
Convert the specified type into an array, if it is not one already.
-
T
: The type being arrayified.
The arrayified type of T
.
arrayify <T> ( x: T ): ArrayifyType<T>;
// arrayify ( x: unknown ): any[];
Convert the specified value into an array, if it is not one already.
-
T
: The type of the value being arrayified.
-
x
: The value being arrayified.
The arrayified type of x
.
function toListString (
arr: unknown[],
modifier: string | null = ' & ',
separator: string | null = ', '
): string;
Convert the specified array to a string
containing a list of the elements in the array.
This function is similar to the join()
method on arrays but behaves slightly differently.
-
arr
: The array being converted into a liststring
. -
modifier
: The modifierstring
inserted between elements whenarr
contains two elements or between the last two elements whenarr
contains three or more elements.If an empty
string
ornull
is provided, no modifier string will be inserted into the returnedstring
. -
separator
: The separatorstring
inserted between elements whenarr
contains three or more elements.If an empty
string
ornull
is provided, no separator string will be inserted into the returnedstring
.
A List string
made up of the stringified elements of arr
.