Skip to content

Instantly share code, notes, and snippets.

@hkjpotato
Created April 8, 2017 02:54
Show Gist options
  • Save hkjpotato/62c65943d6c7cb9655a8ca690042ecbf to your computer and use it in GitHub Desktop.
Save hkjpotato/62c65943d6c7cb9655a8ca690042ecbf to your computer and use it in GitHub Desktop.
function magician (targetfn) {
var numOfArgs = targetfn.length;
if (arguments.length - 1 < numOfArgs) {
return magician.bind(null, ...arguments);
} else {
return targetfn.apply(null, Array.prototype.slice.call(arguments, 1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment