@fvilers/cls
An helper function for constructing className strings conditionally
Installation
npm install @fvilers/cls
or
yarn add @fvilers/cls
ECMAScript module
Starting with version 2.0.0, this library will be published as an ECMAScript module.
Usage
import cls from "@fvilers/cls";
cls("foo", true && "bar", "baz");
cls({ foo: true, bar: false, baz: isTrue() });
cls({ foo: true }, { bar: false }, null, { "--foobar": "hello" });
cls(["foo", 0, false, "bar"]);
cls(["foo"], ["", 0, false, "bar"], [["baz", [["hello"], "there"]]]);
cls(
"foo",
[1 && "bar", { baz: false, bat: null }, ["hello", ["world"]]],
"cya"
);