Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Function5<T1, T2, T3, T4, T5, R>

Function5 encapsulates a function taking give 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

  • T5

    the fifth parameter type

  • R

    the result type

Hierarchy

  • Function5

Callable

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

    Parameters

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

    Returns R

Index

Methods

andThen

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

apply1

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

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

    Parameters

    • param1: T1

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

apply2

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

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

    Parameters

    • param1: T1
    • param2: T2

    Returns Function3<T3, T4, T5, R>

apply3

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

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

    Parameters

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

    Returns Function2<T4, T5, R>

apply4

  • apply4(param1: T1, param2: T2, param3: T3, param4: T4): Function1<T5, R>
  • Applies this function partially to four arguments.

    const plus5123 = Function5.of(
        (x:number,y:number,z:number,a:number,b:number)=>x+y+z+a+b)
           .apply4(5,1,2,3);
    assert.equal(15, plus5123(4));
    

    Parameters

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

    Returns Function1<T5, R>

curried

flipped

  • flipped(): Function5<T5, T4, T3, T2, T1, R>
  • Returns a version of this function taking its parameters in the reverse order.

    Returns Function5<T5, T4, T3, T2, T1, R>

tupled

  • tupled(): Function1<[T1, T2, T3, T4, T5], R>
  • Returns a version of this function which takes a tuple instead of individual parameters.

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

Generated using TypeDoc