Skip to content

Conformance Examples 0.1.0 — Transforms: transform-upcase

upcase-string

A string literal upcased via the built-in upcase transform.

Template

{{ "hi" | upcase }}

Context

{}

Output

HI

upcase-identifier-string

An identifier pointing to a string value is upcased.

Template

{{ foo | upcase }}

Context

{
    "foo": "hi"
}

Output

HI

upcase-null-context

A missing key (resolves to null) coerces to "null" then upcases to "NULL".

Template

{{ missing | upcase }}

Context

{}

Output

NULL

upcase-json-null

An explicit JSON null value coerces to "null" then upcases to "NULL".

Template

{{ foo | upcase }}

Context

{
    "foo": null
}

Output

NULL

upcase-number

A number coerces to its string form; uppercasing has no effect on digits.

Template

{{ n | upcase }}

Context

{
    "n": 5
}

Output

5

upcase-boolean

A boolean true coerces to "true" then upcases to "TRUE".

Template

{{ b | upcase }}

Context

{
    "b": true
}

Output

TRUE

upcase-chained-with-downcase

Two-transform chain: upcase then downcase. Final result is lowercase.

Template

{{ foo | upcase | downcase }}

Context

{
    "foo": "Hello"
}

Output

hello

upcase-on-binary

Upcase applied to the result of a binary comparison. true renders as "true", upcased to "TRUE".

Template

{{ a == b | upcase }}

Context

{
    "a": 1,
    "b": 1
}

Output

TRUE

upcase-sharp-s-expands

Unicode default case mapping can grow a string: German sharp s (one code point) upcases to "SS" (two code points).

Template

{{ s | upcase }}

Context

{
    "s": "ß"
}

Output

SS

Source fixture: transforms/transform-upcase.json