@spaced-out/ui-design-system
Version:
Sense UI components library
31 lines (30 loc) • 996 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.classify = classify;
exports.default = void 0;
var _isPlainObject = _interopRequireDefault(require("lodash/isPlainObject"));
var _map = _interopRequireDefault(require("lodash/map"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function classify() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return args.map(arg => {
let mappedArg = arg;
if ((0, _isPlainObject.default)(arg)) {
// $FlowFixMe[incompatible-call]
mappedArg = (0, _map.default)(arg, (test, name) => test ? name : null);
}
return mappedArg;
}).reduce((array, current) => {
if (Array.isArray(current)) {
array.push(...current);
} else {
array.push(current);
}
return array;
}, []).filter(val => val).join(' ');
}
var _default = exports.default = classify;