Echo JS 0.11.0

<~>

kornflexx 2170 days ago. link 1 point
As an utility function you have to make it faster as possible, the array prototype that you are using are much slower than "low level" iterators.

this: Object.keys(option).forEach
should be: for (const key in option)

You are coupling your lib with React (only by the name), but it can be used outside react.

The strangest thing on your lib is that:
getClass({
  [1 + 2 === 3]: ['apple', 'pie']
}) // output -> 'apple'

Use a boolean as an object key is a bad practice: you can't use two conditions key/value.

getClass({
  [1 + 2 === 3]: ['apple', 'pie'],
  [1 + 2 === 3]: ['sand', 'earth']
}) // output -> 'sand'

You have to use two objects to make it works.
chriscavs 2170 days ago. link 1 point
As for WHY: because it supports if/else classes, which classnames does not.  it also was written in ES6, cutting down on maintainability of the package and executing in fewer lines of code.  classnames 'dedup' of classes is another nearly 100 line file, while getClass's 'dedup' happens in linear time in just one line of code.