Add iteration support in the PDFObjects class

This (obviously) only includes "resolved" data, and will be used in an upcoming patch.
This commit is contained in:
Jonas Jenwald 2023-12-14 20:09:47 +01:00
parent 7ea0e40e58
commit b09f238436

View File

@ -3125,7 +3125,7 @@ class PDFObjects {
*/
has(objId) {
const obj = this.#objs[objId];
return obj?.capability.settled || false;
return obj?.capability.settled ?? false;
}
/**
@ -3147,6 +3147,17 @@ class PDFObjects {
}
this.#objs = Object.create(null);
}
*[Symbol.iterator]() {
for (const objId in this.#objs) {
const { capability, data } = this.#objs[objId];
if (!capability.settled) {
continue;
}
yield [objId, data];
}
}
}
/**