use spread operator to combine multiple quest objects into one

This commit is contained in:
CuriousMagpie
2022-02-02 16:48:48 -05:00
parent 40f8c049ab
commit 98b43c681a

View File

@@ -1,7 +1,5 @@
import defaults from 'lodash/defaults'; import defaults from 'lodash/defaults';
import each from 'lodash/each'; import each from 'lodash/each';
// import find from 'lodash/find';
// import moment from 'moment';
import sortBy from 'lodash/sortBy'; import sortBy from 'lodash/sortBy';
import t from './translation'; import t from './translation';
import { import {
@@ -26,21 +24,18 @@ const questSeries = QUEST_SERIES;
const questTimeTravel = QUEST_TIME_TRAVEL; const questTimeTravel = QUEST_TIME_TRAVEL;
const questWorld = QUEST_WORLD; const questWorld = QUEST_WORLD;
// need to reconstruct a flat list from these by -- // this uses the spread operator, which allows us to combine multiple objects into one
// check for a lodash object tht will combine multiple objects into one obects const quests = {
// I've added an additional ayer to the tree that the api and the rest of the ...questGeneric,
// code in this file are not expecting hence api.quests not being found ...questMasterclasser,
...questPets,
...questPotions,
...questSeasonal,
...questSeries,
...questTimeTravel,
...questWorld,
};
const quests = questGeneric.concat(
questMasterclasser,
questPets,
questPotions,
questSeasonal,
questSeries,
questTimeTravel,
questWorld,
);
console.log(quests);
each(quests, (v, key) => { each(quests, (v, key) => {
defaults(v, { defaults(v, {
key, key,