Skip to content

Commit

Permalink
MDL-54944 js: ensure functions are consistent in return val
Browse files Browse the repository at this point in the history
Mostly we are being incosnistent when giving an early-exit shortcut.

Detected by http://eslint.org/docs/rules/consistent-return
  • Loading branch information
danpoltawski committed Jul 7, 2016
1 parent 7b7d55e commit 5602dc1
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion admin/tool/lp/amd/src/competencypicker.js
Expand Up @@ -288,7 +288,7 @@ define(['jquery',
$.each(this._frameworks, function(i, f) {
if (f.id == fid) {
frm = f;
return false;
return;
}
});
return frm;
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/amd/src/competencypicker_user_plans.js
Expand Up @@ -129,7 +129,7 @@ define(['jquery',
$.each(this._plans, function(i, f) {
if (f.id == id) {
plan = f;
return false;
return;
}
});
return plan;
Expand Down
8 changes: 4 additions & 4 deletions admin/tool/lp/amd/src/competencyruleconfig.js
Expand Up @@ -137,7 +137,7 @@ define(['jquery',
$.each(this._rules, function(index, rule) {
if (rule.canConfig()) {
can = true;
return false;
return;
}
});
return can;
Expand All @@ -163,7 +163,7 @@ define(['jquery',
RuleConfig.prototype.display = function() {
var self = this;
if (!self._competency) {
return;
return false;
}
return self._render().then(function(html) {
return Str.get_string('competencyrule', 'tool_lp').then(function(title) {
Expand Down Expand Up @@ -276,7 +276,7 @@ define(['jquery',
$.each(this._rules, function(index, rule) {
if (rule.getType() == type) {
result = rule;
return false;
return;
}
});

Expand All @@ -297,7 +297,7 @@ define(['jquery',
$.each(self._rulesModules, function(index, modInfo) {
if (modInfo.type == type) {
name = modInfo.name;
return false;
return;
}
});
return name;
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/lp/amd/src/menubar.js
Expand Up @@ -175,7 +175,7 @@ define(['jquery'], function($) {
if (this.handlers) {
$.each(this.handlers, function(selector, handler) {
if (eventHandled) {
return false;
return;
}
if (item.find(selector).length > 0) {
var callable = $.proxy(handler, anchor);
Expand Down
2 changes: 1 addition & 1 deletion lib/amd/src/notification.js
Expand Up @@ -66,7 +66,7 @@ function(Y, $, log) {
setupTargetRegion: function() {
var targetRegion = $('#' + notificationModule.fieldName);
if (targetRegion.length) {
return;
return false;
}

var newRegion = $('<span>').attr('id', notificationModule.fieldName);
Expand Down
4 changes: 2 additions & 2 deletions lib/amd/src/tag.js
Expand Up @@ -102,7 +102,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
var form = $(this).closest('form').get(0),
cnt = $(form).find("input[type=checkbox]:checked").length;
if (!cnt) {
return false;
return;
}
var tempElement = $("<input type='hidden'/>").attr('name', this.name);
e.preventDefault();
Expand Down Expand Up @@ -134,7 +134,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/str'
notification.alert(s[0], s[1], s[2]);
}
);
return false;
return;
}
var tempElement = $("<input type='hidden'/>").attr('name', this.name);
str.get_strings([
Expand Down
4 changes: 2 additions & 2 deletions mod/lti/amd/src/cartridge_registration_form.js
Expand Up @@ -138,13 +138,13 @@ define(['jquery', 'core/ajax', 'core/notification', 'mod_lti/tool_type', 'mod_lt
*/
var submitCartridgeURL = function() {
if (isLoading()) {
return;
return false;
}

var url = getCartridgeURL();
// No URL? Do nothing.
if (url === "") {
return;
return false;
}

startLoading();
Expand Down

0 comments on commit 5602dc1

Please sign in to comment.