1 |
|
2 | var nativeMax = Math.max;
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function composeArgsRight(args, partials, holders, isCurried) {
|
16 | var argsIndex = -1,
|
17 | argsLength = args.length,
|
18 | holdersIndex = -1,
|
19 | holdersLength = holders.length,
|
20 | rightIndex = -1,
|
21 | rightLength = partials.length,
|
22 | rangeLength = nativeMax(argsLength - holdersLength, 0),
|
23 | result = Array(rangeLength + rightLength),
|
24 | isUncurried = !isCurried;
|
25 |
|
26 | while (++argsIndex < rangeLength) {
|
27 | result[argsIndex] = args[argsIndex];
|
28 | }
|
29 | var offset = argsIndex;
|
30 | while (++rightIndex < rightLength) {
|
31 | result[offset + rightIndex] = partials[rightIndex];
|
32 | }
|
33 | while (++holdersIndex < holdersLength) {
|
34 | if (isUncurried || argsIndex < argsLength) {
|
35 | result[offset + holders[holdersIndex]] = args[argsIndex++];
|
36 | }
|
37 | }
|
38 | return result;
|
39 | }
|
40 |
|
41 | export default composeArgsRight;
|