0.1.0 • Published 6 years ago

classname-lodash v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

classnames-lodash

classnames, rewritten using lodash.

classnames is still being maintained. This is not a replacement for classnames.

classnames is a fantastic library. With no dependencies, it efficiently produces a classlist from a slew of parameter types and combinations. This is a personal exercise in producing, testing, profiling, and documenting an open-source software package.

Installation

npm install classnames-lodash

Usage

import classnames from 'classnames-lodash'

classnames('foo', undefined, 'bar', null) // => 'foo bar'

Todo

  • Create Yarn package
  • Create Bower package
  • Create script to expose classnames() to the global scope
  • Support object parameter type with class names as keys, like this:
    classnames({
        foo: true,
        bar: false
    }) // => 'foo'
  • Implement, test, and profile classnames.bind()
  • Create alternative that does not sort
  • Create alternative that does not dedupe
  • Create alternative that does not sort or dedupe

Development

If you're looking to work on this project, please use the following npm scripts to run benchmarks and tests.

CommandEffect
lintLints all source code in the project and displays warnings and errors to the console.
fixLints all source code and fixes fixable errors in place.
testRuns all tests for this project.
test-watchRuns all tests for this project, then watches for file changes, repeat.
benchmarkRuns benchmarks for this project and displays results on the console.