MCPcopy
hub / github.com/stackblitz/bolt.new / parseValue

Function parseValue

app/utils/classNames.ts:27–49  ·  view source on GitHub ↗
(arg: ClassNamesArg)

Source from the content-addressed store, hash-verified

25}
26
27function parseValue(arg: ClassNamesArg) {
28 if (typeof arg === 'string' || typeof arg === 'number') {
29 return arg;
30 }
31
32 if (typeof arg !== 'object') {
33 return '';
34 }
35
36 if (Array.isArray(arg)) {
37 return classNames(...arg);
38 }
39
40 let classes = '';
41
42 for (const key in arg) {
43 if (arg[key]) {
44 classes = appendClass(classes, key);
45 }
46 }
47
48 return classes;
49}
50
51function appendClass(value: string, newClass: string | undefined) {
52 if (!newClass) {

Callers 1

classNamesFunction · 0.85

Calls 2

classNamesFunction · 0.85
appendClassFunction · 0.85

Tested by

no test coverage detected