How to use the nAry function from ramda

Find comprehensive JavaScript ramda.nAry code examples handpicked from public code repositorys.

3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
*      var takesTwoArgs = (a, b) => [a, b];
*
*      takesTwoArgs.length; //=> 2
*      takesTwoArgs(1, 2); //=> [1, 2]
*
*      var takesOneArg = R.nAry(1, takesTwoArgs);
*      takesOneArg.length; //=> 1
*      // Only `n` arguments are passed to the wrapped function
*      takesOneArg(1, 2); //=> [1, undefined]
*/
fork icon0
star icon0
watch icon0

+ 17 other calls in file

10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
*      const takesTwoArgs = (a, b) => [a, b];
*
*      takesTwoArgs.length; //=> 2
*      takesTwoArgs(1, 2); //=> [1, 2]
*
*      const takesOneArg = R.nAry(1, takesTwoArgs);
*      takesOneArg.length; //=> 1
*      // Only `n` arguments are passed to the wrapped function
*      takesOneArg(1, 2); //=> [1, undefined]
* @symb R.nAry(0, f)(a, b) = f()
fork icon0
star icon0
watch icon2

+ 15 other calls in file

16
17
18
19
20
21
22
23
24
25
26






// nAry | Number → (* → a) → (* → a)
// :wraps any function in a unction that accepts exactly n parameters
const maxFromN = R.nAry(5, Math.max)
maxFromN(10, 20, 30, 40, 50)
// 50
fork icon0
star icon0
watch icon0

Other functions in ramda

Sorted by popularity

function icon

ramda.clone is the most popular function in ramda (30311 examples)