@jikanban/cls
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

cls

A simple utility for conditionally joining className strings. Also serves as a smaller drop-in replacement for the classnames package.

Install

# With NPM
$ npm install --save @jikanban/cls

# With Yarn
$ yarn add @jikanban/cls

Usage

import cls from '@jikanban/cls'

cls('foo', 'bar')
// => 'foo bar'

cls('foo', { bar: true })
// => 'foo bar'

cls({ 'foo-bar': true })
// => 'foo-bar'

cls({ 'foo-bar': false })
// => ''

cls({ foo: true }, { bar: true })
// => 'foo bar'

cls({ foo: true, bar: true })
// => 'foo bar'

cls('foo', { bar: true, duck: false }, 'baz', { quux: true })
// => 'foo bar baz quux'

cls(null, false, 'bar', undefined, 0, 1, { baz: null }, '')
// => 'bar 1'

Readme

Keywords

none

Package Sidebar

Install

npm i @jikanban/cls

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

21.7 kB

Total Files

15

Last publish

Collaborators

  • mwo