Function partialRight

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • R

      The return type of the function.

    Parameters

    • func: (() => R)

      The function to invoke.

        • (): R
        • Returns R

    Returns (() => R)

    Returns the new function.

      • (): R
      • Returns R

    const getValue = () => 42;
    const getValueFunc = partialRight(getValue);
    console.log(getValueFunc()); // => 42
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1) => R)

      The function to partially apply arguments to.

        • (arg1): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    Returns (() => R)

    Returns the new partially applied function.

      • (): R
      • Returns R

    const addOne = (num: number) => num + 1;
    const addOneFunc = partialRight(addOne, 1);
    console.log(addOneFunc()); // => 2
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1) => R)

      The function to partially apply arguments to.

        • (arg1): R
        • Parameters

          Returns R

    Returns ((arg1: T1) => R)

    Returns the new partially applied function.

      • (arg1): R
      • Parameters

        Returns R

    const multiplyBy = (factor: number) => (num: number) => num * factor;
    const double = partialRight(multiplyBy(2));
    console.log(double(5)); // => 10
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1) => R)

      The function to partially apply arguments to.

        • (arg1): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    Returns (() => R)

    Returns the new partially applied function.

      • (): R
      • Returns R

    const greet = (name: string) => `Hello, ${name}!`;
    const greetJohn = partialRight(greet, 'John');
    console.log(greetJohn()); // => 'Hello, John!'
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2) => R)

      The function to partially apply arguments to.

        • (arg1, arg2): R
        • Parameters

          Returns R

    Returns ((arg1: T1, arg2: T2) => R)

    Returns the new partially applied function.

      • (arg1, arg2): R
      • Parameters

        Returns R

    const subtract = (a: number, b: number) => a - b;
    const subtractFive = partialRight(subtract);
    console.log(subtractFive(10, 5)); // => 5
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2) => R)

      The function to partially apply arguments to.

        • (arg1, arg2): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: typeof partialRightPlaceholder

      The placeholder for the second argument.

    Returns ((arg2: T2) => R)

    Returns the new partially applied function.

      • (arg2): R
      • Parameters

        Returns R

    const concat = (a: string, b: string) => a + b;
    const concatWithHello = partialRight(concat, 'Hello', partialRight.placeholder);
    console.log(concatWithHello(' World!')); // => 'Hello World!'
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2) => R)

      The function to partially apply arguments to.

        • (arg1, arg2): R
        • Parameters

          Returns R

    • arg2: T2

      The second argument to be partially applied.

    Returns ((arg1: T1) => R)

    Returns the new partially applied function.

      • (arg1): R
      • Parameters

        Returns R

    const divide = (a: number, b: number) => a / b;
    const divideByTwo = partialRight(divide, 2);
    console.log(divideByTwo(10)); // => 5
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2) => R)

      The function to partially apply arguments to.

        • (arg1, arg2): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: T2

      The second argument to be partially applied.

    Returns (() => R)

    Returns the new partially applied function.

      • (): R
      • Returns R

    const multiply = (a: number, b: number) => a * b;
    const multiplyByThreeAndFour = partialRight(multiply, 3, 4);
    console.log(multiplyByThreeAndFour()); // => 12
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3): R
        • Parameters

          Returns R

    Returns ((arg1: T1, arg2: T2, arg3: T3) => R)

    Returns the new partially applied function.

      • (arg1, arg2, arg3): R
      • Parameters

        Returns R

    const sumThree = (a: number, b: number, c: number) => a + b + c;
    const sumWithFive = partialRight(sumThree);
    console.log(sumWithFive(1, 2, 5)); // => 8
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: typeof partialRightPlaceholder

      The placeholder for the second argument.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    Returns ((arg2: T2, arg3: T3) => R)

    Returns the new partially applied function.

      • (arg2, arg3): R
      • Parameters

        Returns R

    const formatDate = (day: number, month: number, year: number) => `${day}/${month}/${year}`;
    const formatDateWithDay = partialRight(formatDate, 1, partialRight.placeholder, partialRight.placeholder);
    console.log(formatDateWithDay(12, 2023)); // => '1/12/2023'
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3): R
        • Parameters

          Returns R

    • arg2: T2

      The second argument to be partially applied.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    Returns ((arg1: T1, arg3: T3) => R)

    Returns the new partially applied function.

      • (arg1, arg3): R
      • Parameters

        Returns R

    const createUser = (name: string, age: number, country: string) => `${name}, ${age} years old from ${country}`;
    const createUserFromUSA = partialRight(createUser, 'USA', partialRight.placeholder);
    console.log(createUserFromUSA('John', 30)); // => 'John, 30 years old from USA'
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: T2

      The second argument to be partially applied.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    Returns ((arg3: T3) => R)

    Returns the new partially applied function.

      • (arg3): R
      • Parameters

        Returns R

    const logMessage = (level: string, message: string, timestamp: string) => `[${level}] ${message} at ${timestamp}`;
    const logError = partialRight(logMessage, 'ERROR', '2023-10-01');
    console.log(logError('Something went wrong!')); // => '[ERROR] Something went wrong! at 2023-10-01'
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3): R
        • Parameters

          Returns R

    • arg3: T3

      The third argument to be partially applied.

    Returns ((arg1: T1, arg2: T2) => R)

    Returns the new partially applied function.

      • (arg1, arg2): R
      • Parameters

        Returns R

    const calculateArea = (length: number, width: number) => length * width;
    const calculateAreaWithWidth = partialRight(calculateArea, 5);
    console.log(calculateAreaWithWidth(10)); // => 50
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: typeof partialRightPlaceholder

      The placeholder for the second argument.

    • arg3: T3

      The third argument to be partially applied.

    Returns ((arg2: T2) => R)

    Returns the new partially applied function.

      • (arg2): R
      • Parameters

        Returns R

    const formatCurrency = (amount: number, currency: string) => `${amount} ${currency}`;
    const formatUSD = partialRight(formatCurrency, 100, partialRight.placeholder);
    console.log(formatUSD('USD')); // => '100 USD'
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3): R
        • Parameters

          Returns R

    • arg2: T2

      The second argument to be partially applied.

    • arg3: T3

      The third argument to be partially applied.

    Returns ((arg1: T1) => R)

    Returns the new partially applied function.

      • (arg1): R
      • Parameters

        Returns R

    const createProfile = (name: string, age: number, country: string) => `${name}, ${age} from ${country}`;
    const createProfileFromCanada = partialRight(createProfile, 'Canada', 'John');
    console.log(createProfileFromCanada(30)); // => 'John, 30 from Canada'
  • Type Parameters

    • T1
    • T2
    • T3
    • R

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3) => R)
        • (arg1, arg2, arg3): R
        • Parameters

          Returns R

    • arg1: T1
    • arg2: T2
    • arg3: T3

    Returns (() => R)

      • (): R
      • Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    Returns ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

    Returns a new function that takes four arguments.

      • (arg1, arg2, arg3, arg4): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: typeof partialRightPlaceholder

      The placeholder for the second argument.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    • arg4: typeof partialRightPlaceholder

      The placeholder for the fourth argument.

    Returns ((arg2: T2, arg3: T3, arg4: T4) => R)

    Returns a new function that takes the second, third, and fourth arguments.

      • (arg2, arg3, arg4): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg2: T2

      The second argument to be partially applied.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    • arg4: typeof partialRightPlaceholder

      The placeholder for the fourth argument.

    Returns ((arg1: T1, arg3: T3, arg4: T4) => R)

    Returns a new function that takes the first, third, and fourth arguments.

      • (arg1, arg3, arg4): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: T2

      The second argument to be partially applied.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    • arg4: typeof partialRightPlaceholder

      The placeholder for the fourth argument.

    Returns ((arg3: T3, arg4: T4) => R)

    Returns a new function that takes the third and fourth arguments.

      • (arg3, arg4): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg3: T3

      The third argument to be partially applied.

    • arg4: typeof partialRightPlaceholder

      The placeholder for the fourth argument.

    Returns ((arg1: T1, arg2: T2, arg4: T4) => R)

    Returns a new function that takes the first, second, and fourth arguments.

      • (arg1, arg2, arg4): R
      • Parameters

        Returns R

  • Creates a function that invokes func with the first argument, a placeholder for the second argument, This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: typeof partialRightPlaceholder

      The placeholder for the second argument.

    • arg3: T3

      The third argument to be partially applied.

    • arg4: typeof partialRightPlaceholder

      The placeholder for the fourth argument.

    Returns ((arg2: T2, arg4: T4) => R)

    Returns a new function that takes the second and fourth arguments.

      • (arg2, arg4): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg2: T2

      The second argument to be partially applied.

    • arg3: T3

      The third argument to be partially applied.

    • arg4: typeof partialRightPlaceholder

      The placeholder for the fourth argument.

    Returns ((arg1: T1, arg4: T4) => R)

    Returns a new function that takes the first and fourth arguments.

      • (arg1, arg4): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: T2

      The second argument to be partially applied.

    • arg3: T3

      The third argument to be partially applied.

    • arg4: typeof partialRightPlaceholder

      The placeholder for the fourth argument.

    Returns ((arg4: T4) => R)

    Returns a new function that takes the fourth argument.

      • (arg4): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg4: T4

      The fourth argument to be partially applied.

    Returns ((arg1: T1, arg2: T2, arg3: T3) => R)

    Returns a new function that takes the first, second, and third arguments.

      • (arg1, arg2, arg3): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: typeof partialRightPlaceholder

      The placeholder for the second argument.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    • arg4: T4

      The fourth argument to be partially applied.

    Returns ((arg2: T2, arg3: T3) => R)

    Returns a new function that takes the second and third arguments.

      • (arg2, arg3): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg2: T2

      The second argument to be partially applied.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    • arg4: T4

      The fourth argument to be partially applied.

    Returns ((arg1: T1, arg3: T3) => R)

    Returns a new function that takes the first and third arguments.

      • (arg1, arg3): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: T2

      The second argument to be partially applied.

    • arg3: typeof partialRightPlaceholder

      The placeholder for the third argument.

    • arg4: T4

      The fourth argument to be partially applied.

    Returns ((arg3: T3) => R)

    Returns a new function that takes the third argument.

      • (arg3): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg3: T3

      The third argument to be partially applied.

    • arg4: T4

      The fourth argument to be partially applied.

    Returns ((arg1: T1, arg2: T2) => R)

    Returns a new function that takes the first and second arguments.

      • (arg1, arg2): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: typeof partialRightPlaceholder

      The placeholder for the second argument.

    • arg3: T3

      The third argument to be partially applied.

    • arg4: T4

      The fourth argument to be partially applied.

    Returns ((arg2: T2) => R)

    Returns a new function that takes the second argument.

      • (arg2): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg2: T2

      The second argument to be partially applied.

    • arg3: T3

      The third argument to be partially applied.

    • arg4: T4

      The fourth argument to be partially applied.

    Returns ((arg1: T1) => R)

    Returns a new function that takes the first argument.

      • (arg1): R
      • Parameters

        Returns R

  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Type Parameters

    • T1

      The type of the first argument.

    • T2

      The type of the second argument.

    • T3

      The type of the third argument.

    • T4

      The type of the fourth argument.

    • R

      The return type of the function.

    Parameters

    • func: ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => R)

      The function to partially apply arguments to.

        • (arg1, arg2, arg3, arg4): R
        • Parameters

          Returns R

    • arg1: T1

      The first argument to be partially applied.

    • arg2: T2

      The second argument to be partially applied.

    • arg3: T3

      The third argument to be partially applied.

    • arg4: T4

      The fourth argument to be partially applied.

    Returns (() => R)

    Returns the new partially applied function.

      • (): R
      • Returns R

    const concatenate = (a: string, b: string, c: string, d: string) => a + b + c + d;
    const concatenateHelloWorld = partialRight(concatenate, 'Hello', ' ', 'World', '!');
    console.log(concatenateHelloWorld()); // => 'Hello World!'
  • This method is like partial except that partially applied arguments are appended to the arguments it receives.

    The partialRight.placeholder value, which defaults to a symbol, may be used as a placeholder for partially applied arguments.

    Note: This method doesn't set the length property of partially applied functions.

    Parameters

    • func: ((...args: any[]) => any)

      The function to partially apply arguments to.

        • (...args): any
        • Parameters

          • Rest...args: any[]

          Returns any

    • Rest...args: any[]

      The arguments to be partially applied.

    Returns ((...args: any[]) => any)

    Returns the new partially applied function.

      • (...args): any
      • Parameters

        • Rest...args: any[]

        Returns any

    const log = (...messages: string[]) => console.log(...messages);
    const logError = partialRight(log, 'Error:');
    logError('Something went wrong!'); // => 'Error: Something went wrong!'

Properties

Properties

placeholder: typeof partialRightPlaceholder