UNPKG

1.69 kBJavaScriptView Raw
1var _curry1 =
2/*#__PURE__*/
3require("./_curry1");
4
5var _curry2 =
6/*#__PURE__*/
7require("./_curry2");
8
9var _isPlaceholder =
10/*#__PURE__*/
11require("./_isPlaceholder");
12/**
13 * Optimized internal three-arity curry function.
14 *
15 * @private
16 * @category Function
17 * @param {Function} fn The function to curry.
18 * @return {Function} The curried function.
19 */
20
21
22function _curry3(fn) {
23 return function f3(a, b, c) {
24 switch (arguments.length) {
25 case 0:
26 return f3;
27
28 case 1:
29 return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {
30 return fn(a, _b, _c);
31 });
32
33 case 2:
34 return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {
35 return fn(_a, b, _c);
36 }) : _isPlaceholder(b) ? _curry2(function (_b, _c) {
37 return fn(a, _b, _c);
38 }) : _curry1(function (_c) {
39 return fn(a, b, _c);
40 });
41
42 default:
43 return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {
44 return fn(_a, _b, c);
45 }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {
46 return fn(_a, b, _c);
47 }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {
48 return fn(a, _b, _c);
49 }) : _isPlaceholder(a) ? _curry1(function (_a) {
50 return fn(_a, b, c);
51 }) : _isPlaceholder(b) ? _curry1(function (_b) {
52 return fn(a, _b, c);
53 }) : _isPlaceholder(c) ? _curry1(function (_c) {
54 return fn(a, b, _c);
55 }) : fn(a, b, c);
56 }
57 };
58}
59
60module.exports = _curry3;
\No newline at end of file