Skip to content

Conformance Examples 0.1.0 — Transforms: transform-reject

reject-property-value

With two arguments, removes structs whose property equals the value.

Template

{{ items | reject: "k" "a" }}

Context

{
    "items": [
        {
            "k": "a"
        },
        {
            "k": "b"
        }
    ]
}

Output

[{"k":"b"}]

reject-property-truthy

With one argument, removes structs whose property is truthy (keeping the falsy ones).

Template

{{ items | reject: "on" }}

Context

{
    "items": [
        {
            "on": true
        },
        {
            "on": false
        }
    ]
}

Output

[{"on":false}]

reject-non-list-is-null

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

Template

{{ x | reject: "k" }}

Context

{
    "x": "hi"
}

Output

null

reject-non-struct-contents-is-null

reject expects a list of structs; non-struct contents yield null.

Template

{{ xs | reject: "k" }}

Context

{
    "xs": [
        1
    ]
}

Output

null

Source fixture: transforms/transform-reject.json