January 2020
Intermediate to advanced
470 pages
11h 13m
English
We can find a solution to currying by using the bind() method. This allows us to fix one argument (or more, if need be; we won't be needing to do that here, but later on we will use it) and provide a function with that fixed argument. Of course, many libraries (such as Lodash, Underscore, Ramda, and others) provide this functionality, but we want to see how to implement that by ourselves.
Our implementation is quite short but will require some explanation:
const curryByBind = fn => fn.length === 0 ? fn() : p => curryByBind(fn.bind(null, ...
Read now
Unlock full access