MCPcopy Create free account
hub / github.com/resend/react-email / jsToInlineCss

Function jsToInlineCss

packages/editor/src/utils/styles.ts:13–29  ·  view source on GitHub ↗
(styleObject: { [key: string]: any })

Source from the content-addressed store, hash-verified

11};
12
13export const jsToInlineCss = (styleObject: { [key: string]: any }) => {
14 const parts: string[] = [];
15
16 for (const key in styleObject) {
17 const value = styleObject[key];
18 if (value !== 0 && value !== undefined && value !== null && value !== '') {
19 const KEBAB_CASE_REGEX = /[A-Z]/g;
20 const formattedKey = key.replace(
21 KEBAB_CASE_REGEX,
22 (match) => `-${match.toLowerCase()}`,
23 );
24 parts.push(`${formattedKey}:${value}`);
25 }
26 }
27
28 return parts.join(';') + (parts.length ? ';' : '');
29};
30
31const splitDeclarations = (input: string): string[] => {
32 const results: string[] = [];

Callers 6

styles.spec.tsFile · 0.90
updateParentBlockStyleFunction · 0.90
updateParentBlockPaddingFunction · 0.90
customUpdateStylesFunction · 0.90
updateLinkColorFunction · 0.90
resolveThemedLinkStyleFunction · 0.90

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected