MCPcopy Create free account
hub / github.com/FxEmbed/FxEmbed / statusLinkWrapper

Function statusLinkWrapper

src/embed/activity.ts:255–266  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

253};
254
255const statusLinkWrapper = (text: string) => {
256 const matches = text.match(
257 /(?<!href=")https?:\/\/(?:www\.)?[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?=\W|$)/g
258 );
259 [...new Set(matches ?? [])]?.forEach(url => {
260 text = text.replace(
261 new RegExp(`${escapeRegex(url)}(?=\\W|$)`, 'g'),
262 `<a href="${url}">${url}</a>`
263 );
264 });
265 return text;
266};
267
268const formatStatus = (text: string, status: APIStatus) => {
269 const enableFacets = false;

Callers 1

formatStatusFunction · 0.85

Calls 1

escapeRegexFunction · 0.90

Tested by

no test coverage detected