Skip to content

Commit

Permalink
chore: cache arguments/array lengths (#26)
Browse files Browse the repository at this point in the history
* feat: enhance performance

* chore: undo Extracting k to the outer level

Co-authored-by: Sukka <[email protected]>

* Apply suggestions from code review

---------

Co-authored-by: Sukka <[email protected]>
Co-authored-by: Luke Edwards <[email protected]>
  • Loading branch information
3 people authored Dec 29, 2023
1 parent 6e2468e commit deff09b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ function toVal(mix) {
str += mix;
} else if (typeof mix === 'object') {
if (Array.isArray(mix)) {
for (k=0; k < mix.length; k++) {
var len=mix.length;
for (k=0; k < len; k++) {
if (mix[k]) {
if (y = toVal(mix[k])) {
str && (str += ' ');
Expand All @@ -27,9 +28,9 @@ function toVal(mix) {
}

export function clsx() {
var i=0, tmp, x, str='';
while (i < arguments.length) {
if (tmp = arguments[i++]) {
var i=0, tmp, x, str='', len=arguments.length;
for (; i < len; i++) {
if (tmp = arguments[i]) {
if (x = toVal(tmp)) {
str && (str += ' ');
str += x
Expand Down

0 comments on commit deff09b

Please sign in to comment.