Skip to content

docs: add missing JSDoc examples in utils/type-of - #16295

Draft
Planeshifter wants to merge 2 commits into
developfrom
claude/cool-johnson-ekfwl6
Draft

Planeshifter wants to merge 2 commits into
developfrom
claude/cool-johnson-ekfwl6

Conversation

@Planeshifter

@Planeshifter Planeshifter commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Description

What is the purpose of this pull request?

This pull request:

  • adds missing @example blocks to the typeOf JSDoc in @stdlib/utils/type-of, bringing the package in line with the rest of the utils namespace.
  • replaces String.prototype.toLowerCase with @stdlib/string/base/lowercase in the same two files, as required by the no-restricted-syntax lint rule now that the files are touched. The two are behaviorally equivalent.

@stdlib/utils/type-of

lib/main.js and lib/polyfill.js document typeOf without an @example, whereas 97% of utils packages (192/198) include one in the main function JSDoc and 89% of sibling builtin/polyfill implementation files (16/18) do likewise. This PR adds the 'a' => 'string' and 5 => 'number' examples already present in lib/index.js and the README. No change in behavior.

Related Issues

Does this pull request have any related issues?

No.

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.

Namespace summary. utils has 198 direct member packages (none autogenerated). Analyzed features: file tree, package.json key sets, README section sets and order, test/benchmark/example file naming, public signature, return kind, validation prologue, error construction, JSDoc shape, and require() dependencies. Features with a clear majority (≥75%): file tree, package.json keys, README sections and order, error construction (format for interpolated messages), JSDoc @example/@param/@returns/@throws shape. Features without a clear majority (excluded): public signature, validation prologue sequence, and dependency sets (@stdlib/string/format reaches 71%).

Validation. Structural features were extracted from the filesystem, semantic features were extracted by per-package agents, and each candidate went through three independent reviews (semantic intent, cross-referencing of tests and examples, and structural applicability). Deliberately excluded:

  • library-manifest concatenated error messages: the package avoids stdlib dependencies by design (documented in source NOTEs).
  • Missing benchmark/benchmark.js in eval, open-url, parallel, library-manifest, timeit, and the namespace packages: side-effecting or environment-bound code, or variant benchmark files. inherit is already covered by bench: add benchmark to utils/inherit #15245.
  • Missing README ## Notes sections, plus ## See Also, repl.txt and .d.ts files: these need authored content or are generator-owned.
  • Plain-string (non-format) error messages without interpolation: these are correct per stdlib/no-unnecessary-format.

The added example values were verified against both implementations (main.js and polyfill.js).

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 scan of the utils namespace.


🤖 Generated with Claude Code

https://claude.ai/code/session_01E6UUPEB3GQKNEpi1ddopv1

Added missing `@example` blocks to the `typeOf` JSDoc in `lib/main.js` and
`lib/polyfill.js` (main function JSDoc carries `@example` in 97% of
`utils` packages; 89% of sibling builtin/polyfill implementation files).

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

stdlib-bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Coverage Report

Package Statements Branches Functions Lines
utils/type-of $\\color{green}326/326$
$\\color{green}+100.00\\%$
$\\color{red}20/21$
$\\color{green}+95.24\\%$
$\\color{green}3/3$
$\\color{green}+100.00\\%$
$\\color{green}326/326$
$\\color{green}+100.00\\%$

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

Replaces `String.prototype.toLowerCase` with `@stdlib/string/base/lowercase`
to satisfy the `no-restricted-syntax` lint rule, which is enforced on the
files modified in the preceding commit.

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

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