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

Function sanitizeMessage

packages/shared/src/features/onboarding/lib/utils.ts:11–27  ·  view source on GitHub ↗
(
  message: string,
  allowedTags = ['b', 'strong', 'br'],
  allowedAttributes = ['class'],
)

Source from the content-addressed store, hash-verified

9 * Sanitizes HTML string and allows only bold tags
10 */
11export const sanitizeMessage = (
12 message: string,
13 allowedTags = ['b', 'strong', 'br'],
14 allowedAttributes = ['class'],
15): string => {
16 // Only run on client-side
17 if (typeof window === 'undefined') {
18 return message;
19 }
20
21 const purify = createDOMPurify(window);
22
23 return purify.sanitize(message, {
24 ALLOWED_TAGS: allowedTags,
25 ALLOWED_ATTR: allowedAttributes,
26 });
27};
28
29const brokenWebviewPatterns = [
30 /FBAN|FBAV/i, // Facebook App

Callers 15

FreeformList.tsxFile · 0.90
normalizeThreadBodyFunction · 0.90
useSocialTwitterCardDataFunction · 0.90
WelcomePostCardFooterFunction · 0.90
OnboardingSignupHeroFunction · 0.90
FunnelPaymentSuccessfulFunction · 0.90
InnerFunnelRegistrationFunction · 0.90
InnerFunnelProfileFormFunction · 0.90
BrowserExtensionFunction · 0.90
StepHeadlineFunction · 0.90
useDiscountTimerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected