Options
All
  • Public
  • Public/Protected
  • All
Menu

Module function/either

Index

References

Functions

References

Renames and re-exports either

Functions

  • A function wrapping calls to the two functions in an || operation, returning the result of the first function if it is truth-y and the result of the second function otherwise. Note that this is short-circuited, meaning that the second function will not be invoked if the first returns a truth-y value.

    example
     var gt10 = x => x > 10;
    var even = x => x % 2 === 0;
    var f = either(gt10, even);
    f(101); //=> true
    f(8); //=> true
    f(3); //=> false

    Type parameters

    • T

    Parameters

    Returns Pred<T>

    a function that applies its arguments to f and g and ||s their outputs together.

  • A function wrapping calls to the two functions in an || operation, returning the result of the first function if it is truth-y and the result of the second function otherwise. Note that this is short-circuited, meaning that the second function will not be invoked if the first returns a truth-y value.

    example
     var gt10 = x => x > 10;
    var even = x => x % 2 === 0;
    var f = either(gt10, even);
    f(101); //=> true
    f(8); //=> true
    f(3); //=> false

    Type parameters

    • T

    Parameters

    Returns (pred2: Pred<T>) => Pred<T>

    a function that applies its arguments to f and g and ||s their outputs together.

Generated using TypeDoc