source: node_modules/ramda/es/internal/_curry2.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 791 bytes
RevLine 
[d24f17c]1import _curry1 from "./_curry1.js";
2import _isPlaceholder from "./_isPlaceholder.js";
3/**
4 * Optimized internal two-arity curry function.
5 *
6 * @private
7 * @category Function
8 * @param {Function} fn The function to curry.
9 * @return {Function} The curried function.
10 */
11
12export default function _curry2(fn) {
13 return function f2(a, b) {
14 switch (arguments.length) {
15 case 0:
16 return f2;
17
18 case 1:
19 return _isPlaceholder(a) ? f2 : _curry1(function (_b) {
20 return fn(a, _b);
21 });
22
23 default:
24 return _isPlaceholder(a) && _isPlaceholder(b) ? f2 : _isPlaceholder(a) ? _curry1(function (_a) {
25 return fn(_a, b);
26 }) : _isPlaceholder(b) ? _curry1(function (_b) {
27 return fn(a, _b);
28 }) : fn(a, b);
29 }
30 };
31}
Note: See TracBrowser for help on using the repository browser.