@@ -85,10 +85,10 @@ Validator.prototype.compileSchemaObject = function(schemaObject) {
8585
8686 var compiledObject = Object . keys ( schemaObject ) . map ( name => {
8787 const compiledType = this . compileSchemaType ( schemaObject [ name ] ) ;
88- return { name : name , compiledType : compiledType , isArray : Array . isArray ( compiledType ) } ;
88+ return { name : name , compiledType : compiledType } ;
8989 } ) ;
9090
91- // Uncomment this line to use uncompiled object validator:
91+ // Uncomment this line to use compiled object validator:
9292 // return compiledObject;
9393
9494 const sourceCode = [ ] ;
@@ -110,7 +110,7 @@ Validator.prototype.compileSchemaObject = function(schemaObject) {
110110 }
111111
112112 sourceCode . push ( `return errors.length === 0 ? true : errors;` ) ;
113-
113+
114114 var compiledObjectFunction = new Function ( "value" , "compiledObject" , "path" , "parent" , sourceCode . join ( "\n" ) ) ;
115115
116116 var self = this ;
@@ -147,7 +147,7 @@ Validator.prototype.compileSchemaRule = function(schemaRule) {
147147
148148 let dataParameter = null ;
149149 let dataFunction = null ;
150-
150+
151151 if ( schemaRule . type === "object" && schemaRule . props ) {
152152 dataParameter = this . compileSchemaObject ( schemaRule . props ) ;
153153 dataFunction = this . checkSchemaObject ;
@@ -165,11 +165,10 @@ Validator.prototype.compileSchemaRule = function(schemaRule) {
165165} ;
166166
167167Validator . prototype . checkSchemaObject = function ( value , compiledObject , path , parent ) {
168-
169168 if ( compiledObject instanceof Function ) {
170169 return compiledObject ( value , undefined , path , parent ) ;
171170 }
172-
171+
173172 const errors = [ ] ;
174173 const checksLength = compiledObject . length ;
175174 for ( let i = 0 ; i < checksLength ; i ++ ) {
@@ -183,7 +182,7 @@ Validator.prototype.checkSchemaObject = function(value, compiledObject, path, pa
183182 }
184183
185184 return errors . length === 0 ? true : errors ;
186- }
185+ } ;
187186
188187Validator . prototype . checkSchemaType = function ( value , compiledType , path , parent ) {
189188 if ( Array . isArray ( compiledType ) ) {
@@ -205,23 +204,23 @@ Validator.prototype.checkSchemaType = function(value, compiledType, path, parent
205204 }
206205
207206 return this . checkSchemaRule ( value , compiledType , path , parent ) ;
208- }
207+ } ;
209208
210209Validator . prototype . checkSchemaArray = function ( value , compiledArray , path , parent ) {
211210 const errors = [ ] ;
212211 const valueLength = value . length ;
213-
212+
214213 for ( let i = 0 ; i < valueLength ; i ++ ) {
215214 const itemPath = ( path !== undefined ? path : "" ) + "[" + i + "]" ;
216- const res = this . checkSchemaType ( value [ i ] , compiledArray , itemPath , value ) ;
215+ const res = this . checkSchemaType ( value [ i ] , compiledArray , itemPath , value , parent ) ;
217216
218217 if ( res !== true ) {
219218 this . handleResult ( errors , itemPath , res ) ;
220219 }
221220 }
222221
223222 return errors . length === 0 ? true : errors ;
224- }
223+ } ;
225224
226225Validator . prototype . checkSchemaRule = function ( value , compiledRule , path , parent ) {
227226 const schemaRule = compiledRule . schemaRule ;
0 commit comments