Skip to content

Instantly share code, notes, and snippets.

@shaneharter
Forked from evilbuck/tap.js
Created December 18, 2012 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shaneharter/4330744 to your computer and use it in GitHub Desktop.
Save shaneharter/4330744 to your computer and use it in GitHub Desktop.
Object.defineProperty(Object.prototype, 'tap', {
value: function(fun){
fun.call( this );
return this;
},
enumerable: false
});
// Usage:
// a = [];
// a.tap(function(){ this.push('foo'); });
// a => [ 'foo' ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment