function createDerivedProperty(modelProto, name, definition) {
    var def = modelProto._derived[name] = {
        fn: isFunction(definition) ? definition : definition.fn,
        cache: (definition.cache !== false),
        depList: definition.deps || []
    };

    // add to our shared dependency list
    def.depList.forEach(function (dep) {
        modelProto._deps[dep] = union(modelProto._deps[dep] || [], [name]);
    });

    // defined a top-level getter for derived names
    Object.defineProperty(modelProto, name, {
        get: function () {
            return this._getDerivedProperty(name);
        },
        set: function () {
            throw new TypeError("`" + name + "` is a derived property, it can't be set directly.");
        }
    });
}
function createDerivedProperty(modelProto, name, definition) {
    var def = modelProto._derived[name] = {
        fn: isFunction(definition) ? definition : definition.fn,
        cache: (definition.cache !== false),
        depList: definition.deps || []
    };

    
    def.depList.forEach(function (dep) {
        modelProto._deps[dep] = union(modelProto._deps[dep] || [], [name]);
    });

    
    Object.defineProperty(modelProto, name, {
        get: function () {
            return this._getDerivedProperty(name);
        },
        set: function () {
            throw new TypeError("`" + name + "` is a derived property, it can't be set directly.");
        }
    });
}
function createDerivedProperty ( modelProto , name , definition ) { var def = modelProto . _derived [ name ] = { fn : isFunction ( definition ) ? definition : definition . fn , cache : ( definition . cache !== false ) , depList : definition . deps || [ ] } ; // add to our shared dependency list def . depList . forEach ( function ( dep ) { modelProto . _deps [ dep ] = union ( modelProto . _deps [ dep ] || [ ] , [ name ] ) ; } ) ; // defined a top-level getter for derived names Object . defineProperty ( modelProto , name , { get : function ( ) { return this . _getDerivedProperty ( name ) ; } , set : function ( ) { throw new TypeError ( "`" + name + "` is a derived property, it can't be set directly." ) ; } } ) ; }
helper for creating derived property definitions
helper for creating derived property definitions