Simple reimplementation of classnames in ReasonML.
# yarn / npm
yarn add re-classnames
npm install --save re-classnames
Cn.make(["one", "two"]) /* => "one two" */
Cn.ifBool
Cn.make(["one", "two" |> Cn.ifBool(true)]) /* => "one two" */
Cn.make(["one", "two" |> Cn.ifBool(false)]) /* => "one" */
Cn.ifOpt
/* Cn.ifOpt */
Cn.make(["one", Some("two") |> Cn.ifOpt]) /* => "one two" */
Cn.make(["one", None |> Cn.ifOpt]) /* => "one" */
Cn.mapOpt
type t =
| One
| Two
| Tree;
Cn.make([
"one",
Cn.mapOpt(
Some(Two),
(v) =>
switch v {
| One => "one"
| Two => "two"
| Tree => "three"
}
)
]) /* => "one two" */
Cn.make([
"one",
Cn.mapOpt(
None,
(v) =>
switch v {
| One => "one"
| Two => "two"
| Tree => "three"
}
)
]) /* => "one" */
It's MIT.