Echo JS 0.11.0

<~>
kornflexx 1937 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.

Replies