Skip to content

chore: add isProbabilityArray (issue #6976) #6981

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

Closed
wants to merge 1 commit into from

Conversation

Sakh1l
Copy link

@Sakh1l Sakh1l commented May 11, 2025

Resolves #6976.

Description

What is the purpose of this pull request?

This pull request:

  • Adds a new isProbabilityArray function under @stdlib/assert that returns true if and only if the input is an array of numbers between 0 and 1 (inclusive).
  • Includes unit tests covering valid probability arrays, out-of-range values, and non-array inputs.
  • Follows the existing code style and project conventions for “is-XXXArray” utilities.

Related Issues

Does this pull request have any related issues?

This pull request:

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.

No.

Checklist

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


@stdlib-js/reviewers

@stdlib-bot
Copy link
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 Gitter channel to chat with project maintainers and other community members.

We appreciate your contribution!

Documentation Links

@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. Good First PR A pull request resolving a Good First Issue. labels May 11, 2025
@stdlib-bot
Copy link
Contributor

stdlib-bot commented May 11, 2025

Coverage Report

Package Statements Branches Functions Lines
assert/is-probability-array $\color{green}27/27$
$\color{green}+100.00\%$
$\color{green}9/9$
$\color{green}+100.00\%$
$\color{green}2/2$
$\color{green}+100.00\%$
$\color{green}27/27$
$\color{green}+100.00\%$

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

@Sakh1l Sakh1l force-pushed the add-is-probability-array branch from 419c260 to 8083faa Compare May 11, 2025 07:31
@Sakh1l
Copy link
Author

Sakh1l commented May 11, 2025

@stdlib-js/reviewers please assign this to me.

@kgryte
Copy link
Member

kgryte commented May 13, 2025

@Sakh1l Thank you for your interest in stdlib. However, 1) your proposed changes do not actually address #6976 and 2) we already have an implementation for @stdlib/assert/is-probability-array, so I am not sure what your goal is. Lastly, none of your proposed changes follow project conventions. As such, I am closing this PR.

If you are interested in contributing, I suggest finding a different issue and actually making the desired changes. Cheers.

@kgryte kgryte closed this May 13, 2025
@kgryte kgryte added Invalid Invalid question, issue, or pull request. and removed Needs Review A pull request which needs code review. labels May 13, 2025
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. Invalid Invalid question, issue, or pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix JavaScript lint errors
3 participants