3
59%
MIT
Simple reimplementation of classnames in ReasonML

re-classnames

Simple reimplementation of classnames in ReasonML.

Installation

# yarn / npm
yarn add re-classnames
npm install --save re-classnames

Usage

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" */

License

It's MIT.