Skip to content

docs: improve doctests for ndarray instances in ndarray/slice-from - #16236

Open
Thanatos9404 wants to merge 1 commit into
stdlib-js:developfrom
Thanatos9404:docs/ndarray-slice-from-doctests
Open

Thanatos9404 wants to merge 1 commit into
stdlib-js:developfrom
Thanatos9404:docs/ndarray-slice-from-doctests

Conversation

@Thanatos9404

Copy link
Copy Markdown

Progresses #9329.

Description

What is the purpose of this pull request?

This pull request:

  • Updates the README, REPL text, TypeScript declarations, and JSDoc examples in @stdlib/ndarray/slice-from to replace ndarray2array decomposition logic with ndarray instance notation (e.g., // returns <ndarray>[ [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]).
  • Removes the @stdlib/ndarray/to-array import wherever it was only used to show expected values.
  • Leaves examples/index.js unchanged, as that file intentionally prints nested arrays.

Related Issues

Does this pull request have any related issues?

This pull request has the following related issues:

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.

The changes follow the same pattern as the ndarray/slice update in #14771. In the strict: false README example, which returns an empty view, the annotation stays // returns <ndarray> (as in ndarray/slice). The complex number examples in docs/types/index.d.ts only drop the unused import.

Every updated annotation was checked locally with the project's own doctest rules (stdlib/jsdoc-doctest for lib/*.js, stdlib/tsdoc-declarations-doctest for docs/types/index.d.ts, the _tools/repl-txt doctest rule for docs/repl.txt, and stdlib/doctest for the README code blocks). The package unit tests also pass (440/440).

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.".

Drafted with Claude Code, following the pattern from #14771; every annotated return value was checked against stdlib's doctest rules.


@stdlib-js/reviewers

Replace explicit `ndarray2array` conversions, which were only used to
show expected values, with ndarray instance return annotations (e.g.,
`<ndarray>[ [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]`) in the README, REPL text,
TypeScript declarations, and JSDoc examples, and remove the
now-unused `@stdlib/ndarray/to-array` imports.

The `examples/index.js` file is intentionally left unchanged, as it
explicitly prints nested arrays.

Ref: stdlib-js#9329
@Thanatos9404
Thanatos9404 requested a review from a team October 18, 2026 13:40
@stdlib-bot stdlib-bot added First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Needs Review A pull request which needs code review. labels Oct 18, 2026
@stdlib-bot

Copy link
Copy Markdown
Contributor

👋 Hi there! 👋

And thank you for opening your first pull request! We will review it shortly. 🏃 💨

Getting Started

Next Steps

  1. A project maintainer will approve GitHub Actions workflows for your PR.
  2. All CI checks must pass before your submission can be fully reviewed.
  3. You'll need to address any failures in linting or unit tests.

Running Tests Locally

You can use make to run any of the CI commands locally from the root directory of the stdlib repository:

# Run tests for all packages in the math namespace:
make test TESTS_FILTER=".*/@stdlib/math/.*"

# Run benchmarks for a specific package:
make benchmark BENCHMARKS_FILTER=".*/@stdlib/math/base/special/sin/.*"

If you haven't heard back from us within two weeks, please ping us by tagging the "reviewers" team in a comment on this PR.

If you have any further questions while waiting for a response, please join our Zulip community to chat with project maintainers and other community members.

We appreciate your contribution!

Documentation Links

@stdlib-bot stdlib-bot added the Good First PR A pull request resolving a Good First Issue. label Oct 18, 2026

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

First-time Contributor A pull request from a contributor who has never previously committed to the project repository. Good First PR A pull request resolving a Good First Issue. Needs Review A pull request which needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants