refactor(api): Use forEach instead of a for loop

This commit is contained in:
Blade Barringer 2016-09-10 23:03:42 -05:00
parent 923b6c495e
commit ed4039c08c

View file

@ -608,12 +608,11 @@ schema.methods._processCollectionQuest = async function processCollectionQuest (
});
// Add 0 for all items not found
let questItems = Object.keys(this.quest.progress.collect);
for (let i = 0; i < questItems.length; i++) {
if (!itemsFound[questItems[i]]) {
itemsFound[questItems[i]] = 0;
Object.keys(this.quest.progress.collect).forEach((item) => {
if (!itemsFound[item]) {
itemsFound[item] = 0;
}
}
});
let foundText = _.reduce(itemsFound, (m, v, k) => {
m.push(`${v} ${quest.collect[k].text('en')}`);