Skip to content

Commit

Permalink
fix: guard all toVal calls;
Browse files Browse the repository at this point in the history
+2B, but worth it
  • Loading branch information
lukeed committed May 30, 2020
1 parent 4fa8811 commit 019ec02
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
function toVal(mix) {
var k, y, str='';
if (mix) {
if (typeof mix === 'object') {
if (Array.isArray(mix)) {
for (k=0; k < mix.length; k++) {

if (typeof mix === 'object') {
if (Array.isArray(mix)) {
for (k=0; k < mix.length; k++) {
if (mix[k]) {
if (y = toVal(mix[k])) {
str && (str += ' ');
str += y;
}
}
} else {
for (k in mix) {
if (mix[k]) {
str && (str += ' ');
str += k;
}
}
} else {
for (k in mix) {
if (mix[k]) {
str && (str += ' ');
str += k;
}
}
} else if (typeof mix !== 'boolean' && !mix.call) {
str += mix;
}
} else if (typeof mix !== 'boolean' && !mix.call) {
str += mix;
}

return str;
}

Expand Down

0 comments on commit 019ec02

Please sign in to comment.