0.0.1 • Published 9 months ago

@mek.yt/classnames v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Classnames

Usage

import classnames from "@mek.yt/classnames";
// or
import { classnames } from "@mek.yt/classnames";

// Strings (variadic)
classnames("foo", true && "bar", "baz");
//=> "foo bar baz"

// Objects
classnames({ foo:true, bar:false, baz:isTrue() });
//=> "foo baz"

// Objects (variadic)
classnames({ foo:true }, { bar:false }, null, { "--foobar":"hello" });
//=> "foo --foobar"

// Arrays
classnames(["foo", 0, false, "bar"]);
//=> "foo bar"

// Arrays (variadic)
classnames(["foo"], ["", 0, false, "bar"], [["baz", [["hello"], "there"]]]);
//=> "foo bar baz hello there"

// Kitchen sink (with nesting)
classnames("foo", [1 && "bar", { baz:false, bat:null }, ["hello", ["world"]]], "cya");
//=> "foo bar hello world cya"
0.0.1

9 months ago