Skip to content

Conformance Examples 0.1.0 — Transforms: transform-join

join-default-separator

With no argument, elements are joined with a single space.

Template

{{ xs | join }}

Context

{
    "xs": [
        "a",
        "b",
        "c"
    ]
}

Output

a b c

join-custom-separator

The single argument is used as the separator.

Template

{{ xs | join: ", " }}

Context

{
    "xs": [
        "a",
        "b",
        "c"
    ]
}

Output

a, b, c

join-numbers

Numeric elements are rendered to their string form before joining.

Template

{{ xs | join: "-" }}

Context

{
    "xs": [
        1,
        2,
        3
    ]
}

Output

1-2-3

join-empty-list

Joining an empty list yields an empty string.

Template

{{ xs | join: "," }}

Context

{
    "xs": []
}

Output


join-non-list-is-null

join operates only on lists; a string input yields null.

Template

{{ x | join: "," }}

Context

{
    "x": "hi"
}

Output

null

Source fixture: transforms/transform-join.json