INNER CODE UNIT · JavaScript
groupActorsByAllowedCategory
cporter202/agentic-ai-apis · settings/generate_readme_clean.js:89
function groupActorsByAllowedCategory(allActors) {
const grouped = new Map(ALLOWED_CATEGORIES.map((category) => [category.displayName, []]));
for (const actor of allActors) {
if (shouldFilterActor(actor)) {
continue;
}
const categories = actor.categories || [];
for (const categoryKey of categories) {
const category = ALLOWED_CATEGORY_MAP.get(categoryKey);
if (!category) {
continue;
}
const list = grouped.get(category.displayName);
const exists = list.some(
(entry) => entry.name === actor.name && entry.username === actor.username