Skip to content

Instantly share code, notes, and snippets.

@twobitfool
Created July 27, 2010 21:35
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 twobitfool/492915 to your computer and use it in GitHub Desktop.
Save twobitfool/492915 to your computer and use it in GitHub Desktop.
// this is (of course) a horrible simplification
// but assume that all objects have something like this...
function _get_set(prop, value){
if(typeof(value) !== "undefined"){
this['_' + prop] = value;
}
return this['_' + prop])
}
thing = {
height: function(value){ _get_set('height', value) }
width: function(value){ _get_set('width', value) }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment