ifpresent
Maps value to the result of mapping.
Note: this function is usually inlined. When inlining lambda arguments, an explicit @lambda
annotation is required:
.name::ifpresent {@lambda x: .x::uppercase}::otherwise {unnamed}
Content copied to clipboard
As with any inlined lambda, @lambda
can be omitted if the result is constant:
.name::ifpresent {I have a name}::otherwise {I'm unnamed}
Content copied to clipboard
Return
the result of mapping executed on value if value is not none, none otherwise
Parameters
value
value to check