/**
 * Validation
 *
 * @constructor
 * @param {object} options
 */
var Validation = function(options) {

  // Save a reference to the ‘this’
  var self = this;

  var defaultOptions = {
    singleError: true,
    errorMessages: errorMessages,
    cache: false
  };

  each(defaultOptions, function(key, value) {

    if (isObject(value) && options[key]) {
      self[key] = merge(options[key], defaultOptions[key]);

    } else if (isObject(value) && !options[key]) {
      self[key] = merge ({}, defaultOptions[key]);

    } else {
      self[key] = (isDefined(options[key])) ? options[key] : defaultOptions[key];
    }

  });

  this.errors = new ValidationError();

};
/**
 * Validation
 *
 * @constructor
 * @param {object} options
 */
var Validation = function(options) {

  // Save a reference to the ‘this’
  var self = this;

  var defaultOptions = {
    singleError: true,
    errorMessages: errorMessages,
    cache: false
  };

  each(defaultOptions, function(key, value) {

    if (isObject(value) && options[key]) {
      self[key] = merge(options[key], defaultOptions[key]);

    } else if (isObject(value) && !options[key]) {
      self[key] = merge ({}, defaultOptions[key]);

    } else {
      self[key] = (isDefined(options[key])) ? options[key] : defaultOptions[key];
    }

  });

  this.errors = new ValidationError(this);

};
Initialize the ‘ValidationError’ class as a subclass of the ‘Validation’ class
Initialize the ‘ValidationError’ class as a subclass of the ‘Validation’ class
