Skip to content

Instantly share code, notes, and snippets.

@rndme
Created January 21, 2016 03:10
Show Gist options
  • Save rndme/3f3f8a959053921c6876 to your computer and use it in GitHub Desktop.
Save rndme/3f3f8a959053921c6876 to your computer and use it in GitHub Desktop.
building classNames from values, like npm's ClassNames
function classes(){
return [].filter.call(arguments, Boolean).map(function(a){
return typeof a === "object" ?
(Array.isArray(a) ?
cn.apply(0,a) :
Object.keys(a).filter(function(k){return a[k];}).join(" ")) :
a;
}).filter(String).join(" ");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment