Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
27 lines (20 sloc) 673 Bytes


Dynobj implements a new class of objects that support dynamic get and set functions for dynamic attributes (similar to languages like Python).


var DynObj = new (require('dynobj').DynObj)()
var MyCoolClass = DynObj.create()
MyCoolClass.prototype.__get__ = function(key) {
	return 'cool '+key

MyCoolClass.prototype.__set__ = function(key, val) {
    if (key === 'allowed')
	    return true // default behaviour

    // returning anything other that true will suppress the default behaviour and allows you you override
    console.log('someone tried to set '+key)
    return false


As described in LICENSE