Debian Codegraph @

node/@patternfly/react-styles/dist/esm/index.js

raw
1 /** Joins args into a className string
2 *
3 * @param {any} args list of objects, string, or arrays to reduce
4 */
5 export function css(...args) {
6 // Adapted from https://github.com/JedWatson/classnames/blob/master/index.js
7 const classes = [];
8 const hasOwn = {}.hasOwnProperty;
9 args.filter(Boolean).forEach((arg) => {
10 const argType = typeof arg;
11 if (argType === 'string' || argType === 'number') {
12 classes.push(arg);
13 }
14 else if (Array.isArray(arg) && arg.length) {
15 const inner = css(...arg);
16 if (inner) {
17 classes.push(inner);
18 }
19 }
20 else if (argType === 'object') {
21 for (const key in arg) {
22 if (hasOwn.call(arg, key) && arg[key]) {
23 classes.push(key);
24 }
25 }
26 }
27 });
28 return classes.join(' ');
29 }
30 //# sourceMappingURL=index.js.map