Created
February 4, 2022 18:51
-
-
Save lightningspirit/3318e2191ec1d1e4428bc876bea43684 to your computer and use it in GitHub Desktop.
ClassCat like function but simpler and smaller
This file contains hidden or 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 classNames(...classes: (boolean | string | string[])[]) { | |
return classes | |
.flatMap((v) => v) | |
.filter(Boolean) | |
.join(" ") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment