UNPKG

merge-class-names

Version:

A function that merges given class names, no matter their format: string with single or multiple class names or an array of class names. Filters out invalid class names as well.

7 lines (6 loc) 212 B
export default function mergeClassNames() { return Array.prototype.slice.call(arguments).reduce( (classList, arg) => classList.concat(arg), [], ).filter((arg) => typeof arg === 'string').join(' '); }