diff --git a/classes/CEconItem.js b/classes/CEconItem.js index 49eebd5..5d7dd9e 100644 --- a/classes/CEconItem.js +++ b/classes/CEconItem.js @@ -44,15 +44,13 @@ function CEconItem(item, description, contextID) { // Restore old property names of tags if (this.tags) { - this.tags = this.tags.map(function(tag) { - return { - internal_name: tag.internal_name, - name: tag.localized_tag_name || tag.name, - category: tag.category, - color: tag.color || '', - category_name: tag.localized_category_name || tag.category_name - }; - }); + this.tags = this.tags.map((tag) => ({ + internal_name: tag.internal_name, + name: tag.localized_tag_name || tag.name, + category: tag.category, + color: tag.color || '', + category_name: tag.localized_category_name || tag.category_name + })); } // Restore market_fee_app, if applicable diff --git a/classes/CMarketItem.js b/classes/CMarketItem.js index c489cb4..ba75d14 100644 --- a/classes/CMarketItem.js +++ b/classes/CMarketItem.js @@ -22,7 +22,7 @@ SteamCommunity.prototype.getMarketItem = function(appid, hashName, currency, cal } let item = new CMarketItem(appid, hashName, this, body, $); - item.updatePrice(currency, function(err) { + item.updatePrice(currency, (err) => { if (err) { callback(err); } else { @@ -62,13 +62,11 @@ function CMarketItem(appid, hashName, community, body, $) { if (match) { try { this.medianSalePrices = JSON.parse(match[1]); - this.medianSalePrices = this.medianSalePrices.map(function(item) { - return { - hour: new Date(item[0]), - price: item[1], - quantity: parseInt(item[2], 10) - }; - }); + this.medianSalePrices = this.medianSalePrices.map((item) => ({ + hour: new Date(item[0]), + price: item[1], + quantity: parseInt(item[2], 10) + })); } catch (e) { // ignore } diff --git a/classes/CMarketSearchResult.js b/classes/CMarketSearchResult.js index 3affa66..d0f9e80 100644 --- a/classes/CMarketSearchResult.js +++ b/classes/CMarketSearchResult.js @@ -38,7 +38,7 @@ SteamCommunity.prototype.marketSearch = function(options, callback) { referer: 'https://steamcommunity.com/market/search' }, json: true - }, function(err, response, body) { + }, (err, response, body) => { if (err) { callback(err); return; diff --git a/classes/CSteamGroup.js b/classes/CSteamGroup.js index b1a3139..6d8d74b 100644 --- a/classes/CSteamGroup.js +++ b/classes/CSteamGroup.js @@ -19,7 +19,7 @@ SteamCommunity.prototype.getSteamGroup = function(id, callback) { return; } - XML2JS.parseString(body, function(err, result) { + XML2JS.parseString(body, (err, result) => { if (err) { callback(err); return; diff --git a/classes/CSteamUser.js b/classes/CSteamUser.js index 5ba68d3..195f7a3 100644 --- a/classes/CSteamUser.js +++ b/classes/CSteamUser.js @@ -19,7 +19,7 @@ SteamCommunity.prototype.getSteamUser = function(id, callback) { return; } - XML2JS.parseString(body, function(err, result) { + XML2JS.parseString(body, (err, result) => { if (err || (!result.response && !result.profile)) { callback(err || new Error('No valid response')); return; diff --git a/components/groups.js b/components/groups.js index 40d4f04..74dcf56 100644 --- a/components/groups.js +++ b/components/groups.js @@ -552,6 +552,8 @@ SteamCommunity.prototype.getAllGroupComments = function(gid, from, count, callba let $ = Cheerio.load(JSON.parse(body).comments_html); + // !! DO NOT replace this function with an arrow function. We depend on the `this` context inside the function, + // which is the comment element. $('.commentthread_comment_content').each(function() { let comment = {};