maybe
Call typ on value if val is defined.
def maybe(
typ: Callable,
val: Any
) - > Any
Call typ on value if val is defined.
Parameters
| Name | Type | Description |
|---|---|---|
| typ | Callable | The constructor or transformation function to apply to the value. |
| val | Any | The input value to be checked for a None value before processing. |
Returns
| Type | Description |
|---|---|
Any | The result of applying the type constructor or function to the value if it is not None; otherwise, returns None. |