Function maybe

  • maybe('something').map(value => value + ' more').orNull() // produces: "something more"
    maybe(null).map(value => value + ' more').orNull() // produces: null
    maybe(undefined).map(value => value + ' more').orNull() // produces: null
    maybe(NaN).map(value => value + ' more').orNull() // produces: null

    Type Parameters

    • THING

    Parameters

    Returns Maybe<THING>

    Default Value

    for isSomething === not('undefined' || type === 'null' || type === 'nan')