/**
 * Truncates a string [str] in the middle so that the total length of the both sides is
 * equal to [length] / 2. [join] is added between the sides
 * If string.length <= [length], returns string
 */ export function truncateMiddle ( str , length , join = "..." ) { if ( str . length <= length ) return str ; const sl = ( length * 0.5 ) | 0 ; return str . slice ( 0 , sl ) + join + str . slice ( - sl ) ; } param str param maxLength param append returns export function truncateEnd ( str , maxLength , append = "..." ) { if ( str . length > maxLength ) { str = str . slice ( 0 , maxLength ) + append ; } return str ; } export function tagsFromString ( str ) { return str . split ( "," ) . map ( tag => tag . trim ( ) ) . filter ( tag => tag . length > 0 ) ; }