@@ -3,7 +3,13 @@ import { prettyPrintString } from './pretty-print-string';
33import { prettyPrintArray } from './pretty-print-array' ;
44import { prettyPrintObject } from './pretty-print-object' ;
55
6- export const prettyPrint = ( key = null , value = '' , indent = 0 , colorOutput = false ) => {
6+ export const prettyPrint = (
7+ key = null ,
8+ value = '' ,
9+ indent = 0 ,
10+ colorOutput = false ,
11+ addComma = false
12+ ) => {
713 const isString = typeof value === 'string' ;
814 const isArray = value instanceof Array ;
915 const isObject = value !== null && typeof value === 'object' ;
@@ -15,14 +21,14 @@ export const prettyPrint = (key = null, value = '', indent = 0, colorOutput = fa
1521 }
1622
1723 if ( isString ) {
18- prettyPrintString ( `"${ value } "` , hasKey ? 0 : indent , colorOutput ) ;
24+ prettyPrintString ( `"${ value } "` , hasKey ? 0 : indent , colorOutput , addComma ) ;
1925 } else if ( isArray ) {
20- prettyPrintArray ( value , indent , colorOutput ) ;
26+ prettyPrintArray ( value , indent , colorOutput , addComma ) ;
2127 } else if ( isObject ) {
22- prettyPrintObject ( value , indent , colorOutput ) ;
28+ prettyPrintObject ( value , indent , colorOutput , addComma ) ;
2329 } else if ( isSymbol ) {
24- prettyPrintString ( Symbol . toString ( ) , indent , colorOutput ) ;
30+ prettyPrintString ( Symbol . toString ( ) , indent , colorOutput , addComma ) ;
2531 } else {
26- prettyPrintString ( value , hasKey ? 0 : indent , colorOutput ) ;
32+ prettyPrintString ( value , hasKey ? 0 : indent , colorOutput , addComma ) ;
2733 }
2834} ;
0 commit comments