From 34d4abf4270d0c19bfd42d870954db60c2cdd67d Mon Sep 17 00:00:00 2001 From: Snowflake107 <46562212+Snowflake107@users.noreply.github.com> Date: Mon, 5 Jul 2021 22:59:51 +0545 Subject: [PATCH] refactor(static classes): extend null --- src/utils/QueryResolver.ts | 6 ++---- src/utils/Util.ts | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/utils/QueryResolver.ts b/src/utils/QueryResolver.ts index 2193e08..619d622 100644 --- a/src/utils/QueryResolver.ts +++ b/src/utils/QueryResolver.ts @@ -16,13 +16,11 @@ const attachmentRegex = /^(?:(?:https?|ftp):\/\/)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/; // scary things above *sigh* -class QueryResolver { +class QueryResolver extends null { /** * Query resolver */ - constructor() { - throw new Error("Cannot instantiate static class!"); - } + private constructor() {} // eslint-disable-line @typescript-eslint/no-empty-function /** * Resolves the given search query diff --git a/src/utils/Util.ts b/src/utils/Util.ts index 471039c..e95894b 100644 --- a/src/utils/Util.ts +++ b/src/utils/Util.ts @@ -1,13 +1,11 @@ import { StageChannel, VoiceChannel } from "discord.js"; import { TimeData } from "../types/types"; -class Util { +class Util extends null { /** * Utils */ - constructor() { - throw new Error("Cannot instantiate static class"); - } + private constructor() { } // eslint-disable-line @typescript-eslint/no-empty-function /** * Creates duration string