Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Function3<T1, T2, T3, R>

Function3 encapsulates a function taking three parameters and returning a value. It adds some useful functions to combine or transform functions.

Type parameters

  • T1

    the first parameter type

  • T2

    the second parameter type

  • T3

    the third parameter type

  • R

    the result type

Hierarchy

  • Function3

Callable

  • __call(x: T1, y: T2, z: T3): R
  • Invoke the function

    Parameters

    • x: T1
    • y: T2
    • z: T3

    Returns R

Index

Methods

andThen

  • andThen<V>(fn: function): Function3<T1, T2, T3, V>
  • Returns a new composed function which first applies the current function and then the one you pass as parameter.

    Type parameters

    • V

    Parameters

    • fn: function
        • (x: R): V
        • Parameters

          • x: R

          Returns V

    Returns Function3<T1, T2, T3, V>

apply1

  • Applies this function partially to one argument.

    const plus5 = Function3.of(
        (x:number,y:number,z:number)=>x+y+z)
           .apply1(5);
    assert.equal(8, plus5(1,2));
    

    Parameters

    • param1: T1

    Returns Function2<T2, T3, R>

apply2

  • apply2(param1: T1, param2: T2): Function1<T3, R>
  • Applies this function partially to two arguments.

    const plus54 = Function3.of(
        (x:number,y:number,z:number)=>x+y+z)
           .apply2(5,4);
    assert.equal(12, plus54(3));
    

    Parameters

    • param1: T1
    • param2: T2

    Returns Function1<T3, R>

curried

flipped

  • Returns a version of this function taking its parameters in the reverse order.

    Returns Function3<T3, T2, T1, R>

tupled

  • Returns a version of this function which takes a tuple instead of individual parameters.

    Returns Function1<[T1, T2, T3], R>

Generated using TypeDoc