Skip to content

Reimplementation of classnames in ReasonML

Notifications You must be signed in to change notification settings

farukg/re-classnames

 
 

Repository files navigation

re-classnames

npm version build status license

Reimplementation of classnames in ReasonML.

Installation

# yarn
yarn add re-classnames

# or npm
npm install --save re-classnames

Then add it to bsconfig.json:

"bs-dependencies": [
  "re-classnames"
]

Usage

Cn.make

Cn.make(["one", "two"]) // => "one two"

Cn.ifTrue

Cn.make(["one", "two"->Cn.ifTrue(true)]) // => "one two"
Cn.make(["one", "two"->Cn.ifTrue(false)]) // => "one"

Cn.ifSome

Cn.make(["one", "two"->Cn.ifSome(Some("thing"))]) // => "one two"
Cn.make(["one", "two"->Cn.ifSome(None)]) // => "one"

Cn.mapSome

type t =
  | One
  | Two
  | Tree;

Cn.make([
  "one",
  Cn.mapSome(
    Some(Two),
    fun
    | One => "one"
    | Two => "two"
    | Tree => "three",
  )
]) // => "one two"

Cn.make([
  "one",
  Cn.mapSome(
    None,
    fun
    | One => "one"
    | Two => "two"
    | Tree => "three",
  )
]) // => "one"

Cn.unpack

Cn.make(["one", Some("two")->Cn.unpack]) // => "one two"
Cn.make(["one", None->Cn.unpack]) // => "one"

License

MIT.

About

Reimplementation of classnames in ReasonML

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Reason 98.4%
  • JavaScript 1.6%