mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-16 10:51:06 +00:00
19 lines
322 B
JavaScript
19 lines
322 B
JavaScript
const prefix = 'bx';
|
|
|
|
function cx(...items) {
|
|
const classes = [];
|
|
|
|
items.forEach(item => {
|
|
if (typeof item === 'string') {
|
|
if (item.slice(0, 2) === '--') {
|
|
classes.push(`${prefix}${item}`);
|
|
} else {
|
|
classes.push(item);
|
|
}
|
|
}
|
|
});
|
|
|
|
return classes.join(' ');
|
|
}
|
|
|
|
export { cx };
|