Modernize ES for-loops and remove problematic for-in loops
This slightly modifies the behaviour of errors (see init.js)
Change-Id: I1aab691d5b7e8167b6213378bdd9139c133202cd
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index f9eaa13..4482316 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -262,22 +262,20 @@
};
if (KorAP.koralQuery["errors"]) {
- var errors = KorAP.koralQuery["errors"];
- for (var i in errors) {
+ KorAP.koralQuery["errors"].forEach(function(e) {
// Malformed query
- if (errors[i][0] === 302 && errors[i][2]) {
+ if (e[0] === 302 && e[2]) {
obj.hint = hintClass.create();
- obj.hint.alert(errors[i][2], errors[i][1]);
- break;
+ obj.hint.alert(e[2], e[1]);
}
// no query
- else if (errors[i][0] === 301) {
+ else if (e[0] === 301) {
obj.hint = hintClass.create();
- obj.hint.alert(0, errors[i][1]);
+ obj.hint.alert(0, e[1]);
}
- }
+ });
};
};