Skip to content

Conformance Examples 0.1.0 — Transforms: transform-at_least

at_least-raises-to-minimum

at_least returns the argument when the input is below it via {{ n | at_least: 5 }}.

Template

{{ n | at_least: 5 }}

Context

{
    "n": 3
}

Output

5

at_least-keeps-larger-input

at_least returns the input when it is already at or above the minimum.

Template

{{ n | at_least: 5 }}

Context

{
    "n": 8
}

Output

8

at_least-fractional-minimum

at_least returns a fractional minimum when it is the larger value.

Template

{{ n | at_least: 2.5 }}

Context

{
    "n": 1
}

Output

2.5

at_least-non-numeric-input-is-null

A non-numeric input is a soft failure, so at_least yields null.

Template

{{ n | at_least: 5 }}

Context

{
    "n": "x"
}

Output

null

at_least-non-numeric-argument-is-null

A non-numeric argument is a soft failure, so at_least yields null.

Template

{{ n | at_least: "x" }}

Context

{
    "n": 5
}

Output

null

at_least-datetime-keeps-later-argument

With DateTime input and a DateTime argument, at_least returns the later instant.

Template

{{ a | as_date_time: 'seconds' | at_least: ( b | as_date_time: 'seconds' ) }}

Context

{
    "a": 100,
    "b": 200
}

Output

1970-01-01T00:03:20Z

at_least-datetime-keeps-later-input

With DateTime input and a DateTime argument, at_least returns the input when it is the later instant.

Template

{{ a | as_date_time: 'seconds' | at_least: ( b | as_date_time: 'seconds' ) }}

Context

{
    "a": 500,
    "b": 200
}

Output

1970-01-01T00:08:20Z

at_least-datetime-non-datetime-argument-is-null

DateTime input with a non-DateTime argument is a soft failure, so at_least yields null.

Template

{{ a | as_date_time: 'seconds' | at_least: 5 }}

Context

{
    "a": 100
}

Output

null

Source fixture: transforms/transform-at_least.json