@@ -19,12 +19,12 @@ var validatorsByName = module.exports = {
1919
2020Object . defineProperty ( validatorsByName , 'load' , {
2121 value : function loadValidators ( passedOptions ) {
22- var validators = [ ] ;
23-
2422 if ( ! passedOptions ) {
25- return validators ;
23+ return [ ] ;
2624 }
2725
26+ var validators = [ ] ;
27+
2828 Object . keys ( validatorsByName ) . forEach ( function ( name ) {
2929 var v = validatorsByName [ name ] ;
3030
@@ -50,22 +50,22 @@ Object.defineProperty(validatorsByName, 'load', {
5050
5151Object . defineProperty ( validatorsByName , 'checkOptions' , {
5252 value : function checkOptions ( validator , options ) {
53- Object . keys ( validator . options ) . forEach ( function ( data , option ) {
53+ Object . keys ( validator . options ) . forEach ( function ( option ) {
54+ var data = validator . options [ option ] ;
5455 if ( ! data . allowedValues ) {
5556 return ;
5657 }
5758
58- var values ;
59- if ( typeof data . allowedValues === 'function' ) {
60- values = data . allowedValues ( ) ;
59+ var values = data . allowedValues ;
60+ if ( typeof values === 'function' ) {
61+ values = values ( ) ;
6162 }
6263
63- if ( ! Array . isArray ( values ) ) {
64- throw new Error ( 'Internal error in jsDoc validator ' + validator . _name ) ;
64+ assert ( Array . isArray ( values ) , 'Internal error in jsDoc validator ' + validator . _name ) ;
6565
66- } else if ( values . length > 1 ) {
66+ if ( values . length > 1 ) {
6767 assert ( values . indexOf ( options [ option ] ) !== - 1 ,
68- 'Available values for option jsDoc.' + option + ' are ' + values . map ( JSON . stringify ) . join ( ', ' ) ) ;
68+ 'Accepted values for option jsDoc.' + option + ' are ' + values . map ( JSON . stringify ) . join ( ', ' ) ) ;
6969
7070 } else if ( values . length ) {
7171 assert ( values [ 0 ] === options [ option ] ,
0 commit comments