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

Function mapAuthorToCardAuthors

apps/site/util/author.ts:7–18  ·  view source on GitHub ↗
(author: string)

Source from the content-addressed store, hash-verified

5import type { AuthorProps } from '#site/types';
6
7export 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
20export const getAuthorWithId = (usernames: Array<string>, hasUrl: boolean) => {
21 const mapIdToAuthor = (username: string) => {

Callers 3

WithBlogCategoriesFunction · 0.90
PostLayoutFunction · 0.90
author.test.mjsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected