Lodash – curry Right method

  • Post author:
  • Post category:Lodash
  • Post comments:1 Comment
Lodash - curry Right method

Syntax Of Lodash curry Right method

_.curryRight(func, [arity=func.length])

This Lodash curry Right method is like _.curry except that arguments are applied to func in the manner of _.partialRight instead of _.partial.

Arguments

  • func (Function) โˆ’ The function to curry.
  • [arity=func.length] (number) โˆ’ The arity of func.

Output

  • (Function) โˆ’ Returns the new curried function.

Example

var _ = require('lodash');
var getArray = function(a, b, c) {
   return [a, b, c];
};
 
var curried = _.curryRight(getArray);
 
console.log(curried(3)(2)(1));
console.log(curried(3, 2)(1));
console.log(curried(3, 2, 1));

Save the above program in tester.js. Run the following command to execute this program.

Command

\>node tester.js

Output

[ 1, 2, 3 ]
[ 1, 3, 2 ]
[ 3, 2, 1 ]

Next Topic – Click Here

This Post Has One Comment

Leave a Reply