@@ -45,13 +45,10 @@ function validateSection( schema, section ) {
4545 if ( ! isObject ( schema ) ) {
4646 return new TypeError ( format ( 'invalid option. `%s` schema section must be an object. Value: `%s`.' , section , schema ) ) ;
4747 }
48-
49- // Check if 'required' exists and is an array of strings
5048 if ( hasOwnProp ( schema , 'required' ) ) {
5149 if ( ! isArray ( schema . required ) ) {
5250 return new TypeError ( format ( 'invalid option. `%s.required` must be an array. Value: `%s`.' , section , schema . required ) ) ;
5351 }
54- // Validate each element in the 'required' array is a string
5552 for ( i = 0 ; i < schema . required . length ; i ++ ) {
5653 if ( ! isString ( schema . required [ i ] ) ) {
5754 return new TypeError ( format ( 'invalid option. `%s.required` must only contain strings. Found: `%s`.' , section , schema . required [ i ] ) ) ;
@@ -60,13 +57,10 @@ function validateSection( schema, section ) {
6057 } else {
6158 return new TypeError ( format ( 'invalid option. `%s` schema section must have a `required` property.' , section ) ) ;
6259 }
63-
64- // Check if 'optional' exists and is an array of strings
6560 if ( hasOwnProp ( schema , 'optional' ) ) {
6661 if ( ! isArray ( schema . optional ) ) {
6762 return new TypeError ( format ( 'invalid option. `%s.optional` must be an array. Value: `%s`.' , section , schema . optional ) ) ;
6863 }
69- // Validate each element in the 'optional' array is a string
7064 for ( j = 0 ; j < schema . optional . length ; j ++ ) {
7165 if ( ! isString ( schema . optional [ j ] ) ) {
7266 return new TypeError ( format ( 'invalid option. `%s.optional` must only contain strings. Found: `%s`.' , section , schema . optional [ j ] ) ) ;
@@ -132,7 +126,6 @@ function validate( opts, options ) {
132126 }
133127 opts . schema = options . schema ;
134128 }
135-
136129 return null ;
137130}
138131
0 commit comments