<applyIf and letIf?> I very often find myself doin...
# forum
r
applyIf and letIf? I very often find myself doing this: foo = bar .let { if (someCondition) { it.baz() } else { it } } and similarly with apply: foo = bar .apply { if (someCondition) { baz() } } Wouldn’t it be great if the stdlib had letIf and applyIf? foo = bar .letIf(someCondition) { it.baz() } foo = bar .applyIf(someCondition) { baz() } I realize this can very easily be added to my own projects, but I think there’s a case to have this in the...