MCPcopy Index your code
hub / github.com/nodejs/nodejs.org / mapIdToAuthor

Function mapIdToAuthor

apps/site/util/author.ts:21–44  ·  view source on GitHub ↗
(username: string)

Source from the content-addressed store, hash-verified

19
20export const getAuthorWithId = (usernames: Array<string>, hasUrl: boolean) => {
21 const mapIdToAuthor = (username: string) => {
22 const author = Object.values(authors).find(
23 ({ id }) => id.toLowerCase() === username.toLowerCase()
24 );
25
26 if (author) {
27 const { id, name, website } = author;
28
29 return {
30 image: getGitHubAvatarUrl(id),
31 name,
32 nickname: id,
33 fallback: getAcronymFromString(name),
34 url: hasUrl ? website : undefined,
35 };
36 }
37
38 return {
39 image: getGitHubAvatarUrl(username),
40 nickname: username,
41 fallback: getAcronymFromString(username),
42 url: hasUrl ? `https://github.com/${username}` : undefined,
43 };
44 };
45
46 return usernames.map(mapIdToAuthor);
47};

Callers

nothing calls this directly

Calls 2

getGitHubAvatarUrlFunction · 0.90
getAcronymFromStringFunction · 0.90

Tested by

no test coverage detected