Simple tool to build (and apply) classes. This is very much inspired by Jed Watson's classnames, but with added functionality and slight differences in interface.
npm install classname
Or just load
classname.js in your browser, and call it directly.
; // '1 one two';// 'one three';// 'two three'
Objects always overwrite other types of parameters
classname handles more than string, numbers, arrays, and objects though. You can give it elements, nodelists, or jQuery elements too.
;// 'foo bar' (assuming that the found elements do not have other class names as well)
classname can also set the class to the element for you. Use
var el = document;classname'one' 'two';elclassName; // 'one two'