Echo JS 0.11.0

<~>

jaleksic 1825 days ago. link 2 points
Since you don't support objects as in e.g `classnames({ isActive })`, I guess you might improve performance a little by using `typeof arg === 'string'` instead of the more expensive `Array.isArray(arg)` call.
troy-tae 1825 days ago. link 2 points
I tested many of case and it seems property check is cheaper than typeof check.
So I confirmed all of method of Array.
And it seems `pop` is shortest method name.
Now I check `pop` instead of isArray.
If you have any other idea, please notice me!
Thank you again :)
troy-tae 1825 days ago. link 1 point
Yes you're right.
It seems Array.isArray compare with Array.prototype and that work is expensive!
Let me try several case and I'll try to find what is the best code.
Thank you :)
tracker1 1827 days ago. link 2 points
Would be better to use the DOM classList[1] API, which is already available on all major browsers for a couple generations now (limited support in IE).

I will say, if you're using React, this is a bit lighter than the classnames[2] module, which would be my own preference.  However, knowledge of Array methods (map, reduce, etc) can accomplish the same without an external dependency, or the runtime wrapping likely to happen.

[1] https://developer.mozilla.org/en-US/docs/Web/API/Element/classList

[2] https://www.npmjs.com/package/classnames

Note: not the one who downvoted.
troy-tae 1826 days ago. link 1 point
I think this module's role is different with classList.
As you said, classList is a API of DOM.
But this module just generates a string.
So... I think this module is useful for framework or library user(React, Angular, Vue)
In VanillaJS, absolutely classList is good :)

And no worries, I'm not care about the downvote.
All of positive or negative opinions always welcome!
troy-tae 1827 days ago. link 1 point
Oh I'm sorry.
This library is for generating css class names.
And this is the examples:
```
// arguments
OneSpaces('cls1', 'cls2') === 'cls2 cls1';
// array
OneSpaces(['cls1', 'cls2']) === 'cls2 cls1';
// exclude falsy
OneSpaces(null, true && 'cls1', false && 'cls2') === 'cls1';
// mix
OneSpaces('cls1', false && 'none', ['cls2']) === 'cls2 cls1';
```
I'll reflect it in my github.
Thank you :)
nevf 1827 days ago. link 1 point
I'm sorry but I have absolutely no idea what this does or why I'd want to use it. Is it for css classnames or JS class names. Examples just show inputs and no outputs.