lib/Property.js
/**
 * A Machine Property
 * @param name the name of the property
 * @param value the value of the property
 * @param validations the list of validations to be executed against the property value
 * @constructor
 */
A Machine Property
@param name the name of the property
@param value the value of the property
@param validations the list of validations to be executed against the property value
@constructor
A Machine Property @param name the name of the property @param value the value of the property @param validations the list of validations to be executed against the property value @constructor
function Property(name, value, validations) {
    if (!name) throw new Error("ERROR: Name must be provided when constructing a Property");
    var property = this;
    this._name = name;
    this._value = value;
    if (validations) {
        if (validations.constructor.name === "Array") {
            validations.forEach(function (validation) {
                if (validation.constructor.name === "Validation") {
                    if (property.validations == null) property.validations = [];
                    property.validations.push(validation);
                } else {
                    throw new Error("Error: Property validations must be of type Validation");
                }
            });
        } else {
            if (validations.constructor.name === "Validation") {
                if (property.validations == null) property.validations = [];
                property.validations.push(validations);
            }
        }
    }
    if (property._value) property.validate(property._value);
}
function Property ( name , value , validations ) { if ( ! name ) throw new Error ( "ERROR: Name must be provided when constructing a Property" ) ; var property = this ; this . _name = name ; this . _value = value ; if ( validations ) { if ( validations . constructor . name === "Array" ) { validations . forEach ( function ( validation ) { if ( validation . constructor . name === "Validation" ) { if ( property . validations == null ) property . validations = [ ] ; property . validations . push ( validation ) ; } else { throw new Error ( "Error: Property validations must be of type Validation" ) ; } } ) ; } else { if ( validations . constructor . name === "Validation" ) { if ( property . validations == null ) property . validations = [ ] ; property . validations . push ( validations ) ; } } } if ( property . _value ) property . validate ( property . _value ) ; }
A Machine Property
 @param name the name of the property
 @param value the value of the property
 @param validations the list of validations to be executed against the property value
 @constructor
A Machine Property @param name the name of the property @param value the value of the property @param validations the list of validations to be executed against the property value @constructor