Skip to content

Commit

Permalink
refactor for-of loops out
Browse files Browse the repository at this point in the history
apparently we cant use them
  • Loading branch information
stephenmathieson committed Jul 30, 2018
1 parent ed09ba1 commit 4ca55bc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/core/base/audit.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ Audit.prototype._setPreviousLocale = function() {
rules: {}
};

for (const id of Object.keys(this.data.checks)) {
const checkIDs = Object.keys(this.data.checks);
for (let i = 0; i < checkIDs.length; i++) {
const id = checkIDs[i];
const check = this.data.checks[id];
const { pass, fail, incomplete } = check.messages;
locale.checks[id] = {
Expand All @@ -78,7 +80,9 @@ Audit.prototype._setPreviousLocale = function() {
};
}

for (const id of Object.keys(this.data.rules)) {
const ruleIDs = Object.keys(this.data.rules);
for (let i = 0; i < ruleIDs.length; i++) {
const id = ruleIDs[i];
const rule = this.data.rules[id];
const { description, help } = rule;
locale.rules[id] = { description, help };
Expand Down Expand Up @@ -179,7 +183,9 @@ Audit.prototype.applyLocale = function(locale) {
this._setPreviousLocale();

if (locale.checks) {
for (const id of Object.keys(locale.checks)) {
const keys = Object.keys(locale.checks);
for (let i = 0; i < keys.length; i++) {
const id = keys[i];
if (!this.data.checks[id]) {
throw new Error(`Locale provided for unknown check: "${id}"`);
}
Expand All @@ -192,7 +198,9 @@ Audit.prototype.applyLocale = function(locale) {
}

if (locale.rules) {
for (const id of Object.keys(locale.rules)) {
const keys = Object.keys(locale.rules);
for (let i = 0; i < keys.length; i++) {
const id = keys[i];
if (!this.data.rules[id]) {
throw new Error(`Locale provided for unknown rule: "${id}"`);
}
Expand Down

0 comments on commit 4ca55bc

Please sign in to comment.