@kuoruan/class-names
v1.0.0
Published
A util for conditionally joining classNames together
Downloads
1
Readme
class-names
A util for conditionally joining classNames together
Usage
classNames('foo', 'bar'); // => 'foo bar'
classNames('foo', { bar: true }); // => 'foo bar'
classNames({ 'foo-bar': true }); // => 'foo-bar'
classNames({ 'foo-bar': false }); // => ''
classNames({ foo: true }, { bar: true }); // => 'foo bar'
classNames({ foo: true, bar: true }); // => 'foo bar'
With arrays:
var arr = ['b', { c: true, d: false }];
classNames('a', arr); // => 'a b c'