package app.furmeet.events.system.helper

fun <T> T?.nullIf(condition: (T) -> Boolean): T? =
        if (this?.let { condition(this) } != false)
            null
        else
            this

fun <T> T?.nullIfNot(condition: (T) -> Boolean): T? = nullIf { condition(it).not() }

fun String?.nullIfBlank(): String? = nullIf { it.isBlank() }