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
Pingback: Lodash - curry method - Adglob Infosystem Pvt Ltd