File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -5,14 +5,8 @@ const port = process.env.PORT || 3001;
55
66const { getCountryTable } = require ( './lib/byCountry' ) ;
77const { getCompleteTable } = require ( './lib/corona' ) ;
8+ const { countryUpperCase } = require ( './lib/helpers' ) ;
89
9- const countryUpperCase = ( countryParams ) => {
10- if ( countryParams . country . length > 2 ) {
11- const country = countryParams . country . toLowerCase ( ) . split ( ' ' ) . map ( word => word . charAt ( 0 ) . toUpperCase ( ) + word . slice ( 1 ) ) . join ( ' ' ) ;
12- return { country } ;
13- }
14- return countryParams ;
15- } ;
1610
1711app . get ( '/' , ( req , res ) => {
1812 return getCompleteTable ( ) . then ( result => {
Original file line number Diff line number Diff line change @@ -145,6 +145,14 @@ e.getTotalStats = (countryData) => {
145145 return worldStats ;
146146} ;
147147
148+ e . countryUpperCase = ( countryParams ) => {
149+ if ( countryParams . country . length > 2 ) {
150+ const country = countryParams . country . toLowerCase ( ) . split ( ' ' ) . map ( word => word . charAt ( 0 ) . toUpperCase ( ) + word . slice ( 1 ) ) . join ( ' ' ) ;
151+ return { country } ;
152+ }
153+ return countryParams ;
154+ } ;
155+
148156e . footer = `
149157
150158Source Code: https://github.com/sagarkarira/coronavirus-tracker-cli/
You can’t perform that action at this time.
0 commit comments