@@ -76,7 +76,7 @@ class Validator {
76
76
}
77
77
78
78
if ( opts . customFunctions ) {
79
- for ( const customeName in opts . customFunctions ) this . addCustomFunction ( customeName , opts . customFunctions [ customeName ] ) ;
79
+ for ( const customName in opts . customFunctions ) this . addCustomFunction ( customName , opts . customFunctions [ customName ] ) ;
80
80
}
81
81
82
82
if ( opts . plugins ) {
@@ -445,7 +445,7 @@ class Validator {
445
445
makeCustomValidator ( { vName = "value" , fnName = "custom" , ruleIndex, path, schema, context, messages } ) {
446
446
const ruleVName = "rule" + ruleIndex ;
447
447
const fnCustomErrorsVName = "fnCustomErrors" + ruleIndex ;
448
-
448
+
449
449
if ( typeof schema [ fnName ] == "function" || ( Array . isArray ( schema [ fnName ] ) ) ) {
450
450
if ( context . customs [ ruleIndex ] ) {
451
451
context . customs [ ruleIndex ] . messages = messages ;
@@ -462,9 +462,9 @@ class Validator {
462
462
463
463
if ( Array . isArray ( schema [ fnName ] ) ) {
464
464
for ( let i = 0 ; i < schema [ fnName ] . length ; i ++ ) {
465
-
465
+
466
466
let custom = schema [ fnName ] [ i ] ;
467
-
467
+
468
468
if ( typeof custom === "string" ) {
469
469
custom = this . parseShortHand ( custom ) ;
470
470
schema [ fnName ] [ i ] = custom ;
@@ -475,9 +475,9 @@ class Validator {
475
475
476
476
ret . push ( `
477
477
const ${ ruleVName } _${ i } = context.customs[${ customIndex } ];
478
-
478
+
479
479
` ) ;
480
-
480
+
481
481
if ( custom . type ) {
482
482
ret . push ( `
483
483
${ vName } = ${ context . async ? "await " : "" } context.customFunctions[${ ruleVName } .schema.${ fnName } [${ i } ].type].call(this, ${ vName } , ${ fnCustomErrorsVName } , ${ ruleVName } _${ i } .schema, "${ path } ", parent, context);
0 commit comments