@eso-status/forum-message 2.0.0-dev.13 → 2.0.0-dev.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -60,9 +60,9 @@ export default class Connector {
60
60
  */
61
61
  private fetch;
62
62
  /**
63
- * Method to create the return list with all the data contained in the announcements, sorted by importance while avoiding duplicates
64
- * @param matches List of all the data contained in the announcements
63
+ * Method for retrieving the information contained in an announcement
64
+ * @param raw Raw data of the announcement
65
65
  * @private
66
66
  */
67
- private fetchAll;
67
+ private fetchEach;
68
68
  }
package/lib/connector.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const axios_1 = require("axios");
4
- const types_1 = require("@eso-status/types");
5
4
  const raw_1 = require("./raw");
6
5
  /**
7
6
  * Class for retrieving information from announcements
@@ -126,40 +125,16 @@ class Connector {
126
125
  * @private
127
126
  */
128
127
  fetch() {
129
- const matches = [];
130
- this.raw.forEach((raw) => {
131
- new raw_1.default(this.url, raw).matches.forEach((match) => {
132
- matches.push(match);
133
- });
134
- });
135
- this.fetchAll(matches);
128
+ this.raw.forEach((raw) => this.fetchEach(raw));
136
129
  }
137
130
  /**
138
- * Method to create the return list with all the data contained in the announcements, sorted by importance while avoiding duplicates
139
- * @param matches List of all the data contained in the announcements
131
+ * Method for retrieving the information contained in an announcement
132
+ * @param raw Raw data of the announcement
140
133
  * @private
141
134
  */
142
- fetchAll(matches) {
143
- matches.forEach((match) => {
144
- const alreadyInList = this.rawEsoStatus.filter((esoStatusRawData) => esoStatusRawData.slug === match.slug).length !== 0;
145
- const alone = matches.filter((esoStatusRawData) => esoStatusRawData.slug === match.slug).length === 1;
146
- const slugIsIssues = matches.filter((esoStatusRawData) => esoStatusRawData.status === types_1.IssuesStatus &&
147
- esoStatusRawData.slug === match.slug).length !== 0;
148
- const slugIsUp = matches.filter((esoStatusRawData) => esoStatusRawData.status === types_1.UpStatus &&
149
- esoStatusRawData.slug === match.slug).length !== 0;
150
- const slugIsDown = matches.filter((esoStatusRawData) => esoStatusRawData.status === types_1.DownStatus &&
151
- esoStatusRawData.slug === match.slug).length !== 0;
152
- const countSlugMaintenance = matches.filter((esoStatusRawData) => esoStatusRawData.status === types_1.PlannedStatus &&
153
- esoStatusRawData.slug === match.slug).length;
154
- if (!alreadyInList) {
155
- if (alone ||
156
- countSlugMaintenance >= 2 ||
157
- (match.status === types_1.IssuesStatus && slugIsIssues) ||
158
- (match.status === types_1.UpStatus && slugIsUp) ||
159
- (match.status === types_1.DownStatus && slugIsDown)) {
160
- this.rawEsoStatus.push(match);
161
- }
162
- }
135
+ fetchEach(raw) {
136
+ new raw_1.default(this.url, raw).matches.forEach((match) => {
137
+ this.rawEsoStatus.push(match);
163
138
  });
164
139
  }
165
140
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eso-status/forum-message",
3
- "version": "2.0.0-dev.13",
3
+ "version": "2.0.0-dev.14",
4
4
  "description": "Library for retrieving and formatting data, available at https://forums.elderscrollsonline.com or https://forums.elderscrollsonline.com/en/categories/pts",
5
5
  "author": "@dov118 <contact@dov118.dev> (https://dov118.dev)",
6
6
  "main": "lib/index.js",