Skip to content

fetchTopLanguages

The fetcher behind the top languages card.

Fetch top languages for a given username.

fetchTopLanguages(options, config: CardConfig): Promise<TopLangData>
OptionTypeRequiredWhat it is
usernamestring | undefinedyes—
exclude_repostring[] | undefinedno—
size_weightnumber | undefinedno—
count_weightnumber | undefinedno—
ownerAffiliationsRepositoryAffiliation[] | undefinednoEmpty counts the user's own repositories alone.
notebooks"code" | "github" | undefinednocode recounts each repository's notebooks by the language of their code cells.

Returns Promise<TopLangData> — Top languages data.

size_weight and count_weight decide what “most” means, and they are multiplied: size_weight=1&count_weight=0 ranks by bytes of code, 0 and 1 ranks by how many repositories use the language, and 1 and 1 by both. The default is bytes.

A TopLangData — every language keyed by name, each with its size, its count and the colour GitHub gives it. Nothing is truncated: langs_count is the card’s business, not the fetcher’s.