group based on category instead of method name

This commit is contained in:
dcore94 2023-04-06 18:00:25 +02:00
parent c8938108c3
commit abe0226a6c
1 changed files with 11 additions and 4 deletions

View File

@ -188,11 +188,18 @@ class CCPMethodList extends HTMLElement{
groupBy(){
this.#filtered = this.#filtered.reduce((catalog, meth)=>{
const category = meth.title
catalog[category] = catalog[category] ?? []
catalog[category].push(meth)
const categories = meth.metadata.filter(md=>md.role === "category").map(c=>c.title)
if(categories.length === 0){
catalog["Uncategorized"].push(meth)
}else{
for(let c in categories){
const category = categories[c]
catalog[category] = catalog[category] ?? []
catalog[category].push(meth)
}
}
return catalog
}, {})
}, { "Uncategorized" : []})
}
getCategoryHints(){