import splitOnLast from '../helpers/splitOnLast' ; example param value const formatToList = ( value ) : string => { if ( value . length === 0 ) return '' ; if ( value . length === 1 ) return value [ 0 ] ; const [ everyButLast , last ] = splitOnLast ( value ) ; return everyButLast . join ( ', ' ) + ' e ' + last ; } ; export default formatToList ;