@uportal/esco-content-menu/src/services/portlet-registry-to-array.js
function customUnique(array) {
  const unique = uniqBy(array, 'fname');
  // we construct unique portlets array will all linked categories (reversing category and portlets child)
  unique.forEach((elem) => {
    const dupl = array.filter((e) => e.fname === elem.fname);
    const allCategories = dupl.flatMap(({categories}) => categories);
    elem.categories = [...new Set(allCategories)];
  });
  return unique;
}
function customUnique(array) {
  const unique = uniqBy(array, 'fname');
  // we construct unique portlets array will all linked categories (reversing category and portlets child)
  unique.forEach((elem) => {
    const dupl = array.filter((e) => e.fname === elem.fname);
    const allCategories = dupl.flatMap(({categories}) => categories);
    elem.categories = [...new Set(allCategories)];
  });
  return unique;
}
function customUnique ( array ) { const unique = uniqBy ( array , 'fname' ) ; // we construct unique portlets array will all linked categories (reversing category and portlets child) unique . forEach ( ( elem ) => { const dupl = array . filter ( ( e ) => e . fname === elem . fname ) ; const allCategories = dupl . flatMap ( ( { categories } ) => categories ) ; elem . categories = [ ... new Set ( allCategories ) ] ; } ) ; return unique ; }
Custom function to remove duplicates portlet on fname, but with merging categories.
@param {Array<Portlet>} array - Portlet List with duplicates.
@return {Array<Portlet>} Portlet List without duplicates.
Custom function to remove duplicates portlet on fname but with merging categories .