MCPcopy Create free account
hub / github.com/nodejs/nodejs.org / getAuthorWithName

Function getAuthorWithName

apps/site/util/author.ts:49–72  ·  view source on GitHub ↗
(names: Array<string>, hasUrl: boolean)

Source from the content-addressed store, hash-verified

47};
48
49export const getAuthorWithName = (names: Array<string>, hasUrl: boolean) => {
50 const mapNameToAuthor = (username: string) => {
51 if (Object.keys(authors).includes(username)) {
52 if (username in authors) {
53 const { id, name, website } = authors[username];
54
55 return {
56 image: getGitHubAvatarUrl(id),
57 name,
58 nickname: id,
59 fallback: getAcronymFromString(name),
60 url: hasUrl ? website : undefined,
61 };
62 }
63 }
64
65 return {
66 nickname: username,
67 fallback: getAcronymFromString(username),
68 };
69 };
70
71 return names.map(mapNameToAuthor);
72};
73
74export const getAuthors = ({ usernames, names, clickable }: AuthorProps) => {
75 if (usernames) {

Callers 2

author.test.mjsFile · 0.90
getAuthorsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected