group based on category instead of method name
This commit is contained in:
parent
c8938108c3
commit
abe0226a6c
|
@ -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(){
|
||||
|
|
Loading…
Reference in New Issue