Skip to content

mapJoin

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)[];
src

() => Map<T, U>

cb

(key: T, value: U, index: number) => V

optionsoptional

JoinOptions

enderoptionalChildren

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.

joineroptionalChildren

The string to place between each element.

skipFalsyoptionalboolean

When true, falsy values with the exception of 0 are skipped.

() => (V | string | undefined | CustomContext)[] The mapped and joined array.

  • join for joining without mapping.

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)[];
src

() => T[] | IterableIterator<T>

cb

(value: T, index: number) => V

optionsoptional

JoinOptions

enderoptionalChildren

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.

joineroptionalChildren

The string to place between each element.

skipFalsyoptionalboolean

When true, falsy values with the exception of 0 are skipped.

() => (V | string | undefined | CustomContext)[] The mapped and joined array.

  • join for joining without mapping.