From d540df0582a5003b18bfbe18edabaf841cec942e Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Fri, 13 May 2022 12:42:51 +0200 Subject: [PATCH] Use `TypedArray.prototype.fill()` a bit more in the code-base Please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/fill, which is implemented in all browsers that we currently support. --- src/core/jbig2.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core/jbig2.js b/src/core/jbig2.js index 72f9e8dad..0485e050b 100644 --- a/src/core/jbig2.js +++ b/src/core/jbig2.js @@ -1558,9 +1558,7 @@ class SimpleSegmentVisitor { // The contents of ArrayBuffers are initialized to 0. // Fill the buffer with 0xFF only if info.defaultPixelValue is set if (info.defaultPixelValue) { - for (let i = 0, ii = buffer.length; i < ii; i++) { - buffer[i] = 0xff; - } + buffer.fill(0xff); } this.buffer = buffer; }