Type alias TransformToOption<A, B>

TransformToOption<A, B>: ((a) => Option<B>)

Type Parameters

  • A

    any type

  • B

    any type

Type declaration

    • (a): Option<B>
    • Similar to a Transformation but the result has to be an optional value

      Parameters

      • a: A

      Returns Option<B>

      Example

      // All the following are valid examples
      const fn1 = (a: number) => Option.Some(number).filter(n => n % 2 === 0)
      const fn2 = (a: string) => Option.None()
      const fn3 = (a: number[]) => Option.fromNullable(a[0])

Generated using TypeDoc