package net.pterodactylus.sone.utils /** * Returns the value of [block] if `this` is true, returns `null` otherwise. */ fun Boolean.ifTrue(block: () -> R): R? = if (this) block() else null /** * Returns the value of [block] if `this` is false, returns `null` otherwise. */ fun Boolean.ifFalse(block: () -> R): R? = if (!this) block() else null