lukeed/clsxPublic

A tiny (239B) utility for constructing `className` strings conditionally.

v1.1.0

LUlukeed published 7948a7eImmutable

Release notes

## Minor / Patch

* Use `Array.isArray` for proper `Array` type-checking (#17): 0d6023a

This prevents an object with a truthy `push` key from being treated as an Array. While (likely) rare, this produced an incorrect result.

> **Important:** Because of this change, Internet Explorer 8 (and older) are no longer supported.<br>If you happen to require support for these browsers, please continue to use the `1.0.x` version range.

## Chores

* Updated benchmark results: 3cfb6c3

Because `Array.isArray` is highly optimized in all modern JS engines, we received a bit of a speed boost!

Below is `clsx@1.0.4` versus this release, running in Node.js 10.13.0

``` # Strings clsx (prev) x 10,336,101 ops/sec ±1.45% (90 runs sampled) clsx x 11,191,101 ops/sec ±0.51% (97 runs sampled)

# Objects clsx (prev) x 7,195,049 ops/sec ±0.35% (92 runs sampled) clsx x 7,133,215 ops/sec ±0.31% (93 runs sampled)

# Arrays clsx (prev) x 8,265,223 ops/sec ±0.32% (94 runs sampled) clsx x 8,346,704 ops/sec ±0.29% (98 runs sampled)

# Nested Arrays clsx (prev) x 6,244,513 ops/sec ±1.41% (94 runs sampled) clsx x 6,324,445 ops/sec ±0.38% (95 runs sampled)

# Nested Arrays w/ Objects clsx (prev) x 5,157,630 ops/sec ±0.34% (92 runs sampled) clsx x 6,349,877 ops/sec ±0.26% (97 runs sampled)

# Mixed clsx (prev) x 5,751,180 ops/sec ±0.38% (95 runs sampled) clsx x 6,722,160 ops/sec ±0.36% (98 runs sampled)

# Mixed (Bad Data) clsx (prev) x 1,935,973 ops/sec ±0.19% (97 runs sampled) clsx x 2,053,230 ops/sec ±0.27% (95 runs sampled) ```

Attached at publication

## Minor / Patch

* Use `Array.isArray` for proper `Array` type-checking (#17): 0d6023a

This prevents an object with a truthy `push` key from being treated as an Array. While (likely) rare, this produced an incorrect result.

> **Important:** Because of this change, Internet Explorer 8 (and older) are no longer supported.<br>If you happen to require support for these browsers, please continue to use the `1.0.x` version range.

## Chores

* Updated benchmark results: 3cfb6c3

Because `Array.isArray` is highly optimized in all modern JS engines, we received a bit of a speed boost!

Below is `clsx@1.0.4` versus this release, running in Node.js 10.13.0

``` # Strings clsx (prev) x 10,336,101 ops/sec ±1.45% (90 runs sampled) clsx x 11,191,101 ops/sec ±0.51% (97 runs sampled)

# Objects clsx (prev) x 7,195,049 ops/sec ±0.35% (92 runs sampled) clsx x 7,133,215 ops/sec ±0.31% (93 runs sampled)

# Arrays clsx (prev) x 8,265,223 ops/sec ±0.32% (94 runs sampled) clsx x 8,346,704 ops/sec ±0.29% (98 runs sampled)

# Nested Arrays clsx (prev) x 6,244,513 ops/sec ±1.41% (94 runs sampled) clsx x 6,324,445 ops/sec ±0.38% (95 runs sampled)

# Nested Arrays w/ Objects clsx (prev) x 5,157,630 ops/sec ±0.34% (92 runs sampled) clsx x 6,349,877 ops/sec ±0.26% (97 runs sampled)

# Mixed clsx (prev) x 5,751,180 ops/sec ±0.38% (95 runs sampled) clsx x 6,722,160 ops/sec ±0.36% (98 runs sampled)

# Mixed (Bad Data) clsx (prev) x 1,935,973 ops/sec ±0.19% (97 runs sampled) clsx x 2,053,230 ops/sec ±0.27% (95 runs sampled) ```

Assets 0
None were attached at publication.
No assets.

Shipped in this Release 0

None

Deployments 0

  • None

History 0

No Decisions yet.