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

com.casadetasha.kexp.sproute.processor.ktx.Kotlin.kt Maven / Gradle / Ivy

Go to download

KAPT processor to manage routing boilerplate for KTOR projects. Use in conjunction with the sproutes library.

There is a newer version: 2.1.2-beta-1
Show newest version
package com.casadetasha.kexp.sproute.processor.ktx

import kotlin.collections.removeFirst as removeFirstFromCollection

internal fun Boolean.orElse(function: () -> Unit) {
    if (!this) function()
}

internal fun String.asPath() : String {
    return this.replace(".", "/")
}

internal fun String.asSubPackageOf(classPackage: String) : String {
    return this.removePrefix(classPackage)
}

internal fun  Collection.removeFirst(): List {
    return toMutableList().apply { removeFirstFromCollection() }
}

internal fun List.asVarArgs(): String = this.let {
    return joinToString(", ") { "\"$it\"" }
}

internal fun  List?.ifNotEmpty(function: (List) -> Unit): Boolean {
    if (this == null || isEmpty()) {
        return false
    }

    function(this)
    return true
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy