MCPcopy
hub / github.com/JedWatson/classnames / parseValue

Function parseValue

index.js:26–52  ·  view source on GitHub ↗
(arg)

Source from the content-addressed store, hash-verified

24 }
25
26 function parseValue (arg) {
27 if (typeof arg === 'string' || typeof arg === 'number') {
28 return arg;
29 }
30
31 if (typeof arg !== 'object') {
32 return '';
33 }
34
35 if (Array.isArray(arg)) {
36 return classNames.apply(null, arg);
37 }
38
39 if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
40 return arg.toString();
41 }
42
43 var classes = '';
44
45 for (var key in arg) {
46 if (hasOwn.call(arg, key) && arg[key]) {
47 classes = appendClass(classes, key);
48 }
49 }
50
51 return classes;
52 }
53
54 function appendClass (value, newClass) {
55 if (!newClass) {

Callers 1

classNamesFunction · 0.70

Calls 2

appendClassFunction · 0.70
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…