Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Function4<T1, T2, T3, T4, R>

Function4 encapsulates a function taking four 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

  • T4

    the fourth parameter type

  • R

    the result type

Hierarchy

  • Function4

Callable

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

    Parameters

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

    Returns R

Index

Methods

andThen

  • andThen<V>(fn: function): Function4<T1, T2, T3, T4, 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 Function4<T1, T2, T3, T4, V>

apply1

  • apply1(param1: T1): Function3<T2, T3, T4, R>
  • Applies this function partially to one argument.

    const plus5 = Function4.of(
        (x:number,y:number,z:number,a:number)=>x+y+z+a)
           .apply1(5);
    assert.equal(11, plus5(1,2,3));
    

    Parameters

    • param1: T1

    Returns Function3<T2, T3, T4, R>

apply2

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

    const plus51 = Function4.of(
        (x:number,y:number,z:number,a:number)=>x+y+z+a)
           .apply2(5,1);
    assert.equal(11, plus51(2,3));
    

    Parameters

    • param1: T1
    • param2: T2

    Returns Function2<T3, T4, R>

apply3

  • apply3(param1: T1, param2: T2, param3: T3): Function1<T4, R>
  • Applies this function partially to three arguments.

    const plus512 = Function4.of(
        (x:number,y:number,z:number,a:number)=>x+y+z+a)
           .apply3(5,1,2);
    assert.equal(11, plus512(3));
    

    Parameters

    • param1: T1
    • param2: T2
    • param3: T3

    Returns Function1<T4, R>

curried

flipped

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

    Returns Function4<T4, T3, T2, T1, R>

tupled

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

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

Generated using TypeDoc