• Chains Option operations that return Options. Unlike map which wraps the result in a new Option, flatMap prevents nested Options like Some(Some(value)).

    Type Parameters

    • A
    • B

    Parameters

    • f: (a: A) => Option<B>

      A function that returns an Option

    Returns (option: Option<A>) => Option<B>

    The Option returned by the function if the input is Some, None otherwise