Skip to content

Instantly share code, notes, and snippets.

@lfborjas
Created November 4, 2012 23:06
Show Gist options
  • Save lfborjas/4014264 to your computer and use it in GitHub Desktop.
Save lfborjas/4014264 to your computer and use it in GitHub Desktop.
var wrapped = function( obj ){
this.self = obj;
};
wrapped.prototype.maybe = function( prop ){
return this.self.hasOwnProperty( prop ) ? this.self[prop] : this.self;
}
var _ = function( obj ){
return new wrapped( obj );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment