-
Notifications
You must be signed in to change notification settings - Fork 10.3k
[api-minor] Replace various getAll
methods with iterators
#19778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7cf1c8a
to
850dcb7
Compare
850dcb7
to
9f40dfd
Compare
These `getAll` methods are not used anywhere within the PDF.js code-base, outside of tests, and were mostly added (speculatively) for third-party users. To still allow access to the same data we instead introduce iterators on these classes, which (slightly) shortens the code and allows us to remove the `objectFromMap` helper function. A summary of the changes in this patch: - Replace the `getAll` methods with iterators in the following classes: `AnnotationStorage`, `Metadata`, and `OptionalContentGroup`. - Change, and also re-name, `AnnotationStorage.prototype.setAll` into a test-only method since it's not used elsewhere. - Remove the `Metadata.prototype.has` method, since it's only used in tests and can be trivially replaced by calling `Metadata.prototype.get` and checking if the returned value is `null`.
9f40dfd
to
2c593b0
Compare
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/e9ae91cbee2b16e/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/ba1cf9c8fc9f781/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/e9ae91cbee2b16e/output.txt Total script time: 29.89 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/ba1cf9c8fc9f781/output.txt Total script time: 62.12 mins
|
Question: how do you define api-minor and api-major? This PR is removing a method that you describe as "mostly used by consumers of the public API", which seems like the exact definition of an API breaking change. |
Well, that's not exactly what the commit message says though: "[...] and were mostly added (speculatively) for third-party users." It's impossible to know if users are actually depending on this, and for e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you.
These
getAll
methods are not used anywhere within the PDF.js code-base, outside of tests, and were mostly added (speculatively) for third-party users.To still allow access to the same data we instead introduce iterators on these classes, which (slightly) shortens the code and allows us to remove the
objectFromMap
helper function.A summary of the changes in this patch:
Replace the
getAll
methods with iterators in the following classes:AnnotationStorage
,Metadata
, andOptionalContentGroup
.Change, and also re-name,
AnnotationStorage.prototype.setAll
into a test-only method since it's not used elsewhere.Remove the
Metadata.prototype.has
method, since it's only used in tests and can be trivially replaced by callingMetadata.prototype.get
and checking if the returned value isnull
.