mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 09:45:42 +02:00
Let Annotation._collectActions
return null
when no actions are present
Rather than returning an *empty* Object[1] we should be returning `null` instead, since that's consistent with existing API-functionality. To avoid having to *manually* track if the Object is empty, this patch also introduces a small helper function to check its size.
This commit is contained in:
parent
8540b4cc76
commit
a1e5581a0b
2 changed files with 18 additions and 10 deletions
|
@ -585,6 +585,10 @@ function string32(value) {
|
|||
);
|
||||
}
|
||||
|
||||
function objectSize(obj) {
|
||||
return Object.keys(obj).length;
|
||||
}
|
||||
|
||||
// Ensures that the returned Object has a `null` prototype.
|
||||
function objectFromEntries(iterable) {
|
||||
return Object.assign(Object.create(null), Object.fromEntries(iterable));
|
||||
|
@ -1040,6 +1044,7 @@ export {
|
|||
isString,
|
||||
isSameOrigin,
|
||||
createValidAbsoluteUrl,
|
||||
objectSize,
|
||||
objectFromEntries,
|
||||
IsLittleEndianCached,
|
||||
IsEvalSupportedCached,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue