fix: correct argument validation error messages in random/iter/frechet and random/iter/negative-binomial - #15894
Draft
Planeshifter wants to merge 2 commits into
Draft
Planeshifter wants to merge 2 commits into
Planeshifter wants to merge 2 commits into
Conversation
Updated the third-argument `TypeError` message to "must be a number and not NaN" to match the `!isNumber( m ) || isnan( m )` predicate. This is the message used for the same predicate in 15 of 16 such checks across `random/iter` siblings (94%) and in `random/base/frechet`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VEFEdGXxS5GMXpwxwp2YiX
Updated the first-argument `TypeError` message from "positive integer" to "positive number" to match the `isPositiveNumber` predicate, the package's own JSDoc (`@param {PositiveNumber} r`, `@throws`), and `random/base/negative-binomial`. `isPositiveNumber` checks use "positive number" in 33 of 34 cases across `random/iter` (97%).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VEFEdGXxS5GMXpwxwp2YiX
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request:
random/iterso that they describe what the validation predicate actually checks, matching the wording used by sibling packages and by the correspondingrandom/basepackages.@stdlib/random/iter/frechetThe third-argument check is
!isNumber( m ) || isnan( m ), but the message said only "must be a number". It now says "must be a number and not NaN". This is the wording used for the same predicate in 15 of 16 checks acrossrandom/iter(94%) and inrandom/base/frechet/lib/validate.js.@stdlib/random/iter/negative-binomialThe first-argument check is
isPositiveNumber( r ), but the message said "must be a positive integer".ris real-valued. The message now says "must be a positive number", which matches the package's own@param {PositiveNumber} r, its@throwstag, its TypeScript declaration, andrandom/base/negative-binomial. Acrossrandom/iter, 33 of 34isPositiveNumberchecks (97%) already use this wording.Related Issues
No.
Questions
No.
Other
How the namespace was checked. All 41 packages in
random/iterwere compared feature by feature, and a package was flagged when it disagreed with a pattern shared by at least 75% of its siblings.package.jsonkey sets, and README section lists. All 41 packages conform.formatfor errors, JSDoc shape, dependency set, and validation prologue. Every feature has a clear majority.Validation. Each candidate was reviewed for:
The tests assert only
TypeError, not the message text, so no test changes are needed. Both new strings already exist in the error database (codes7Cand71).Deliberately excluded.
minstd,minstd-shuffle,mt19937,randi, andrandudo not depend on@stdlib/utils/constant-functionor@stdlib/utils/noop, unlike 88% of their siblings. This is intentional: these are the base PRNG iterators and have nooptions.prngbranch that would use them.Out of scope.
random/streams/frechet/lib/main.jshas the same "must be a number." text. It is a different namespace and is left for a follow-up.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code, as part of an automated cross-package drift-detection run that compares each package against the majority pattern of its namespace.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01VEFEdGXxS5GMXpwxwp2YiX
Generated by Claude Code