From e938c05edb45335c03f2516ecf48dc12aab8675c Mon Sep 17 00:00:00 2001
From: Jonas Jenwald <jonas.jenwald@gmail.com>
Date: Tue, 27 Apr 2021 13:35:59 +0200
Subject: [PATCH] Convert `src/core/decrypt_stream.js` to use standard classes

---
 src/core/decrypt_stream.js | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/core/decrypt_stream.js b/src/core/decrypt_stream.js
index c4daede47..cc5df1b66 100644
--- a/src/core/decrypt_stream.js
+++ b/src/core/decrypt_stream.js
@@ -15,23 +15,20 @@
 
 import { DecodeStream } from "./stream.js";
 
-const DecryptStream = (function DecryptStreamClosure() {
-  // eslint-disable-next-line no-shadow
-  function DecryptStream(str, maybeLength, decrypt) {
+const chunkSize = 512;
+
+class DecryptStream extends DecodeStream {
+  constructor(str, maybeLength, decrypt) {
+    super(maybeLength);
+
     this.str = str;
     this.dict = str.dict;
     this.decrypt = decrypt;
     this.nextChunk = null;
     this.initialized = false;
-
-    DecodeStream.call(this, maybeLength);
   }
 
-  const chunkSize = 512;
-
-  DecryptStream.prototype = Object.create(DecodeStream.prototype);
-
-  DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
+  readBlock() {
     let chunk;
     if (this.initialized) {
       chunk = this.nextChunk;
@@ -56,9 +53,7 @@ const DecryptStream = (function DecryptStreamClosure() {
       buffer[bufferLength++] = chunk[i];
     }
     this.bufferLength = bufferLength;
-  };
-
-  return DecryptStream;
-})();
+  }
+}
 
 export { DecryptStream };