runIf

fun <T> T.runIf(condition: Boolean, block: T.() -> T): T

Conditionally calls the specified function block with this value and returns its result, or returns this value if the condition is false.

Useful for interacting with builder/fluent APIs.