arrow-core-data / arrow.core / Ior / toOption

toOption

fun ~~toOption~~(): Option<B> Deprecated: Deprecated, use orNull instead

Returns a Some containing the Right value or B if this is Right or Both and None if this is a Left.

Example:

Right(12).toOption() // Result: Some(12)
Left(12).toOption()  // Result: None
Both(12, "power").toOption()  // Result: Some("power")

Do you like Arrow?

Arrow Org
<