JSFiddle - React, Tailwind, and code Playground
JavaScript
/**
* Transforms a function that takes multiple arguments into a
* function that takes just the last argument of the original function.
*
* @param {Function}
* @param {...*}
*/
var curry = function (method) {
var args = Array.prototype.slice.call(arguments, 1);
return function (callback) {
args.push(callback);
return method.apply({}, args);
};
};