mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Replace the compareByteArrays
functions, in src/core/crypto.js
, with the isArrayEqual
helper function
The `compareByteArrays` is first of all duplicated in multiple closures in the `src/core/crypto.js` file. Secondly, despite its name, it's also functionally equivalent to the now existing `isArrayEqual` helper function. The `isArrayEqual` helper function is changed to use a standard `for`-loop, rather than `Array.prototype.every`, since that ought to be slightly more efficient given that we're now using it with (potentially) larger data.
This commit is contained in:
parent
061637d3f4
commit
9a9a5b2365
2 changed files with 11 additions and 31 deletions
|
@ -884,9 +884,12 @@ function isArrayEqual(arr1, arr2) {
|
|||
if (arr1.length !== arr2.length) {
|
||||
return false;
|
||||
}
|
||||
return arr1.every(function (element, index) {
|
||||
return element === arr2[index];
|
||||
});
|
||||
for (let i = 0, ii = arr1.length; i < ii; i++) {
|
||||
if (arr1[i] !== arr2[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function getModificationDate(date = new Date()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue