MCPcopy Index your code
hub / github.com/kyechan99/capsule-render / formatCSSValue

Function formatCSSValue

utils/css.ts:11–29  ·  view source on GitHub ↗
(key: string, value: CSSValue)

Source from the content-addressed store, hash-verified

9};
10
11const formatCSSValue = (key: string, value: CSSValue) => {
12 const autoPixelProperties = new Set([
13 "flexGrow",
14 "flexShrink",
15 "fontWeight",
16 "lineHeight",
17 "opacity",
18 "zIndex",
19 "flex",
20 "order",
21 "gridColumn",
22 "gridRow",
23 ]);
24
25 if (typeof value === "number") {
26 return autoPixelProperties.has(key) ? value.toString() : `${value}`;
27 }
28 return value;
29};
30
31const stringifyProperties = (
32 properties: CSSProperties,

Callers 1

stringifyPropertiesFunction · 0.85

Calls 1

toStringMethod · 0.80

Tested by

no test coverage detected