Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Move the ‘Validation.prototype.validate’ method into a separate file

  • Loading branch information...
commit 250e5e88359d613c56ffbc0e47a23d22c776b10e 1 parent c790fd5
@Baggz authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 src/engines/json/validate.js
View
18 src/engines/json/validate.js
@@ -0,0 +1,18 @@
+/**
+ * Validation.validate
+ *
+ * @param {object} instance
+ * @param {object} schema
+ * @param {boolean} singleError
+ * @param {function} callback
+ */
+Validation.prototype.validate = function(instance, schema, callback) {
+
+ // Save a reference to the ‘this’
+ var self = this;
+
+ return this.validateSchema(instance, schema, '', function(error) {
+ return callback((self.Errors.length > 0) ? self.Errors : undefined);
+ });
+
+};
Please sign in to comment.
Something went wrong with that request. Please try again.