mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 23:04:02 +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) => {
|
||||
if (!map) {
|
||||
return undefined;
|
||||
}
|
||||
let value = map.get(key);
|
||||
if (!value) {
|
||||
value = { dependencies: new Set(), isRenderingOperation: false };
|
||||
map.set(key, value);
|
||||
}
|
||||
return value;
|
||||
};
|
||||
const ensureDebugMetadata = (map, key) =>
|
||||
map?.getOrInsertComputed(key, () => ({
|
||||
dependencies: new Set(),
|
||||
isRenderingOperation: false,
|
||||
}));
|
||||
|
||||
/**
|
||||
* @typedef {"lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" |
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user