lift

trait PartialFunction[X, Y] {
  def lift: (X) => Option[Y]
}

lift creates an anonymous function that wraps with Some the value returned by this partial function if it’s defined for the given input value.

For those input values for which this partial function is not defined, the anonymous function will return None.