Skip to content

join

Place a joiner between each element of an array or iterator. Defaults to joining with a newline.

import { join } from "@alloy-js/core";
function join<T extends Children>(src: T[] | Iterator<T>, options?: JoinOptions): Children;

Parameters

src

T[] | Iterator<T>

optionsoptional

JoinOptions

Options

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.

Returns

Children The joined array

See also

  • mapJoin for mapping before joining.