File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -16,13 +16,18 @@ const convert = (phones) => {
1616 // Cut everything after "The less quick version"
1717 let short = string . substring ( 0 , string . indexOf ( 'The Less Quick Version' ) ) ;
1818 short = `${ short } ${ extra } `
19- // Insert phone numbers
20- const text = "There'll always be at least one of them at any ReactVienna-sponsored space." ;
21- const index = short . indexOf ( text ) ;
22- const before = short . substring ( 0 , index ) ;
23- const after = short . substring ( index ) ;
24- const numbers = `You can also call them:\n${ phones . map ( data => `- ${ data . name } : ${ data . phone } ` ) . join ( '\n' ) } \n\n` ;
25- this . push ( before + numbers + after ) ;
19+ if ( phones && phones . length > 0 && phones . every ( data => data . name && data . phone ) ) {
20+ // Insert phone numbers
21+ const text = "There'll always be at least one of them at any ReactVienna-sponsored space." ;
22+ const index = short . indexOf ( text ) ;
23+ const before = short . substring ( 0 , index ) ;
24+ const after = short . substring ( index ) ;
25+ const numbers = `You can also call them:\n${ phones . map ( data => `- ${ data . name } : ${ data . phone } ` ) . join ( '\n' ) } \n\n` ;
26+ this . push ( before + numbers + after ) ;
27+ } else {
28+ console . warn ( 'No phone numbers provided, please provide at least one phone number if possible.' )
29+ this . push ( short ) ;
30+ }
2631 callback ( ) ;
2732 } ) ,
2833 } ) . from ( './readme.md' ) . to ( './readme.pdf' , ( ) => {
You can’t perform that action at this time.
0 commit comments