@@ -42,12 +42,15 @@ const {
4242  isStackOverflowError, 
4343  codes : { 
4444    ERR_CONSOLE_WRITABLE_STREAM , 
45-     ERR_INVALID_ARG_TYPE , 
4645    ERR_INVALID_ARG_VALUE , 
4746    ERR_INCOMPATIBLE_OPTION_PAIR , 
4847  } , 
4948}  =  require ( 'internal/errors' ) ; 
50- const  {  validateInteger }  =  require ( 'internal/validators' ) ; 
49+ const  { 
50+   validateArray, 
51+   validateInteger, 
52+   validateObject, 
53+ }  =  require ( 'internal/validators' ) ; 
5154const  {  previewEntries }  =  internalBinding ( 'util' ) ; 
5255const  {  Buffer : {  isBuffer }  }  =  require ( 'buffer' ) ; 
5356const  { 
@@ -136,18 +139,15 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
136139                    0 ,  kMaxGroupIndentation ) ; 
137140  } 
138141
139-   if  ( typeof  inspectOptions  ===  'object'  &&  inspectOptions  !==  null )  { 
142+   if  ( inspectOptions  !==  undefined )  { 
143+     validateObject ( inspectOptions ,  'options.inspectOptions' ) ; 
144+ 
140145    if  ( inspectOptions . colors  !==  undefined  && 
141146        options . colorMode  !==  undefined )  { 
142147      throw  new  ERR_INCOMPATIBLE_OPTION_PAIR ( 
143148        'options.inspectOptions.color' ,  'colorMode' ) ; 
144149    } 
145150    optionsMap . set ( this ,  inspectOptions ) ; 
146-   }  else  if  ( inspectOptions  !==  undefined )  { 
147-     throw  new  ERR_INVALID_ARG_TYPE ( 
148-       'options.inspectOptions' , 
149-       'object' , 
150-       inspectOptions ) ; 
151151  } 
152152
153153  // Bind the prototype functions to this Console instance 
@@ -483,8 +483,8 @@ const consoleMethods = {
483483
484484  // https://console.spec.whatwg.org/#table 
485485  table ( tabularData ,  properties )  { 
486-     if  ( properties  !==  undefined   &&   ! ArrayIsArray ( properties ) ) 
487-       throw   new   ERR_INVALID_ARG_TYPE ( ' properties' ,  'Array'  ,   properties ) ; 
486+     if  ( properties  !==  undefined ) 
487+       validateArray ( properties ,  'properties'  ) ; 
488488
489489    if  ( tabularData  ===  null  ||  typeof  tabularData  !==  'object' ) 
490490      return  this . log ( tabularData ) ; 
0 commit comments