mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-11 18:47:23 +00:00
fix: refine pdfjs at compatibility polyfill
Agent-Logs-Url: https://github.com/kekingcn/kkFileView/sessions/287f0212-d368-4b59-ae70-0374fb3fe76f Co-authored-by: klboke <18591662+klboke@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
530304b832
commit
3fbf0156e2
@@ -21,11 +21,11 @@ function installAtPolyfill(target) {
|
||||
Object.defineProperty(target.prototype, "at", {
|
||||
value(index) {
|
||||
const length = this.length >>> 0;
|
||||
let relativeIndex = Number(index) || 0;
|
||||
if (!Number.isFinite(relativeIndex)) {
|
||||
let relativeIndex = Number(index);
|
||||
if (Number.isNaN(relativeIndex)) {
|
||||
relativeIndex = 0;
|
||||
}
|
||||
relativeIndex = relativeIndex < 0 ? Math.ceil(relativeIndex) : Math.floor(relativeIndex);
|
||||
relativeIndex = Math.trunc(relativeIndex);
|
||||
const resolvedIndex = relativeIndex >= 0 ? relativeIndex : length + relativeIndex;
|
||||
if (resolvedIndex < 0 || resolvedIndex >= length) {
|
||||
return undefined;
|
||||
|
||||
Reference in New Issue
Block a user