Created
January 21, 2016 03:10
-
-
Save rndme/3f3f8a959053921c6876 to your computer and use it in GitHub Desktop.
building classNames from values, like npm's ClassNames
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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