MCPcopy Create free account
hub / github.com/dailydotdev/apps / findPostIdInText

Function findPostIdInText

packages/shared/src/features/messages/messageLinks.ts:83–94  ·  view source on GitHub ↗
(
  text: string,
  webappHost = getWebappHost(),
)

Source from the content-addressed store, hash-verified

81};
82
83export const findPostIdInText = (
84 text: string,
85 webappHost = getWebappHost(),
86): string | undefined =>
87 splitLinks(text).reduce<string | undefined>(
88 (found, segment) =>
89 found ??
90 (segment.type === 'link'
91 ? getPostIdFromUrl(segment.url, webappHost)
92 : undefined),
93 undefined,
94 );

Callers 2

MessageBubbleFunction · 0.90

Calls 3

getWebappHostFunction · 0.90
splitLinksFunction · 0.85
getPostIdFromUrlFunction · 0.85

Tested by

no test coverage detected