Skip to content

docs: add missing returns annotations in iter/*-each examples and fix thisArg description in iter/unique-by* - #16549

Draft
Planeshifter wants to merge 6 commits into
developfrom
claude/cool-johnson-h4w98g
Draft

Planeshifter wants to merge 6 commits into
developfrom
claude/cool-johnson-h4w98g

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • normalizes JSDoc and README example annotations and thisArg descriptions in six iter packages to the conventions used by the rest of the namespace.

Namespace summary. iter has 65 members, none autogenerated. Analyzed features: file tree, package.json key sets, README section set/order, test/benchmark/example filenames, public signature, return kind, validation prologue, error construction, JSDoc shape, dependencies, example annotation form, and thisArg description. File trees, package.json keys, and test/benchmark/example layout are 100% uniform. Excluded for lack of a 75% majority: iterator validation message wording (26 of 38 use "iterator protocol-compliant object", 68%) and return kind (47 of 65 return iterators, 72%).

iter/do-until-each, iter/until-each, iter/while-each

Replaces the bare // undefined example annotation with // returns undefined in README.md, lib/index.js, and lib/main.js. 398 of 405 JSDoc example annotations in iter use the // returns form (98%). The third it.next().value call in each example evaluates to undefined.

iter/do-while-each

Same fix, in lib/main.js only. The package's README and lib/index.js already use // returns undefined.

iter/unique-by, iter/unique-by-hash

Changes the thisArg JSDoc description in lib/main.js from "evaluation context" to "execution context". This matches each package's own README and repl.txt, and 21 of the 27 iter packages that accept thisArg (78%).

Related Issues

Does this pull request have any related issues?

None.

Reference Packages

Did the content of this pull request follow one or more existing packages? Answering is optional.

This pull request followed these packages:

  • iter/do-while-each (README and lib/index.js)

What carried over from the reference(s)?

  • The // returns undefined annotation form.

What differed, or what did you have to work out yourself?

  • None.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

How this was checked. Structural features were extracted from every package, semantic features came from a per-package source read, and three independent reviews (semantic, cross-reference, structural) validated the result. With // returns undefined, the stdlib/jsdoc-doctest lint rule now checks these annotations, and the value matches. Each example was also run with Node.

Deliberately excluded:

  • The same bare // undefined remains in docs/types/index.d.ts of until-each, while-each, and do-while-each, and in the namespace-level iter/docs/types/index.d.ts. TypeScript declarations were out of scope for this pass.
  • Variant thisArg wordings such as "callback execution context" in pop, shift, replicate-by, and strided-by were left alone. These wordings are common across stdlib and consistent within each package.
  • Empty ## See Also sections (tooling-populated) and empty ## Notes sections in last, length, and nth were left alone, because filling them needs package-specific prose.
  • Plain-string Error messages without format were left alone. They conform to stdlib/no-unnecessary-format.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Disclosure

If you answered "yes" to using AI assistance, please provide a short disclosure indicating how you used AI assistance. This helps reviewers determine how much scrutiny to apply when reviewing your contribution. Example disclosures: "This PR was written primarily by Claude Code." or "I consulted ChatGPT to understand the codebase, but the proposed changes were fully authored manually by myself.".

This PR was written primarily by Claude Code as part of an automated cross-package API drift analysis.



Generated by Claude Code

Changed bare `// undefined` example annotations to `// returns undefined` in README.md, lib/index.js, and lib/main.js (`// returns` form used by 398 of 405 JSDoc example annotations across `iter`, 98%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wWD7AKe9sM3ib4tmcCTST
Changed bare `// undefined` example annotations to `// returns undefined` in README.md, lib/index.js, and lib/main.js (`// returns` form used by 398 of 405 JSDoc example annotations across `iter`, 98%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wWD7AKe9sM3ib4tmcCTST
Changed bare `// undefined` example annotations to `// returns undefined` in README.md, lib/index.js, and lib/main.js (`// returns` form used by 398 of 405 JSDoc example annotations across `iter`, 98%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wWD7AKe9sM3ib4tmcCTST
Changed bare `// undefined` example annotations to `// returns undefined` in lib/main.js (`// returns` form used by 398 of 405 JSDoc example annotations across `iter`, 98%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wWD7AKe9sM3ib4tmcCTST
Changed the `thisArg` JSDoc description in lib/main.js from "evaluation context" to "execution context", matching the package's README and repl.txt and 21 of 27 `iter` packages that accept `thisArg` (78%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wWD7AKe9sM3ib4tmcCTST
Changed the `thisArg` JSDoc description in lib/main.js from "evaluation context" to "execution context", matching the package's README and repl.txt and 21 of 27 `iter` packages that accept `thisArg` (78%).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017wWD7AKe9sM3ib4tmcCTST
@stdlib-bot

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
iter/do-until-each $\\color{red}224/227$
$\\color{green}+98.68\\%$
$\\color{red}22/23$
$\\color{green}+95.65\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{red}224/227$
$\\color{green}+98.68\\%$
iter/do-while-each $\\color{red}225/228$
$\\color{green}+98.68\\%$
$\\color{red}21/22$
$\\color{green}+95.45\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{red}225/228$
$\\color{green}+98.68\\%$
iter/unique-by $\\color{green}244/244$
$\\color{green}+100.00\\%$
$\\color{green}25/25$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}244/244$
$\\color{green}+100.00\\%$
iter/unique-by-hash $\\color{green}239/239$
$\\color{green}+100.00\\%$
$\\color{green}25/25$
$\\color{green}+100.00\\%$
$\\color{green}5/5$
$\\color{green}+100.00\\%$
$\\color{green}239/239$
$\\color{green}+100.00\\%$
iter/until-each $\\color{red}224/227$
$\\color{green}+98.68\\%$
$\\color{red}22/23$
$\\color{green}+95.65\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{red}224/227$
$\\color{green}+98.68\\%$
iter/while-each $\\color{red}224/227$
$\\color{green}+98.68\\%$
$\\color{red}21/22$
$\\color{green}+95.45\\%$
$\\color{green}4/4$
$\\color{green}+100.00\\%$
$\\color{red}224/227$
$\\color{green}+98.68\\%$

The above coverage report was generated for the changes in this PR.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants