Removed redundand JSDOC

pull/73/head
MillenniumEarl 2021-02-25 17:14:31 +01:00
parent 10b1685d8d
commit 739c39b5f8
2 changed files with 8 additions and 8 deletions

View File

@ -30,7 +30,6 @@ const commonConfig = {
/** /**
* Gets the HTML code of a page. * Gets the HTML code of a page.
* @returns {Promise<String>} HTML code or `null` if an error arise
*/ */
export async function fetchHTML(url: string): Promise<string|null> { export async function fetchHTML(url: string): Promise<string|null> {
// Local variables // Local variables
@ -209,21 +208,23 @@ export async function getUrlRedirect(url: string): Promise<string> {
//#region Private methods //#region Private methods
/** /**
* @private
* Check with Axios if a URL exists. * Check with Axios if a URL exists.
* @param {String} url
*/ */
async function axiosUrlExists(url: string): Promise<boolean> { async function axiosUrlExists(url: string): Promise<boolean> {
// Local variables // Local variables
const ERROR_CODES = ["ENOTFOUND", "ETIMEDOUT"];
let valid = false; let valid = false;
try { try {
const response = await axios.head(url, {timeout: 3000}); const response = await axios.head(url, {
timeout: 3000
});
valid = response && !/4\d\d/.test(response.status.toString()); valid = response && !/4\d\d/.test(response.status.toString());
} catch (error) { } catch (error) {
if (error.code === "ENOTFOUND") valid = false; // Throw error only if the error is unknown
else if (error.code === "ETIMEDOUT") valid = false; if (!ERROR_CODES.includes(error.code)) throw error;
else throw error;
} }
return valid; return valid;
} }
//#endregion //#endregion

View File

@ -275,7 +275,6 @@ function fillWithPostData(hw: HandiWork, elements: IPostElement[]) {
/** /**
* Gets the tags used to classify the game. * Gets the tags used to classify the game.
* @param {cheerio.Cheerio} body Page `body` selector * @param {cheerio.Cheerio} body Page `body` selector
* @returns {string[]} List of tags
*/ */
function extractTags(body: cheerio.Cheerio): string[] { function extractTags(body: cheerio.Cheerio): string[] {
shared.logger.trace("Extracting tags..."); shared.logger.trace("Extracting tags...");