All Downloads are FREE. Search and download functionalities are using the official Maven repository.

invirt.pebble.functions.utils.kt Maven / Gradle / Ivy

There is a newer version: 0.10.11
Show newest version
package invirt.pebble.functions

import invirt.http4k.currentHttp4kRequest
import invirt.http4k.views.validationErrorContextKey
import invirt.utils.minorUnitToString
import java.util.*

val currencyFromMinorUnitFunction = pebbleFunction("currencyFromMinorUnit", "minorUnitAmount", "currency") {
    val minorUnitAmount = (args["minorUnitAmount"]!! as Number).toLong()
    Currency.getInstance(args["currency"]!! as String).minorUnitToString(minorUnitAmount)
}

val errorsFunction = pebbleFunction("errors") {
    validationErrorContextKey[currentHttp4kRequest!!]
}

val requestFunction = pebbleFunction("request") {
    currentHttp4kRequest!!
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy