param str returns export function capitalize ( str ) { return capitalizeFirst ( str . split ( ' ' ) . map ( capitalizeFirst ) . join ( ' ' ) ) ; } function capitalizeFirst ( str ) { if ( str && str [ 0 ] ) { return str [ 0 ] . toUpperCase ( ) + str . slice ( 1 ) ; } return str ; }