Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

map

  • Map if there is a value, otherwise return undefined

    Example

    let a: 2 = map(1, v => v + 1)
    let b: undefined = map(null, v => v + 1)

    Type parameters

    • T

    • U

    Parameters

    • v: Maybe<T>
    • f: (v: T) => U
        • (v: T): U
        • Parameters

          • v: T

          Returns U

    Returns Voidable<U>

mapOr

  • Map if there is a value, otherwise return default value

    Example

    let a: 2 = map(1, 3, v => v + 1)
    let b: 3 = map(null, 3, v => v + 1)

    Type parameters

    • T

    • U

    Parameters

    Returns U

okOr

and

  • Return undefined if the value is None, otherwise return other.

    Type parameters

    • T

    • U

    Parameters

    Returns Maybe<U>

then

  • Return undefined if the value is None, otherwise call f with the value and return the result

    Type parameters

    • T

    • U

    Parameters

    Returns Maybe<U>

or

  • Return the value if the value is value, otherwise return other

    Type parameters

    • T

    Parameters

    Returns Maybe<T>

xor

  • return value if exactly one of v, other is value, otherwise return undefined

    Type parameters

    • T

    Parameters

    Returns Voidable<T>

transpose

take

  • Take the value, set the value in the box to undefined

    Type parameters

    • T

    Parameters

    Returns Voidable<T>

replace

zip

  • zip<O>(...o: O): Voidable<{ [ I in keyof O]: O[I] extends Maybe<infer V> ? V : never }>
  • As long as any value in the tuple is None, return undefined

    Example

    let a: [1, 2, 3] = zip(1, 2, 3)
    let b: undefined = zip(1, null, 3)
    let c: undefined = zip(1, 2, undefined)

    Type parameters

    • O: unknown[]

    Parameters

    • Rest ...o: O

    Returns Voidable<{ [ I in keyof O]: O[I] extends Maybe<infer V> ? V : never }>

Generated using TypeDoc