(username: string)
| 19 | |
| 20 | export 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 | }; |
nothing calls this directly
no test coverage detected