map<U> method

Option<U> map<U>(
  1. U fn(
    1. T value
    )
)

Maps the value inside Some if it exists.

Implementation

Option<U> map<U>(U Function(T value) fn) {
  if (this is Some<T>) {
    return Some(fn((this as Some<T>).value));
  }
  return None<U>();
}