Skip to content

Instantly share code, notes, and snippets.

@layonthebeech
Last active September 22, 2016 19:02
Show Gist options
  • Save layonthebeech/18d170f8024122eed5f37528b0c21898 to your computer and use it in GitHub Desktop.
Save layonthebeech/18d170f8024122eed5f37528b0c21898 to your computer and use it in GitHub Desktop.
Add a function "pipe" to the function prototype
Function.prototype.pipe = function(fun) {
return function(param) {
return fun(this(param));
}.bind(this); //The bind() method creates a new function that, when called, has its this keyword
}; //set to the provided value, with a given sequence of arguments preceding any provided
//when the new function is called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment