Skip to content

Commit c4651fd

Browse files
carusogabrielDogfalo
authored andcommitted
Clean elses
1 parent b34f1df commit c4651fd

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

js/carousel.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,9 @@
644644
if (index > this.count || index < 0) {
645645
if (this.noWrap) {
646646
return;
647-
} else {
648-
index = this._wrap(index);
649647
}
648+
649+
index = this._wrap(index);
650650
}
651651
this._cycleTo(index);
652652
}
@@ -664,9 +664,9 @@
664664
if (index > this.count || index < 0) {
665665
if (this.noWrap) {
666666
return;
667-
} else {
668-
index = this._wrap(index);
669667
}
668+
669+
index = this._wrap(index);
670670
}
671671

672672
this._cycleTo(index);
@@ -685,9 +685,9 @@
685685
if (n > this.count || n < 0) {
686686
if (this.noWrap) {
687687
return;
688-
} else {
689-
n = this._wrap(n);
690688
}
689+
690+
n = this._wrap(n);
691691
}
692692

693693
this._cycleTo(n, callback);

js/cash.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -678,11 +678,11 @@
678678
val: function (value) {
679679
if (value === undefined) {
680680
return getValue(this[0]);
681-
} else {
682-
return this.each(function (v) {
683-
return v.value = value;
684-
});
685681
}
682+
683+
return this.each(function (v) {
684+
return v.value = value;
685+
});
686686
}
687687

688688
});

js/chips.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -392,9 +392,9 @@
392392
}
393393
return !exists;
394394

395-
} else {
396-
return false;
397395
}
396+
397+
return false;
398398
}
399399

400400
/**

js/datepicker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -225,9 +225,9 @@
225225
let formattedDate = formatArray.map((label) => {
226226
if (this.formats[label]) {
227227
return this.formats[label]();
228-
} else {
229-
return label;
230228
}
229+
230+
return label;
231231
}).join( '' );
232232
return formattedDate;
233233
}

js/global.js

+10-11
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,23 @@ M.initializeJqueryWrapper = function(plugin, pluginName, classRef) {
6868
if (methodOrOptions.slice(0,3) === 'get') {
6969
let instance = this.first()[0][classRef];
7070
return instance[methodOrOptions].apply(instance, params);
71+
}
7172

7273
// Void methods
73-
} else {
74-
return this.each(function() {
75-
let instance = this[classRef];
76-
instance[methodOrOptions].apply(instance, params);
77-
});
78-
}
74+
return this.each(function() {
75+
let instance = this[classRef];
76+
instance[methodOrOptions].apply(instance, params);
77+
});
7978

8079
// Initialize plugin if options or no argument is passed in
8180
} else if ( typeof methodOrOptions === 'object' || ! methodOrOptions ) {
8281
plugin.init(this, arguments[0]);
8382
return this;
8483

85-
// Return error if an unrecognized method name is passed in
86-
} else {
87-
jQuery.error(`Method ${methodOrOptions} does not exist on jQuery.${pluginName}`);
8884
}
85+
86+
// Return error if an unrecognized method name is passed in
87+
jQuery.error(`Method ${methodOrOptions} does not exist on jQuery.${pluginName}`);
8988
};
9089
};
9190

@@ -266,9 +265,9 @@ M.getOverflowParent = function(element) {
266265

267266
if (element === document.body || getComputedStyle(element).overflow !== 'visible') {
268267
return element;
269-
} else {
270-
return M.getOverflowParent(element.parentElement);
271268
}
269+
270+
return M.getOverflowParent(element.parentElement);
272271
};
273272

274273

js/tooltip.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,9 @@
121121
this._exitDelayTimeout = setTimeout(() => {
122122
if (this.isHovered) {
123123
return;
124-
} else {
125-
this._animateOut();
126124
}
125+
126+
this._animateOut();
127127
}, this.options.exitDelay);
128128
}
129129

@@ -136,9 +136,9 @@
136136
this._enterDelayTimeout = setTimeout(() => {
137137
if (!this.isHovered) {
138138
return;
139-
} else {
140-
this._animateIn();
141139
}
140+
141+
this._animateIn();
142142
}, this.options.enterDelay);
143143
}
144144

0 commit comments

Comments
 (0)