Skip to content
Myr

index.js

This file

Path

src/index.js

43 lines · 705 bytes · JavaScript

Last changed by

chore: dedicated string vs number var usage;Luke Edwardsbefore adoption554ad31

History of this file

Take it

import module logicLuke Edwardsbefore adoption30520d3

lines 1–2why, one step back
1function toVal(mix) {
2 var k, y, str='';

fix: guard all `toVal` calls;Luke Edwardsbefore adoption019ec02

line 3why, one step back
3

fix: reorder typeof checksLuke Edwardsbefore adoption08a5a7f

lines 4–6why, one step back
4 if (typeof mix === 'string' || typeof mix === 'number') {
5 str += mix;6 } else if (typeof mix === 'object') {

fix: guard all `toVal` calls;Luke Edwardsbefore adoption019ec02

line 7why, one step back
7 if (Array.isArray(mix)) {

chore: cache arguments/array lengths (#26)Jalal azimibefore adoptiondeff09b

lines 8–9why, one step back
8 var len=mix.length;
9 for (k=0; k < len; k++) {

fix: guard all `toVal` calls;Luke Edwardsbefore adoption019ec02

line 10why, one step back
10 if (mix[k]) {

fix: use falsey check from arguments;Luke Edwardsbefore adoption4fa8811

line 11why, one step back
11 if (y = toVal(mix[k])) {

chore: rearrange pkg keysLuke Edwardsbefore adoption42bf238

lines 12–14why, one step back
12 str && (str += ' ');
13 str += y;14 }

fix: separate object vs array loopLuke Edwardsbefore adoption91f5e68

line 15why, one step back
15 }

fix: guard all `toVal` calls;Luke Edwardsbefore adoption019ec02

lines 16–17why, one step back
16 }
17 } else {

chore: dedicated string vs number var usage;Luke Edwardsbefore adoption554ad31

lines 18–19why, one step back
18 for (y in mix) {
19 if (mix[y]) {

fix: guard all `toVal` calls;Luke Edwardsbefore adoption019ec02

line 20why, one step back
20 str && (str += ' ');

chore: dedicated string vs number var usage;Luke Edwardsbefore adoption554ad31

line 21why, one step back
21 str += y;

import module logicLuke Edwardsbefore adoption30520d3

lines 22–25why, one step back
22 }
23 }24 }25 }

fix: guard all `toVal` calls;Luke Edwardsbefore adoption019ec02

line 26why, one step back
26

import module logicLuke Edwardsbefore adoption30520d3

lines 27–29why, one step back
27 return str;
28}29

feat: add named `clsx` export alias (#44)danikazebefore adoption56ab81f

line 30why, one step back
30export function clsx() {

chore: cache arguments/array lengths (#26)Jalal azimibefore adoptiondeff09b

lines 31–33why, one step back
31 var i=0, tmp, x, str='', len=arguments.length;
32 for (; i < len; i++) {33 if (tmp = arguments[i]) {

fix: use falsey check from arguments;Luke Edwardsbefore adoption4fa8811

lines 34–37why, one step back
34 if (x = toVal(tmp)) {
35 str && (str += ' ');36 str += x37 }

import module logicLuke Edwardsbefore adoption30520d3

lines 38–40why, one step back
38 }
39 }40 return str;

initial commitLuke Edwardsbefore adoptiondb7477a

line 41
41}

feat: add named `clsx` export alias (#44)danikazebefore adoption56ab81f

lines 42–43why, one step back
42
43export default clsx;