(author: string)
| 5 | import type { AuthorProps } from '#site/types'; |
| 6 | |
| 7 | export const mapAuthorToCardAuthors = (author: string) => { |
| 8 | // Clears text in parentheses |
| 9 | const cleanedAuthor = author.replace(/\s*\(.*?\)\s*/g, '').trim(); |
| 10 | |
| 11 | // Defines the separators such as (",", "and", ";", "&", "prepared by", "by") |
| 12 | const separators = /,|\band\b|;|&| prepared by | by /i; |
| 13 | |
| 14 | return cleanedAuthor |
| 15 | .split(separators) |
| 16 | .map(name => name.trim()) |
| 17 | .filter(Boolean); |
| 18 | }; |
| 19 | |
| 20 | export const getAuthorWithId = (usernames: Array<string>, hasUrl: boolean) => { |
| 21 | const mapIdToAuthor = (username: string) => { |
no outgoing calls
no test coverage detected