From c7b82e6a40b93378ac377218d32c89c1be6013ad Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Thu, 30 Dec 2021 17:24:38 +0100 Subject: [PATCH] Minor seeking performance optimisation --- play-dl/YouTube/classes/WebmSeeker.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/play-dl/YouTube/classes/WebmSeeker.ts b/play-dl/YouTube/classes/WebmSeeker.ts index d578274..efef00b 100644 --- a/play-dl/YouTube/classes/WebmSeeker.ts +++ b/play-dl/YouTube/classes/WebmSeeker.ts @@ -18,6 +18,8 @@ interface WebmSeekerOptions extends DuplexOptions { mode?: 'precise' | 'granular'; } +const WEB_ELEMENT_KEYS = Object.keys(WebmElements); + export class WebmSeeker extends Duplex { remaining?: Buffer; state: WebmSeekerState; @@ -211,7 +213,7 @@ export class WebmSeeker extends Duplex { } private parseEbmlID(ebmlID: string) { - if (Object.keys(WebmElements).includes(ebmlID)) return WebmElements[ebmlID]; + if (WEB_ELEMENT_KEYS.includes(ebmlID)) return WebmElements[ebmlID]; else return false; }