@@ -88,8 +88,17 @@ exports.valObjectMeta = {
8888 requiredOpts : [ ] ,
8989 otherOpts : [ 'dflt' , 'arrayOk' ] ,
9090 coerceFunction : function ( v , propOut , dflt ) {
91- if ( v === true || v === false ) propOut . set ( v ) ;
92- else propOut . set ( dflt ) ;
91+ function isBoolean ( value ) {
92+ return value === true || value === false ;
93+ }
94+
95+ if ( opts . arrayOk && isArrayOrTypedArray ( v ) && v . length > 0 && v . every ( isBoolean ) ) {
96+ propOut . set ( v ) ;
97+ } else if ( isBoolean ( v ) ) {
98+ propOut . set ( v ) ;
99+ } else {
100+ propOut . set ( dflt ) ;
101+ }
93102 }
94103 } ,
95104 number : {
@@ -227,16 +236,17 @@ exports.valObjectMeta = {
227236 requiredOpts : [ 'dflt' ] ,
228237 otherOpts : [ 'regex' , 'arrayOk' ] ,
229238 coerceFunction : function ( v , propOut , dflt , opts ) {
230- if ( opts . arrayOk && isArrayOrTypedArray ( v ) ) {
231- propOut . set ( v ) ;
232- return ;
233- }
234239 var regex = opts . regex || counterRegex ( dflt ) ;
235- if ( typeof v === 'string' && regex . test ( v ) ) {
240+ function isSubplotId ( value ) {
241+ return typeof value === 'string' && regex . test ( value ) ;
242+ }
243+ if ( opts . arrayOk && isArrayOrTypedArray ( v ) && v . length > 0 && v . every ( isSubplotId ) ) {
236244 propOut . set ( v ) ;
237- return ;
245+ } else if ( isSubplotId ( v ) ) {
246+ propOut . set ( v ) ;
247+ } else {
248+ propOut . set ( dflt ) ;
238249 }
239- propOut . set ( dflt ) ;
240250 } ,
241251 validateFunction : function ( v , opts ) {
242252 var dflt = opts . dflt ;
0 commit comments