package net.pterodactylus.sone.utils fun T?.asList() = this?.let(::listOf) ?: emptyList() val Any?.unit get() = Unit fun T?.throwOnNullIf(throwCondition: Boolean, exception: () -> Throwable) = if (this == null && throwCondition) throw exception() else this fun T?.onNull(block: () -> Unit) = this.also { if (this == null) { block() } }