How to use the binary function from ramda

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

5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
*        return [a, b, c];
*      };
*      takesThreeArgs.length; //=> 3
*      takesThreeArgs(1, 2, 3); //=> [1, 2, 3]
*
*      var takesTwoArgs = R.binary(takesThreeArgs);
*      takesTwoArgs.length; //=> 2
*      // Only 2 arguments are passed to the wrapped function
*      takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]
*/
fork icon0
star icon0
watch icon0

+ 17 other calls in file

173
174
175
176
177
178
179
180
181
182
183
184
185


var takesThressArgs = function (a, b, c) {
  return [a, b, c];
};


var takesTwoArgs = R.binary(takesThressArgs);
log(takesTwoArgs(1, 2, 3));


var sayX = x => log('x is ' + x);
log(R.tap(sayX)(100));
fork icon0
star icon0
watch icon0

+ 9 other calls in file

1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
*        return [a, b, c];
*      };
*      takesThreeArgs.length; //=> 3
*      takesThreeArgs(1, 2, 3); //=> [1, 2, 3]
*
*      const takesTwoArgs = R.binary(takesThreeArgs);
*      takesTwoArgs.length; //=> 2
*      // Only 2 arguments are passed to the wrapped function
*      takesTwoArgs(1, 2, 3); //=> [1, 2, undefined]
* @symb R.binary(f)(a, b, c) = f(a, b)
fork icon0
star icon0
watch icon2

+ 7 other calls in file

1
2
3
4
5
6
7
8
9
10
11
12


// binary | (a → b → c → … → z) → ((a, b) → z)
// :wraps any function in a function that accepts exactly 2 parameters
Math.max(10, 20, 30, 40)
// 40
const maxFromPair = R.binary(Math.max)
maxFromPair(10, 20, 30, 40)
// 20



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)