Skip to content
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

Fix Documentation for async iterators in README #380

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

janpaepke
Copy link
Collaborator

@janpaepke janpaepke commented Sep 26, 2024

This is the current example for async iterators:

// Iterate over all payments.
for await (let payment in mollieClient.payments.iterate()) {
  // (Use break to end the loop prematurely.)
}

This has two issues, one being a mistake and one being a style issue.

  1. Mistake: It should be of rather than in.
  2. Style: The example should recommend using const rather than let.

Usually when iterating over payments we do not expect them to be reassigned within the for block.
If anyone would for some reason, it would be specific to their implementation and they would know to change it to 'let'.
Preferring const here is in line with the prefer-const rule from eslint.

@janpaepke janpaepke force-pushed the fix/readme-iterator branch 2 times, most recently from bb582d4 to 4220ce3 Compare September 26, 2024 15:01
@janpaepke janpaepke requested a review from Pimm September 26, 2024 15:03
@janpaepke janpaepke added the maintenance Dependency issues or package docs. label Sep 26, 2024
@janpaepke janpaepke added this to the 4.1.0 milestone Sep 26, 2024
Copy link
Collaborator

@edorivai edorivai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@janpaepke janpaepke merged commit b381e69 into mollie:master Sep 27, 2024
5 checks passed
@janpaepke janpaepke deleted the fix/readme-iterator branch September 27, 2024 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Dependency issues or package docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants