applyIf

inline fun <T> T.applyIf(condition: Boolean, block: T.() -> Unit): T

Applies a given code block if a given condition is met

Parameters

condition

The condition that should be met

block

The code block to execute