main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | import _curry1 from "./_curry1.js";
|
---|
2 | import _curry2 from "./_curry2.js";
|
---|
3 | import _isPlaceholder from "./_isPlaceholder.js";
|
---|
4 | /**
|
---|
5 | * Optimized internal three-arity curry function.
|
---|
6 | *
|
---|
7 | * @private
|
---|
8 | * @category Function
|
---|
9 | * @param {Function} fn The function to curry.
|
---|
10 | * @return {Function} The curried function.
|
---|
11 | */
|
---|
12 |
|
---|
13 | export default function _curry3(fn) {
|
---|
14 | return function f3(a, b, c) {
|
---|
15 | switch (arguments.length) {
|
---|
16 | case 0:
|
---|
17 | return f3;
|
---|
18 |
|
---|
19 | case 1:
|
---|
20 | return _isPlaceholder(a) ? f3 : _curry2(function (_b, _c) {
|
---|
21 | return fn(a, _b, _c);
|
---|
22 | });
|
---|
23 |
|
---|
24 | case 2:
|
---|
25 | return _isPlaceholder(a) && _isPlaceholder(b) ? f3 : _isPlaceholder(a) ? _curry2(function (_a, _c) {
|
---|
26 | return fn(_a, b, _c);
|
---|
27 | }) : _isPlaceholder(b) ? _curry2(function (_b, _c) {
|
---|
28 | return fn(a, _b, _c);
|
---|
29 | }) : _curry1(function (_c) {
|
---|
30 | return fn(a, b, _c);
|
---|
31 | });
|
---|
32 |
|
---|
33 | default:
|
---|
34 | return _isPlaceholder(a) && _isPlaceholder(b) && _isPlaceholder(c) ? f3 : _isPlaceholder(a) && _isPlaceholder(b) ? _curry2(function (_a, _b) {
|
---|
35 | return fn(_a, _b, c);
|
---|
36 | }) : _isPlaceholder(a) && _isPlaceholder(c) ? _curry2(function (_a, _c) {
|
---|
37 | return fn(_a, b, _c);
|
---|
38 | }) : _isPlaceholder(b) && _isPlaceholder(c) ? _curry2(function (_b, _c) {
|
---|
39 | return fn(a, _b, _c);
|
---|
40 | }) : _isPlaceholder(a) ? _curry1(function (_a) {
|
---|
41 | return fn(_a, b, c);
|
---|
42 | }) : _isPlaceholder(b) ? _curry1(function (_b) {
|
---|
43 | return fn(a, _b, c);
|
---|
44 | }) : _isPlaceholder(c) ? _curry1(function (_c) {
|
---|
45 | return fn(a, b, _c);
|
---|
46 | }) : fn(a, b, c);
|
---|
47 | }
|
---|
48 | };
|
---|
49 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.