src/Class.js
function addAttribute(name, type, mandatory, errorCallback) {
  this.attributes[name] =
    { type: Type.normalizeType(type)
    , mandatory: mandatory || false
    , errorCallback: errorCallback || this.errorCallback
    }
}
function addAttribute(name, type, mandatory, errorCallback) {
  this.attributes[name] =
    { type: Type.normalizeType(type)
    , mandatory: mandatory || false
    , errorCallback: errorCallback || this.errorCallback
    }
}
function addAttribute ( name , type , mandatory , errorCallback ) { this . attributes [ name ] = { type : Type . normalizeType ( type ) , mandatory : mandatory || false , errorCallback : errorCallback || this . errorCallback } }
Add an attribute to a class.
@method
@memberof Class~ClassInstance
@param {string} name - The name of the attribute
@param {Function} type - In jsmf an attribute Type is a function that returns true if the
value is a member of this type, false otherwise. Some predefined
types are available in the class {@link Type}.
Users can also use builtin JavaScript types, that are replaced
on the fly by the corresponding validation function
@param {boolean} mandatory - If set to true, the attribute can't be set to undefined.
@param {Function} errorCallback - defines what to do if an invalid value is set to this attribute.
Add an attribute to a class .