Last active
December 10, 2015 07:18
-
-
Save jcready/4399669 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Model(props) { | |
var obj = { 'props': props }; | |
for (o in obj.props) { | |
if (obj.props.hasOwnProperty(o)) { | |
this[o] = new Function("value", "if (!arguments.length) return typeof this.props['" + o.toString() + | |
"'] == 'function' ? this.props['" + o.toString() + "'].call(this) : this.props['" + o.toString() + "'];" + | |
"this.props['" + o.toString() + "'] = (typeof value == 'function' ? value.call(this) : value); return this") | |
} | |
} | |
return obj; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment