Skip to content

Commit

Permalink
#1 Removed unnecessary async/await methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesDonnelly committed Jun 1, 2019
1 parent ec4e8c2 commit a44e57e
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/config/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ module.exports = {
currencies: {
/**
* For currencies we need to extract the following fields...
* `ID` - The currency's ID;
* `Icon` - Icon path for the sprite sheet;
* `IconID` - Icon ID to pull from the sprite sheet;
* `ID` - The currency's ID;
* `Name_{lang}` - Localised name;
* `Pural_{lang}` - Localised plural name.
*/
columns: [
'ID',
'Icon',
'IconID',
'ID',
...helper.localisedColumnProperty(`Name`),
...helper.localisedColumnProperty(`Plural`)
],
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/currencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const fs = require('fs');
* @param {Array} data - Currency data from the API.
* @param {Boolean} [isExternalParse] - Whether the parser should return the data instead of creating a file.
*/
module.exports = async (data, isExternalParse) => {
module.exports = (data, isExternalParse) => {
const config = require('../config/data').currencies;

const parsed = data.map(entry => ({
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/gathering.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const items = require('../../data/items.json');
/**
* Parse gathering data from XIVAPI.
*/
module.exports = async (
module.exports = (
gatheringPoints,
gatheringItems,
gatheringTypes,
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
/**
* Parse item data from XIVAPI.
*/
module.exports = async (data) => {
module.exports = (data) => {
const config = require('../config/data').items;
const parsed = {};

Expand Down
2 changes: 1 addition & 1 deletion src/parsers/quests.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const items = require('../../data/items.json');
/**
* Parse recipe data from XIVAPI.
*/
module.exports = async (data) => {
module.exports = (data) => {
const config = require('../config/data').quests;
const parsed = {};

Expand Down
2 changes: 1 addition & 1 deletion src/parsers/recipes.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const fs = require('fs');
/**
* Parse recipe data from XIVAPI.
*/
module.exports = async (data) => {
module.exports = (data) => {
const config = require('../config/data').recipes;
const parsed = {};

Expand Down
8 changes: 5 additions & 3 deletions src/parsers/shops.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
const fs = require('fs');
const currencies = require('../../data/currencies.json');
const currencyParser = require('../parsers/currencies');
const items = require('../../data/items.json');

/**
* Parse recipe data from XIVAPI.
*/
module.exports = async (
module.exports = (
eNPCResidents,
gcScripShopItems
) => {
Expand Down Expand Up @@ -229,8 +230,9 @@ function addNewCustomCurrencyItem(item) {
// Ensure we have all the columns from the currencies config extracted from the item.
columns.forEach(key => rawCurrency[key] = item[key]);

// Send the raw currency data through the parser.
const newCurrency = require('../parsers/currencies')([parsed], true)[0];
// Send the raw currency data through the parser and extract the parsed data from the output.
const newCurrency = (currencyParser([rawCurrency], true))[0];
console.info(`Extended Currencies object to include ${newCurrency.Name_en}.`);

// Extend the currencies array.
currencies.push(newCurrency);
Expand Down
12 changes: 6 additions & 6 deletions src/update.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,19 +66,19 @@ class API {

// Items.
const items = await this.crawl(config.items);
await require('./parsers/items')(items);
require('./parsers/items')(items);

// Currencies.
const currencies = await this.crawl(config.currencies);
await require('./parsers/currencies')(currencies);
require('./parsers/currencies')(currencies);

// Gathering.
const fishingSpots = await this.crawl(config.gathering.fishingSpots);
const gatheringItems = await this.crawl(config.gathering.items);
const gatheringPoints = await this.crawl(config.gathering.points);
const gatheringTypes = await this.crawl(config.gathering.types);
const spearFishingItems = await this.crawl(config.gathering.spearFishingItems);
await require('./parsers/gathering')(
require('./parsers/gathering')(
gatheringPoints,
gatheringItems,
gatheringTypes,
Expand All @@ -89,7 +89,7 @@ class API {
// // Shops.
const eNPCResidents = await this.crawl(config.shops.eNPCResident);
const gcScripShopItems = await this.crawl(config.shops.gcScripShopItem);
await require ('./parsers/shops')(
require ('./parsers/shops')(
eNPCResidents,
gcScripShopItems
);
Expand All @@ -98,10 +98,10 @@ class API {
console.info('Starting parsing of obtain method data...');

const quests = await this.crawl(config.quests);
await require('./parsers/quests')(quests);
require('./parsers/quests')(quests);

const recipes = await this.crawl(config.recipes);
await require('./parsers/recipes')(recipes);
require('./parsers/recipes')(recipes);

console.info('Finished parsing of obtain methods.');
console.timeEnd('Data');
Expand Down

0 comments on commit a44e57e

Please sign in to comment.