const MAX_LENGTH = 10 ; const cutString = ( str , length = MAX_LENGTH ) : string => { if ( str . length <= length ) { return str ; } else { return `${ str . substring ( 0 , length ) }...` ; } } ; export default cutString ;