JSFiddle - React, Tailwind, and code Playground
JavaScript
Function.prototype.it = (function() {
return function() {
var args = arguments;
return function(){
Array.prototype.push.apply(arguments, args);
return this.apply(null, arguments);
}.bind(this);
};
}());
function foo(a, b, c) {
console.log('a is ' + a, ' | b is ' + b, ' | c is ' + c);
};
foo(1, 2, 3);
// pretty useful for .then()
foo.it(2, 3)(1);
foo.it(3)(1, 2);
/* // Check promises native or with your favorite library ..
Promise.resolve(1).then(foo.it(2, 3))
*/