Skip to content

Instantly share code, notes, and snippets.

@0az
Created July 11, 2021 17:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0az/8a795d87ecfbd9bad6b27ba47230b378 to your computer and use it in GitHub Desktop.
Save 0az/8a795d87ecfbd9bad6b27ba47230b378 to your computer and use it in GitHub Desktop.
Single File replacement for the classnames package
type MaybeClassName = string | boolean | null | undefined | MaybeClassName[]
export const kn = (...args: MaybeClassName[]): string =>
args
.filter(e => e)
.flat()
// eslint-disable-next-line prefer-template
.map(e => e + '')
.join(' ')
export default kn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment