lib/model.js
function createModelProxy(model) {

    // Create a Proxy handle
    var handle = {
        getOwnPropertyDescriptor: function(target, name) {
            return ObjProto.getOwnPropertyDescriptor.call(model.attributes, name);
        },
        getOwnPropertyNames: function(target) {
            return ObjProto.getOwnPropertyNames.call(model.attributes);
        },
        defineProperty: function(name, propertyDescriptor) {
            return Object.defineProperty(model.attributes, name, propertyDescriptor);
        },
        // Get an attribute from the Model. This will first check for Model properties before
        // checking the Model's internal attributes map.
        get: function(target, name, reciever) {
            // Check for direct properties to satisfy internal attribute and function calls
            if (model[name]) {
                return model[name];
            }

            // It's not a property, check for internal attribute value
            return model.get(name);
        },
        set: function(target, name, value, receiver) {
            return model.set(name, value);
        },
        delete: function(name) {
            model.unset(name);
        },
        has: function(target, name) {
            return model.has('name');
        },
        hasOwn: function(target, name) {
            return this.has(target, name);
        },
        enumerate: function(target) {
            return model.attributes;
        },
        keys: function(target) {
            return Object.keys(model.attributes);
        }
        //protect: function(operation, target) -> boolean
        //stopTrapping: function(target) -> boolean
        //iterate: not implemented yet
    };

    return ProxyCtor.create(handle, Model);
}
function createModelProxy(model) {

    // Create a Proxy handle
    var handle = {
        getOwnPropertyDescriptor: function(target, name) {
            return ObjProto.getOwnPropertyDescriptor.call(model.attributes, name);
        },
        getOwnPropertyNames: function(target) {
            return ObjProto.getOwnPropertyNames.call(model.attributes);
        },
        defineProperty: function(name, propertyDescriptor) {
            return Object.defineProperty(model.attributes, name, propertyDescriptor);
        },
        // Get an attribute from the Model. This will first check for Model properties before
        // checking the Model's internal attributes map.
        get: function(target, name, reciever) {
            // Check for direct properties to satisfy internal attribute and function calls
            if (model[name]) {
                return model[name];
            }

            // It's not a property, check for internal attribute value
            return model.get(name);
        },
        set: function(target, name, value, receiver) {
            return model.set(name, value);
        },
        delete: function(name) {
            model.unset(name);
        },
        has: function(target, name) {
            return model.has('name');
        },
        hasOwn: function(target, name) {
            return this.has(target, name);
        },
        enumerate: function(target) {
            return model.attributes;
        },
        keys: function(target) {
            return Object.keys(model.attributes);
        }
        //protect: function(operation, target) -> boolean
        //stopTrapping: function(target) -> boolean
        //iterate: not implemented yet
    };

    return ProxyCtor.create(handle, Model);
}
Create a Proxy for a Model. This function will return a new Proxy handle for the given Model.
@param {Model} model
@return Object