param { Array } list param { String } groupingKey example export const groupBy = ( list , groupingKey ) : any [ ] => list . reduce ( ( acc , item ) => { const index = item [ groupingKey ] ; return { ... acc , [ index ] : [ ... ( acc [ index ] || [ ] ) , item ] } ; } , { } ) ; export const groupByValues = ( list , groupingKey ) : any [ ] => Object . values ( groupBy ( list , groupingKey ) ) ; param { Array } actions example export const filterByVisible = ( actions ) : any [ ] => { if ( ! actions ) { return [ ] ; } return actions . reduce ( ( acc , { visible = true , ... action } ) => { if ( visible ) { acc . push ( action ) ; } return acc ; } , [ ] ) ; } ;