The entries to summarize, from collectCachedTitles.
Each supplier with its title count, descending.
listSuppliers(await collectCachedTitles());
// => [{ supplier: "Loudwolf", titles: 412 }, { supplier: "Onyxmet", titles: 118 }]
export function listSuppliers(corpus: CorpusEntry[]): Array<{ supplier: string; titles: number }> {
const counts = new Map<string, number>();
for (const entry of corpus) {
const name = entry.supplier ?? '(unknown)';
counts.set(name, (counts.get(name) ?? 0) + 1);
}
return [...counts]
.map(([supplier, titles]) => ({ supplier, titles }))
.sort((a, b) => b.titles - a.titles);
}
Lists the distinct supplier names present in a corpus, sorted with the most titles first. Use it to discover the exact spellings the
suppliersfilter expects.