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

org.http4k.template.DatastarFragmentRenderer.kt Maven / Gradle / Ivy

The newest version!
package org.http4k.template

import org.http4k.datastar.Fragment

/**
 * Renderer which converts a ViewModel into Datastar Fragments
 */
class DatastarFragmentRenderer(private val renderer: TemplateRenderer) {
    operator fun invoke(vararg views: ViewModel) = views.map { Fragment.of(renderer(it).stripNewLines()) }

    private fun String.stripNewLines() = replace("\n", "")
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy