Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "public/otherwise"

Index

References

Functions

References

_

Renames and re-exports otherwise

rest

Renames and re-exports otherwise

Functions

Const otherwise

  • otherwise(useDefault: TOut | ((val: TIn) => TOut)): (Anonymous function)
  • description

    Always executes a match, using either a constant value of type R or a delegate that returns a value of type R

    since

    1.0.0

    example
    enum Time {
        Morning = 'Morning',
        Noon = 'Noon',
        Afternoon = 'Afternoon',
    }
    
    const actual = strike(
        'Night',
        match(Time.Morning, 'Good morning!'),
        otherwise('Goodnight!')
    );
    
    assertEq(actual, 'Goodnight!');

    Parameters

    • useDefault: TOut | ((val: TIn) => TOut)

    Returns (Anonymous function)

Generated using TypeDoc