param arr param getId export const unique = < TArrItem extends unknown > ( arr , getId = ( item ) => item ) : TArrItem [ ] => { return arr . reduce ( ( acc , item ) => { const id = getId ( item ) ; if ( ! acc . find ( ( find ) => getId ( find ) === id ) ) { acc . push ( item ) ; } return acc ; } , [ ] as TArrItem [ ] ) ; } ; param arrays export const flatten = < TArr extends Record < string , unknown > > ( ... arrays ) : TArr [ ] => { return arrays . reduce ( ( acc , arr ) => acc . concat ( arr ) , [ ] ) ; } ;