function filterCategoriesByExplicitFilters(categories, onlyCategories) {
  if (!categories || !onlyCategories) return categories;

  const categoriesToKeep = Object.entries(categories)
    .filter(([categoryId]) => onlyCategories.includes(categoryId));
  return Object.fromEntries(categoriesToKeep);
}
Filters a categories object and their auditRefs down to the specified category ids.

@param {LH.Config.ResolvedConfig['categories']} categories
@param {string[] | null | undefined} onlyCategories
@return {LH.Config.ResolvedConfig['categories']}