Merge pull request #15014 from Snuffleupagus/prefer-at
Enable the `unicorn/prefer-at` ESLint plugin rule (PR 15008 follow-up)
This commit is contained in:
commit
f0b5aee6b8
@ -49,6 +49,7 @@
|
|||||||
"unicorn/no-new-buffer": "error",
|
"unicorn/no-new-buffer": "error",
|
||||||
"unicorn/no-instanceof-array": "error",
|
"unicorn/no-instanceof-array": "error",
|
||||||
"unicorn/no-useless-spread": "error",
|
"unicorn/no-useless-spread": "error",
|
||||||
|
"unicorn/prefer-at": "error",
|
||||||
"unicorn/prefer-date-now": "error",
|
"unicorn/prefer-date-now": "error",
|
||||||
"unicorn/prefer-dom-node-remove": "error",
|
"unicorn/prefer-dom-node-remove": "error",
|
||||||
"unicorn/prefer-string-starts-ends-with": "error",
|
"unicorn/prefer-string-starts-ends-with": "error",
|
||||||
|
4
external/.eslintrc
vendored
4
external/.eslintrc
vendored
@ -6,4 +6,8 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"node": true,
|
"node": true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"rules": {
|
||||||
|
"unicorn/prefer-at": "off",
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
@ -1212,7 +1212,7 @@ class Catalog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while (queue.length > 0) {
|
while (queue.length > 0) {
|
||||||
const queueItem = queue[queue.length - 1];
|
const queueItem = queue.at(-1);
|
||||||
const { currentNode, posInKids } = queueItem;
|
const { currentNode, posInKids } = queueItem;
|
||||||
|
|
||||||
let kids = currentNode.getRaw("Kids");
|
let kids = currentNode.getRaw("Kids");
|
||||||
|
@ -1014,7 +1014,7 @@ class AESBaseCipher {
|
|||||||
let outputLength = 16 * result.length;
|
let outputLength = 16 * result.length;
|
||||||
if (finalize) {
|
if (finalize) {
|
||||||
// undo a padding that is described in RFC 2898
|
// undo a padding that is described in RFC 2898
|
||||||
const lastBlock = result[result.length - 1];
|
const lastBlock = result.at(-1);
|
||||||
let psLen = lastBlock[15];
|
let psLen = lastBlock[15];
|
||||||
if (psLen <= 16) {
|
if (psLen <= 16) {
|
||||||
for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
|
for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
|
||||||
@ -1284,7 +1284,7 @@ const PDF20 = (function PDF20Closure() {
|
|||||||
let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
|
let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
|
||||||
let e = [0];
|
let e = [0];
|
||||||
let i = 0;
|
let i = 0;
|
||||||
while (i < 64 || e[e.length - 1] > i - 32) {
|
while (i < 64 || e.at(-1) > i - 32) {
|
||||||
const combinedLength = password.length + k.length + userBytes.length,
|
const combinedLength = password.length + k.length + userBytes.length,
|
||||||
combinedArray = new Uint8Array(combinedLength);
|
combinedArray = new Uint8Array(combinedLength);
|
||||||
let writeOffset = 0;
|
let writeOffset = 0;
|
||||||
|
@ -1045,7 +1045,7 @@ class PDFDocument {
|
|||||||
const pdfFonts = [];
|
const pdfFonts = [];
|
||||||
const initialState = {
|
const initialState = {
|
||||||
get font() {
|
get font() {
|
||||||
return pdfFonts[pdfFonts.length - 1];
|
return pdfFonts.at(-1);
|
||||||
},
|
},
|
||||||
set font(font) {
|
set font(font) {
|
||||||
pdfFonts.push(font);
|
pdfFonts.push(font);
|
||||||
|
@ -3066,7 +3066,7 @@ class PartialEvaluator {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const item = elements[elements.length - 1];
|
const item = elements.at(-1);
|
||||||
if (typeof item === "string") {
|
if (typeof item === "string") {
|
||||||
showSpacedTextBuffer.push(item);
|
showSpacedTextBuffer.push(item);
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ function compileGlyf(code, cmds, font) {
|
|||||||
}
|
}
|
||||||
const instructionLength = getUint16(code, i);
|
const instructionLength = getUint16(code, i);
|
||||||
i += 2 + instructionLength; // skipping the instructions
|
i += 2 + instructionLength; // skipping the instructions
|
||||||
const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
|
const numberOfPoints = endPtsOfContours.at(-1) + 1;
|
||||||
const points = [];
|
const points = [];
|
||||||
while (points.length < numberOfPoints) {
|
while (points.length < numberOfPoints) {
|
||||||
flags = code[i++];
|
flags = code[i++];
|
||||||
@ -329,15 +329,15 @@ function compileGlyf(code, cmds, font) {
|
|||||||
const contour = points.slice(startPoint, endPoint + 1);
|
const contour = points.slice(startPoint, endPoint + 1);
|
||||||
if (contour[0].flags & 1) {
|
if (contour[0].flags & 1) {
|
||||||
contour.push(contour[0]); // using start point at the contour end
|
contour.push(contour[0]); // using start point at the contour end
|
||||||
} else if (contour[contour.length - 1].flags & 1) {
|
} else if (contour.at(-1).flags & 1) {
|
||||||
// first is off-curve point, trying to use one from the end
|
// first is off-curve point, trying to use one from the end
|
||||||
contour.unshift(contour[contour.length - 1]);
|
contour.unshift(contour.at(-1));
|
||||||
} else {
|
} else {
|
||||||
// start and end are off-curve points, creating implicit one
|
// start and end are off-curve points, creating implicit one
|
||||||
const p = {
|
const p = {
|
||||||
flags: 1,
|
flags: 1,
|
||||||
x: (contour[0].x + contour[contour.length - 1].x) / 2,
|
x: (contour[0].x + contour.at(-1).x) / 2,
|
||||||
y: (contour[0].y + contour[contour.length - 1].y) / 2,
|
y: (contour[0].y + contour.at(-1).y) / 2,
|
||||||
};
|
};
|
||||||
contour.unshift(p);
|
contour.unshift(p);
|
||||||
contour.push(p);
|
contour.push(p);
|
||||||
|
@ -515,7 +515,7 @@ function getRanges(glyphs, numGlyphs) {
|
|||||||
|
|
||||||
function createCmapTable(glyphs, numGlyphs) {
|
function createCmapTable(glyphs, numGlyphs) {
|
||||||
const ranges = getRanges(glyphs, numGlyphs);
|
const ranges = getRanges(glyphs, numGlyphs);
|
||||||
const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
|
const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
|
||||||
let cmap =
|
let cmap =
|
||||||
"\x00\x00" + // version
|
"\x00\x00" + // version
|
||||||
string16(numTables) + // numTables
|
string16(numTables) + // numTables
|
||||||
@ -2291,7 +2291,7 @@ class Font {
|
|||||||
// CALL
|
// CALL
|
||||||
if (!inFDEF && !inELSE) {
|
if (!inFDEF && !inELSE) {
|
||||||
// collecting information about which functions are used
|
// collecting information about which functions are used
|
||||||
funcId = stack[stack.length - 1];
|
funcId = stack.at(-1);
|
||||||
if (isNaN(funcId)) {
|
if (isNaN(funcId)) {
|
||||||
info("TT: CALL empty stack (or invalid entry).");
|
info("TT: CALL empty stack (or invalid entry).");
|
||||||
} else {
|
} else {
|
||||||
@ -2374,7 +2374,7 @@ class Font {
|
|||||||
} else if (op === 0x1c) {
|
} else if (op === 0x1c) {
|
||||||
// JMPR
|
// JMPR
|
||||||
if (!inFDEF && !inELSE) {
|
if (!inFDEF && !inELSE) {
|
||||||
const offset = stack[stack.length - 1];
|
const offset = stack.at(-1);
|
||||||
// only jumping forward to prevent infinite loop
|
// only jumping forward to prevent infinite loop
|
||||||
if (offset > 0) {
|
if (offset > 0) {
|
||||||
i += offset - 1;
|
i += offset - 1;
|
||||||
|
@ -1166,7 +1166,7 @@ const PostScriptCompiler = (function PostScriptCompilerClosure() {
|
|||||||
i += 6;
|
i += 6;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ast1 = stack[stack.length - 1];
|
ast1 = stack.at(-1);
|
||||||
if (ast1.type === "literal" || ast1.type === "var") {
|
if (ast1.type === "literal" || ast1.type === "var") {
|
||||||
// we don't have to save into intermediate variable a literal or
|
// we don't have to save into intermediate variable a literal or
|
||||||
// variable.
|
// variable.
|
||||||
|
@ -27,7 +27,7 @@ function addState(parentState, pattern, checkFn, iterateFn, processFn) {
|
|||||||
const item = pattern[i];
|
const item = pattern[i];
|
||||||
state = state[item] || (state[item] = []);
|
state = state[item] || (state[item] = []);
|
||||||
}
|
}
|
||||||
state[pattern[pattern.length - 1]] = {
|
state[pattern.at(-1)] = {
|
||||||
checkFn,
|
checkFn,
|
||||||
iterateFn,
|
iterateFn,
|
||||||
processFn,
|
processFn,
|
||||||
|
@ -206,7 +206,7 @@ class RadialAxialShading extends BaseShading {
|
|||||||
}
|
}
|
||||||
if (!extendEnd) {
|
if (!extendEnd) {
|
||||||
// Same idea as above in extendStart but for the end.
|
// Same idea as above in extendStart but for the end.
|
||||||
colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER;
|
colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
|
||||||
colorStops.push([1, background]);
|
colorStops.push([1, background]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,11 +501,11 @@ class MeshShading extends BaseShading {
|
|||||||
verticesLeft = 3;
|
verticesLeft = 3;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ps.push(ps[ps.length - 2], ps[ps.length - 1]);
|
ps.push(ps.at(-2), ps.at(-1));
|
||||||
verticesLeft = 1;
|
verticesLeft = 1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ps.push(ps[ps.length - 3], ps[ps.length - 1]);
|
ps.push(ps.at(-3), ps.at(-1));
|
||||||
verticesLeft = 1;
|
verticesLeft = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ const Type1CharString = (function Type1CharStringClosure() {
|
|||||||
// seac is like type 2's special endchar but it doesn't use the
|
// seac is like type 2's special endchar but it doesn't use the
|
||||||
// first argument asb, so remove it.
|
// first argument asb, so remove it.
|
||||||
if (seacAnalysisEnabled) {
|
if (seacAnalysisEnabled) {
|
||||||
const asb = this.stack[this.stack.length - 5];
|
const asb = this.stack.at(-5);
|
||||||
this.seac = this.stack.splice(-4, 4);
|
this.seac = this.stack.splice(-4, 4);
|
||||||
this.seac[0] += this.lsb - asb;
|
this.seac[0] += this.lsb - asb;
|
||||||
error = this.executeCommand(0, COMMAND_MAP.endchar);
|
error = this.executeCommand(0, COMMAND_MAP.endchar);
|
||||||
|
@ -249,7 +249,7 @@ function incrementalUpdate({
|
|||||||
const refForXrefTable = xrefInfo.newRef;
|
const refForXrefTable = xrefInfo.newRef;
|
||||||
|
|
||||||
let buffer, baseOffset;
|
let buffer, baseOffset;
|
||||||
const lastByte = originalData[originalData.length - 1];
|
const lastByte = originalData.at(-1);
|
||||||
if (lastByte === /* \n */ 0x0a || lastByte === /* \r */ 0x0d) {
|
if (lastByte === /* \n */ 0x0a || lastByte === /* \r */ 0x0d) {
|
||||||
buffer = [];
|
buffer = [];
|
||||||
baseOffset = originalData.length;
|
baseOffset = originalData.length;
|
||||||
|
@ -182,7 +182,7 @@ class Builder {
|
|||||||
}
|
}
|
||||||
const prefixStack = this._namespacePrefixes.get(prefix);
|
const prefixStack = this._namespacePrefixes.get(prefix);
|
||||||
if (prefixStack && prefixStack.length > 0) {
|
if (prefixStack && prefixStack.length > 0) {
|
||||||
return prefixStack[prefixStack.length - 1];
|
return prefixStack.at(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
warn(`Unknown namespace prefix: ${prefix}.`);
|
warn(`Unknown namespace prefix: ${prefix}.`);
|
||||||
|
@ -32,7 +32,7 @@ class DataHandler {
|
|||||||
const stack = [[-1, this.data[$getChildren]()]];
|
const stack = [[-1, this.data[$getChildren]()]];
|
||||||
|
|
||||||
while (stack.length > 0) {
|
while (stack.length > 0) {
|
||||||
const last = stack[stack.length - 1];
|
const last = stack.at(-1);
|
||||||
const [i, children] = last;
|
const [i, children] = last;
|
||||||
if (i + 1 === children.length) {
|
if (i + 1 === children.length) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
|
@ -354,7 +354,7 @@ class SimpleExprParser {
|
|||||||
return [tok, this.getNode()];
|
return [tok, this.getNode()];
|
||||||
case TOKEN.leftParen:
|
case TOKEN.leftParen:
|
||||||
if (this.last === OPERAND) {
|
if (this.last === OPERAND) {
|
||||||
const lastOperand = this.operands[this.operands.length - 1];
|
const lastOperand = this.operands.at(-1);
|
||||||
if (!(lastOperand instanceof AstIdentifier)) {
|
if (!(lastOperand instanceof AstIdentifier)) {
|
||||||
return [tok, this.getNode()];
|
return [tok, this.getNode()];
|
||||||
}
|
}
|
||||||
@ -525,7 +525,7 @@ class SimpleExprParser {
|
|||||||
|
|
||||||
flushWithOperator(op) {
|
flushWithOperator(op) {
|
||||||
while (true) {
|
while (true) {
|
||||||
const top = this.operators[this.operators.length - 1];
|
const top = this.operators.at(-1);
|
||||||
if (top) {
|
if (top) {
|
||||||
if (top.id >= 0 && SimpleExprParser.checkPrecedence(top, op)) {
|
if (top.id >= 0 && SimpleExprParser.checkPrecedence(top, op)) {
|
||||||
this.operators.pop();
|
this.operators.pop();
|
||||||
|
@ -562,7 +562,7 @@ function isPrintOnly(node) {
|
|||||||
|
|
||||||
function getCurrentPara(node) {
|
function getCurrentPara(node) {
|
||||||
const stack = node[$getTemplateRoot]()[$extra].paraStack;
|
const stack = node[$getTemplateRoot]()[$extra].paraStack;
|
||||||
return stack.length ? stack[stack.length - 1] : null;
|
return stack.length ? stack.at(-1) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPara(node, nodeStyle, value) {
|
function setPara(node, nodeStyle, value) {
|
||||||
|
@ -100,7 +100,7 @@ function parseExpression(expr, dotDotAllowed, noExpr = true) {
|
|||||||
warn("XFA - Invalid index in SOM expression");
|
warn("XFA - Invalid index in SOM expression");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
parsed[parsed.length - 1].index = parseIndex(match[0]);
|
parsed.at(-1).index = parseIndex(match[0]);
|
||||||
pos += match[0].length + 1;
|
pos += match[0].length + 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -910,7 +910,7 @@ class Border extends XFAObject {
|
|||||||
if (!this[$extra]) {
|
if (!this[$extra]) {
|
||||||
const edges = this.edge.children.slice();
|
const edges = this.edge.children.slice();
|
||||||
if (edges.length < 4) {
|
if (edges.length < 4) {
|
||||||
const defaultEdge = edges[edges.length - 1] || new Edge({});
|
const defaultEdge = edges.at(-1) || new Edge({});
|
||||||
for (let i = edges.length; i < 4; i++) {
|
for (let i = edges.length; i < 4; i++) {
|
||||||
edges.push(defaultEdge);
|
edges.push(defaultEdge);
|
||||||
}
|
}
|
||||||
@ -950,7 +950,7 @@ class Border extends XFAObject {
|
|||||||
if (this.corner.children.some(node => node.radius !== 0)) {
|
if (this.corner.children.some(node => node.radius !== 0)) {
|
||||||
const cornerStyles = this.corner.children.map(node => node[$toStyle]());
|
const cornerStyles = this.corner.children.map(node => node[$toStyle]());
|
||||||
if (cornerStyles.length === 2 || cornerStyles.length === 3) {
|
if (cornerStyles.length === 2 || cornerStyles.length === 3) {
|
||||||
const last = cornerStyles[cornerStyles.length - 1];
|
const last = cornerStyles.at(-1);
|
||||||
for (let i = cornerStyles.length; i < 4; i++) {
|
for (let i = cornerStyles.length; i < 4; i++) {
|
||||||
cornerStyles.push(last);
|
cornerStyles.push(last);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ class FontSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pushData(xfaFont, margin, lineHeight) {
|
pushData(xfaFont, margin, lineHeight) {
|
||||||
const lastFont = this.stack[this.stack.length - 1];
|
const lastFont = this.stack.at(-1);
|
||||||
for (const name of [
|
for (const name of [
|
||||||
"typeface",
|
"typeface",
|
||||||
"posture",
|
"posture",
|
||||||
@ -139,7 +139,7 @@ class FontSelector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
topFont() {
|
topFont() {
|
||||||
return this.stack[this.stack.length - 1];
|
return this.stack.at(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,7 +500,7 @@ class P extends XhtmlObject {
|
|||||||
|
|
||||||
[$text]() {
|
[$text]() {
|
||||||
const siblings = this[$getParent]()[$getChildren]();
|
const siblings = this[$getParent]()[$getChildren]();
|
||||||
if (siblings[siblings.length - 1] === this) {
|
if (siblings.at(-1) === this) {
|
||||||
return super[$text]();
|
return super[$text]();
|
||||||
}
|
}
|
||||||
return super[$text]() + "\n";
|
return super[$text]() + "\n";
|
||||||
|
@ -284,10 +284,7 @@ function getXfaFontDict(name) {
|
|||||||
dict.set("CIDToGIDMap", Name.get("Identity"));
|
dict.set("CIDToGIDMap", Name.get("Identity"));
|
||||||
dict.set("W", widths);
|
dict.set("W", widths);
|
||||||
dict.set("FirstChar", widths[0]);
|
dict.set("FirstChar", widths[0]);
|
||||||
dict.set(
|
dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
|
||||||
"LastChar",
|
|
||||||
widths[widths.length - 2] + widths[widths.length - 1].length - 1
|
|
||||||
);
|
|
||||||
const descriptor = new Dict(null);
|
const descriptor = new Dict(null);
|
||||||
dict.set("FontDescriptor", descriptor);
|
dict.set("FontDescriptor", descriptor);
|
||||||
const systemInfo = new Dict(null);
|
const systemInfo = new Dict(null);
|
||||||
|
@ -494,7 +494,7 @@ class SimpleXMLParser extends XMLParserBase {
|
|||||||
|
|
||||||
onEndElement(name) {
|
onEndElement(name) {
|
||||||
this._currentFragment = this._stack.pop() || [];
|
this._currentFragment = this._stack.pop() || [];
|
||||||
const lastElement = this._currentFragment[this._currentFragment.length - 1];
|
const lastElement = this._currentFragment.at(-1);
|
||||||
if (!lastElement) {
|
if (!lastElement) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -257,7 +257,7 @@ function generateBezier(points, parameters, leftTangent, rightTangent) {
|
|||||||
ux;
|
ux;
|
||||||
|
|
||||||
const firstPoint = points[0];
|
const firstPoint = points[0];
|
||||||
const lastPoint = points[points.length - 1];
|
const lastPoint = points.at(-1);
|
||||||
|
|
||||||
// Bezier curve ctl pts
|
// Bezier curve ctl pts
|
||||||
const bezCurve = [firstPoint, null, null, lastPoint];
|
const bezCurve = [firstPoint, null, null, lastPoint];
|
||||||
|
@ -389,7 +389,7 @@ if (
|
|||||||
if (opListElement.fn === "save") {
|
if (opListElement.fn === "save") {
|
||||||
opTree.push({ fnId: 92, fn: "group", items: [] });
|
opTree.push({ fnId: 92, fn: "group", items: [] });
|
||||||
tmp.push(opTree);
|
tmp.push(opTree);
|
||||||
opTree = opTree[opTree.length - 1].items;
|
opTree = opTree.at(-1).items;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ function expandBoundsLTR(width, bounds) {
|
|||||||
affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary;
|
affectedBoundary.x2 > boundary.x2 ? affectedBoundary : boundary;
|
||||||
if (lastBoundary === useBoundary) {
|
if (lastBoundary === useBoundary) {
|
||||||
// Merging with previous.
|
// Merging with previous.
|
||||||
changedHorizon[changedHorizon.length - 1].end = horizonPart.end;
|
changedHorizon.at(-1).end = horizonPart.end;
|
||||||
} else {
|
} else {
|
||||||
changedHorizon.push({
|
changedHorizon.push({
|
||||||
start: horizonPart.start,
|
start: horizonPart.start,
|
||||||
@ -507,7 +507,7 @@ function expandBoundsLTR(width, bounds) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (boundary.y2 < horizon[j].end) {
|
if (boundary.y2 < horizon[j].end) {
|
||||||
changedHorizon[changedHorizon.length - 1].end = boundary.y2;
|
changedHorizon.at(-1).end = boundary.y2;
|
||||||
changedHorizon.push({
|
changedHorizon.push({
|
||||||
start: boundary.y2,
|
start: boundary.y2,
|
||||||
end: horizon[j].end,
|
end: horizon[j].end,
|
||||||
|
@ -185,13 +185,13 @@ class XfaLayer {
|
|||||||
const textDivs = [];
|
const textDivs = [];
|
||||||
|
|
||||||
while (stack.length > 0) {
|
while (stack.length > 0) {
|
||||||
const [parent, i, html] = stack[stack.length - 1];
|
const [parent, i, html] = stack.at(-1);
|
||||||
if (i + 1 === parent.children.length) {
|
if (i + 1 === parent.children.length) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const child = parent.children[++stack[stack.length - 1][1]];
|
const child = parent.children[++stack.at(-1)[1]];
|
||||||
if (child === null) {
|
if (child === null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -88,6 +88,14 @@ if (
|
|||||||
require("core-js/es/array/at.js");
|
require("core-js/es/array/at.js");
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
// Support: Firefox<90, Chrome<92, Safari<15.4, Node.js<16.6.0
|
||||||
|
(function checkTypedArrayAt() {
|
||||||
|
if (Uint8Array.prototype.at) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
require("core-js/es/typed-array/at.js");
|
||||||
|
})();
|
||||||
|
|
||||||
// Support: Firefox<94, Chrome<98, Safari<15.4, Node.js<17.0.0
|
// Support: Firefox<94, Chrome<98, Safari<15.4, Node.js<17.0.0
|
||||||
(function checkStructuredClone() {
|
(function checkStructuredClone() {
|
||||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
|
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("IMAGE_DECODERS")) {
|
||||||
|
@ -229,7 +229,7 @@ window.onload = function () {
|
|||||||
/^ {2}IMAGE[^:]*\((\d+\.?\d*)x(\d+\.?\d*)x(\d+\.?\d*)\): (.*)$/
|
/^ {2}IMAGE[^:]*\((\d+\.?\d*)x(\d+\.?\d*)x(\d+\.?\d*)\): (.*)$/
|
||||||
);
|
);
|
||||||
if (match) {
|
if (match) {
|
||||||
const item = gTestItems[gTestItems.length - 1];
|
const item = gTestItems.at(-1);
|
||||||
item.images.push({
|
item.images.push({
|
||||||
width: parseFloat(match[1]),
|
width: parseFloat(match[1]),
|
||||||
height: parseFloat(match[2]),
|
height: parseFloat(match[2]),
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
/* eslint-disable no-var */
|
/* eslint-disable no-var, unicorn/prefer-at */
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ describe("ui_utils", function () {
|
|||||||
ids.add(view.id);
|
ids.add(view.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return { first: views[0], last: views[views.length - 1], views, ids };
|
return { first: views[0], last: views.at(-1), views, ids };
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function takes a fixed layout of pages and compares the system under
|
// This function takes a fixed layout of pages and compares the system under
|
||||||
|
@ -588,7 +588,7 @@ function getVisibleElements({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const first = visible[0],
|
const first = visible[0],
|
||||||
last = visible[visible.length - 1];
|
last = visible.at(-1);
|
||||||
|
|
||||||
if (sortByVisibility) {
|
if (sortByVisibility) {
|
||||||
visible.sort(function (a, b) {
|
visible.sort(function (a, b) {
|
||||||
|
Loading…
Reference in New Issue
Block a user