diff --git a/lib/utils/validation.js b/lib/utils/validation.js index 09fca29..29f25d7 100644 --- a/lib/utils/validation.js +++ b/lib/utils/validation.js @@ -115,5 +115,19 @@ var validateType = (require.modules || {}).validation = module.exports = functio if (schemaType === Boolean) return assert(_.isBoolean(value), 'boolean'); if (schemaType === Date) return assert(_.isDate(value), 'date'); if (schemaType instanceof RegExp) return assert(schemaType.test(value || ''), 'regex match on ' + schemaType.toString(), (value || 'nothing').toString()); + + var virtualThis = { + fail: fail, + assert: assert, + pass: pass + }; + + for(var i = 0; i < validateType.extra.length; i++) { + var result = validateType.extra[i].call(virtualThis, schemaType, value, property); + if(result) return result; + } + return assert(value instanceof schemaType, 'instanceof ' + schemaType.toString()); -}; \ No newline at end of file +}; + +validateType.extra = []; \ No newline at end of file