From 14ea875c679b7cee3ff06a54e09e859f0cd38f98 Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Sun, 6 Apr 2025 18:37:57 +0200 Subject: [PATCH] chore: Inline some trivial private methods (#946) --- src/core/Actions.ts | 19 ++++++------------- src/parser/helpers.ts | 11 +---------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/core/Actions.ts b/src/core/Actions.ts index 4bd2aea9..0acdce59 100644 --- a/src/core/Actions.ts +++ b/src/core/Actions.ts @@ -50,18 +50,6 @@ export default class Actions { this.session = session; } - /** - * Mimics the Axios API using Fetch's Response object. - * @param response - The response object. - */ - async #wrap(response: Response): Promise { - return { - success: response.ok, - status_code: response.status, - data: JSON.parse(await response.text()) - }; - } - /** * Makes calls to the playback tracking API. * @param url - The URL to call. @@ -187,7 +175,12 @@ export default class Actions { return parsed_response; } - return this.#wrap(response); + // Mimics the Axios API using Fetch's Response object. + return { + success: response.ok, + status_code: response.status, + data: JSON.parse(await response.text()) + }; } #isBrowse(response: IParsedResponse): response is IBrowseResponse { diff --git a/src/parser/helpers.ts b/src/parser/helpers.ts index 09900b7c..6d110b66 100644 --- a/src/parser/helpers.ts +++ b/src/parser/helpers.ts @@ -11,22 +11,13 @@ export class YTNode { this.type = (this.constructor as YTNodeConstructor).type; } - /** - * Check if the node is of the given type. - * @param type - The type to check - * @returns whether the node is of the given type - */ - #is(type: YTNodeConstructor): this is T { - return this.type === type.type; - } - /** * Check if the node is of the given type. * @param types - The type to check * @returns whether the node is of the given type */ is[]>(...types: K): this is InstanceType { - return types.some((type) => this.#is(type)); + return types.some((type) => this.type === type.type); } /**