web

Composes class name from truthy values with the support of string and objects.

Type signature

(...xs: any[]) => any

Examples

classNames("test", {
  active: true,
  disabled: false,
  on: undefined,
});
// ⇒ "test active"
Try in REPL

Questions

  • How to create a class name from an array of strings and/or objects?

TypeScript sourceJavaScript source