index.js
function validate(candidate) {
  if (candidate.doc_type) {
    var schema = schemasDeepCopy()[candidate.doc_type];
    validator.validate(candidate, schema);
    var errors = validator.getLastErrors();
    return errors;
  }

  return [{
    dataModel: 'the object to be validated is missing a `doc_type` property'
  }];
}
function validate(candidate) {
  if (candidate.doc_type) {
    var schema = schemasDeepCopy()[candidate.doc_type];
    validator.validate(candidate, schema);
    var errors = validator.getLastErrors();
    return errors;
  }

  return [{
    dataModel: 'the object to be validated is missing a `doc_type` property'
  }];
}
function validate ( candidate ) { if ( candidate . doc_type ) { var schema = schemasDeepCopy ( ) [ candidate . doc_type ] ; validator . validate ( candidate , schema ) ; var errors = validator . getLastErrors ( ) ; return errors ; } return [ { dataModel : 'the object to be validated is missing a `doc_type` property' } ] ; }
Thin wrapper to make validation more convenient

@param {Object} candidate A model instance to validate
@return {[Error]} A list of errors or null
Thin wrapper to make validation more convenient