Skip to content

Conformance Examples 0.1.0 — Transforms: transform-ceil

ceil-rounds-up

ceil rounds a positive decimal up to the next integer via {{ n | ceil }}.

Template

{{ n | ceil }}

Context

{
    "n": 1.2
}

Output

2

ceil-negative-decimal

ceil of a negative decimal rounds toward zero.

Template

{{ n | ceil }}

Context

{
    "n": -1.2
}

Output

-1

ceil-integer-unchanged

ceil of an integer is unchanged.

Template

{{ n | ceil }}

Context

{
    "n": 5
}

Output

5

ceil-numeric-string

A numeric string input is parsed before applying ceil.

Template

{{ n | ceil }}

Context

{
    "n": "1.2"
}

Output

2

ceil-non-numeric-input-is-null

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

Template

{{ n | ceil }}

Context

{
    "n": "x"
}

Output

null

Source fixture: transforms/transform-ceil.json