mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-07-25 16:37:22 +02:00
Use Map.prototype.getOrInsertComputed() in the ensureDebugMetadata helper
Also, shorten the function by using optional chaining.
This commit is contained in:
parent
f548a159d6
commit
c7bdf5b508
@ -50,17 +50,11 @@ class BBoxReader {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const ensureDebugMetadata = (map, key) => {
|
const ensureDebugMetadata = (map, key) =>
|
||||||
if (!map) {
|
map?.getOrInsertComputed(key, () => ({
|
||||||
return undefined;
|
dependencies: new Set(),
|
||||||
}
|
isRenderingOperation: false,
|
||||||
let value = map.get(key);
|
}));
|
||||||
if (!value) {
|
|
||||||
value = { dependencies: new Set(), isRenderingOperation: false };
|
|
||||||
map.set(key, value);
|
|
||||||
}
|
|
||||||
return value;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {"lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" |
|
* @typedef {"lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" |
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user