-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
30 lines (26 loc) · 877 Bytes
/
Copy pathindex.js
File metadata and controls
30 lines (26 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import compose from "ramda/es/compose";
import __ from "ramda/es/__";
import uncurryN from "ramda/es/uncurryN";
import curry from "ramda/es/curry";
const lastFn = curry((firstArg, secondArg) => {
console.log("lastFn-firstArg", firstArg);
if (!firstArg) {
console.error("missing argument");
}
console.log("lastFn-secondArg", secondArg);
return "finish";
});
const firstFn = firstArg => {
console.log("firstFn-firstArg", firstArg);
if (!firstArg) {
console.error("missing argument");
}
return firstArg;
};
const incorrectBehaviour = uncurryN(2, compose(lastFn, firstFn));
const correctBehaviour = (firstArg, secondArg) =>
compose(lastFn(__, secondArg), firstFn)(firstArg);
console.log("--- this is correct for unmifified and minified ---");
correctBehaviour(1, 2);
console.log("--- this is incorrect when minified ---");
incorrectBehaviour(1, 2);