Skip to content

Instantly share code, notes, and snippets.

@lightningspirit
Created February 4, 2022 18:51
Show Gist options
  • Save lightningspirit/3318e2191ec1d1e4428bc876bea43684 to your computer and use it in GitHub Desktop.
Save lightningspirit/3318e2191ec1d1e4428bc876bea43684 to your computer and use it in GitHub Desktop.
ClassCat like function but simpler and smaller
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