Skip to content

Instantly share code, notes, and snippets.

@masylum
Created May 11, 2012 09:50
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 masylum/2658687 to your computer and use it in GitHub Desktop.
Save masylum/2658687 to your computer and use it in GitHub Desktop.
Pseudo `&:foo` implementation in javascript
function prop(propName) {
return function(obj) {
var property = obj[propName];
if (typeof property === 'function') {
return property();
} else {
return property;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment