mapJoin
Overload 1
Map a Map to an array using a mapper and place a joiner between each element. Defaults to joining with a newline.
import { mapJoin } from "@alloy-js/core";
function mapJoin<T, U, V>(src: () => Map<T, U>, cb: (key: T, value: U, index: number) => V, options?: JoinOptions): () => (V | string | undefined | CustomContext)[];
Parameters
src |
|
cb |
|
options | optional
|
Options
ender | optionalChildren When true, the joiner is placed at the end of the array. When a string, that string is placed at the end of the array. The ender is only emitted when the array has at least one element. |
joiner | optionalChildren The string to place between each element. |
skipFalsy | optionalboolean When true, falsy values with the exception of 0 are skipped. |
Returns
() => (V | string | undefined | CustomContext)[]
The mapped and joined array.
See also
- join for joining without mapping.
Overload 2
Map a array or iterator to another array using a mapper and place a joiner between each element. Defaults to joining with a newline.
import { mapJoin } from "@alloy-js/core";
function mapJoin<T, V>(src: () => T[] | IterableIterator<T>, cb: (value: T, index: number) => V, options?: JoinOptions): () => (V | string | undefined | CustomContext)[];
Parameters
src |
|
cb |
|
options | optional
|
Options
ender | optionalChildren When true, the joiner is placed at the end of the array. When a string, that string is placed at the end of the array. The ender is only emitted when the array has at least one element. |
joiner | optionalChildren The string to place between each element. |
skipFalsy | optionalboolean When true, falsy values with the exception of 0 are skipped. |
Returns
() => (V | string | undefined | CustomContext)[]
The mapped and joined array.
See also
- join for joining without mapping.