September 2018
Intermediate to advanced
302 pages
7h 17m
English
It is nice that we can curry a function, but what if we wanted to pass arguments in a different sequence? For the change of the first two arguments, there is a handy function called flip, demonstrated here:
const someFunc = x => y => z => x + y + z;const someFuncYFirst = R.flip(someFunc);// equivalent to (y => x => z => x + y + z;)
If we needed to reverse all of the arguments, unfortunately there is no such function. But we can write it out nonetheless for our use case:
const someFuncReverseArgs = z => y => x => someFunc(x, y, z);
Read now
Unlock full access