1.0.4 • Published 4 years ago

@ekim088/classnames v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

classnames

Reduces mixed-type arguments into a single HTML class attribute.

Actually just a replica of classnames made for fun.

Installation

Install via npm:

npm i @ekim088/classnames --save

Usage

Usage is similar to classnames, though only available as a module.

classNames(...args)

Reduces a list of arguments into a single class attribute value.

Returns: string - A class attribute value.

ParamTypeDescription
...args...*A list of mixed-type arguments to reduce.
import classNames from '@ekim088/classnames';

classNames('foo', { bar: true }); // 'foo bar'

A less performant dedupe version can also be imported from @ekim088/classnames/dedupe.

Current Node.js Benchmark Results

@ekim088/classnames x 6,769,999 ops/sec ±0.96% (93 runs sampled)
classnames x 4,997,061 ops/sec ±0.88% (92 runs sampled)
@ekim088/classnames/dedupe x 2,865,795 ops/sec ±1.29% (90 runs sampled)
classnames/dedupe x 2,092,405 ops/sec ±1.50% (92 runs sampled)

Benchmarks run in Benchmark.js.

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

1.0.0-alpha.2

4 years ago