MCPcopy Index your code
hub / github.com/QwikDev/qwik / serializeClass

Function serializeClass

packages/qwik/src/core/render/execute-component.ts:149–175  ·  view source on GitHub ↗
(obj: ClassList)

Source from the content-addressed store, hash-verified

147};
148
149export const serializeClass = (obj: ClassList): string => {
150 if (!obj) {
151 return '';
152 }
153 if (isString(obj)) {
154 return obj.trim();
155 }
156
157 const classes: string[] = [];
158
159 if (isArray(obj)) {
160 for (const o of obj) {
161 const classList = serializeClass(o);
162 if (classList) {
163 classes.push(classList);
164 }
165 }
166 } else {
167 for (const [key, value] of Object.entries(obj)) {
168 if (value) {
169 classes.push(key.trim());
170 }
171 }
172 }
173
174 return classes.join(' ');
175};
176
177export const stringifyStyle = (obj: any): string => {
178 if (obj == null) {

Callers 3

handlePropFunction · 0.90
serializeClassWithHostFunction · 0.85

Calls 3

isStringFunction · 0.90
isArrayFunction · 0.90
joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…