Skip to content

Conformance Examples 0.1.0 — Transforms: transform-at_most

at_most-caps-to-maximum

at_most returns the argument when the input is above it via {{ n | at_most: 5 }}.

Template

{{ n | at_most: 5 }}

Context

{
    "n": 8
}

Output

5

at_most-keeps-smaller-input

at_most returns the input when it is already at or below the maximum.

Template

{{ n | at_most: 5 }}

Context

{
    "n": 3
}

Output

3

at_most-fractional-maximum

at_most returns a fractional maximum when it is the smaller value.

Template

{{ n | at_most: 2.5 }}

Context

{
    "n": 4
}

Output

2.5

at_most-non-numeric-input-is-null

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

Template

{{ n | at_most: 5 }}

Context

{
    "n": "x"
}

Output

null

at_most-non-numeric-argument-is-null

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

Template

{{ n | at_most: "x" }}

Context

{
    "n": 5
}

Output

null

at_most-datetime-keeps-earlier-argument

With DateTime input and a DateTime argument, at_most returns the earlier instant.

Template

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

Context

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

Output

1970-01-01T00:03:20Z

at_most-datetime-keeps-earlier-input

With DateTime input and a DateTime argument, at_most returns the input when it is the earlier instant.

Template

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

Context

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

Output

1970-01-01T00:01:40Z

at_most-datetime-non-datetime-argument-is-null

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

Template

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

Context

{
    "a": 100
}

Output

null

Source fixture: transforms/transform-at_most.json