docs: correct @throws description for pulse duration#12515
Merged
Conversation
…t-hann-pulse`
The runtime guard at `lib/main.js:114` is `if ( opts.duration > opts.period )`,
allowing `duration === period` (which the `-1` sentinel default explicitly
assigns), and the thrown `RangeError` message says "must be less than or
equal to the period". The `@throws` tag was stale, claiming the strict
"less than" contract used by the sibling `simulate/iter/pulse` package.
The test description ("greater than the pulse period") already matches
the inclusive runtime behavior.
…t-pulse`
The runtime guard at `lib/main.js:90` is `if ( opts.duration > opts.period )`,
allowing `duration === period` (which the `-1` sentinel default explicitly
assigns), and the thrown `RangeError` message says "must be less than or
equal to the period". The `@throws` tag was stale, claiming the strict
"less than" contract used by the sibling `simulate/iter/pulse` package.
The test description ("greater than the pulse period") already matches
the inclusive runtime behavior.
…p-pulse`
The runtime guard at `lib/main.js:115` is `if ( opts.duration > opts.period )`,
allowing `duration === period` (which the `-1` sentinel default explicitly
assigns), and the thrown `RangeError` message says "must be less than or
equal to the period". The `@throws` tag was stale, claiming the strict
"less than" contract used by the sibling `simulate/iter/pulse` package.
The test description ("greater than the pulse period") already matches
the inclusive runtime behavior.
…lse`
The runtime guard at `lib/main.js:91` is `if ( opts.duration > opts.period )`,
allowing `duration === period` (which the `-1` sentinel default explicitly
assigns), and the thrown `RangeError` message says "must be less than or
equal to the period". The `@throws` tag was stale, claiming the strict
"less than" contract used by the sibling `simulate/iter/pulse` package.
The test description ("greater than the pulse period") already matches
the inclusive runtime behavior.
…-pulse`
The runtime guard at `lib/main.js:90` is `if ( opts.duration > opts.period )`,
allowing `duration === period` (which the `-1` sentinel default explicitly
assigns), and the thrown `RangeError` message says "must be less than or
equal to the period". The `@throws` tag was stale, claiming the strict
"less than" contract used by the sibling `simulate/iter/pulse` package.
The test description ("greater than the pulse period") already matches
the inclusive runtime behavior.
Contributor
Coverage Report
The above coverage report was generated for the changes in this PR. |
kgryte
approved these changes
Jun 4, 2026
@throws text for duration in 5 simulate/iter window-pulse packages@throws description for pulse duration
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
Five window-pulse packages under
@stdlib/simulate/itercarry a stale@throwsJSDoc tag whose text contradicts the runtime guard, the thrown error message, and the corresponding test description. This pull request updates the tag in each package to match the actual implemented behavior. No runtime, type, test, or example changes.Namespace summary
@stdlib/simulate/iterpackage.jsonshape,manifest.jsonshape, README section sequences, test/benchmark/examples filenames, public signatures, return kind, validation prologue, error construction, JSDoc shape, dependency sets, TypeScript declarations.package.jsontop-level keys (16/16); README L2 sequence(Usage, Notes, Examples, See Also)(16/16); README HTML<section>divs(intro, usage, notes, examples, references, related, links)(16/16);test/test.js,benchmark/benchmark.js,examples/index.js,docs/types/index.d.ts,docs/types/test.ts(16/16 each);errorConstruction: format(16/16);returnKind: iterator(16/16);lib/validate.js(13/16, present in all packages whose validation is purely options-shaped).publicSignature(varies by package semantic surface — pure-options vs noise-iterator-positional vsperiodic-sinc/n); JSDoc@throwsset (varies); trailing README reference-link counts (manually curated).Iterator, 3/16ExtendedIterator) —ExtendedIteratorreflects the runtime PRNG-state surface on the 3 noise iterators and is intentional;lib/validate.jsabsence inawgn/awln/awun— intentional, those packages interleave positional and options validation in a fixed order that defines the public-error contract.simulate/iter/bartlett-hann-pulseThe
@throwstag atlib/main.js:68documentedpulse duration must be less than the period, but the runtime guard atlib/main.js:114isif ( opts.duration > opts.period ), the thrownRangeErrorsays "less than or equal to the period", and the test title says "greater than the pulse period". The-1sentinel default at:113assignsopts.duration = opts.period, which would immediately throw under a strict-<guard — proof that the inclusive guard is intentional. JSDoc updated to match.simulate/iter/bartlett-pulseThe
@throwstag atlib/main.js:43documentedpulse duration must be less than the period, but the runtime guard atlib/main.js:90is>and the thrownRangeErrorsays "less than or equal to the period". The-1sentinel default at:88assignsopts.duration = opts.period, which would immediately throw under a strict-<guard. JSDoc updated to match.simulate/iter/flat-top-pulseThe
@throwstag atlib/main.js:69documentedpulse duration must be less than the period, but the runtime guard atlib/main.js:115is>and the thrownRangeErrorsays "less than or equal to the period". The-1sentinel default at:114assignsopts.duration = opts.period, which would immediately throw under a strict-<guard. JSDoc updated to match.simulate/iter/hann-pulseThe
@throwstag atlib/main.js:43documentedpulse duration must be less than the period, but the runtime guard atlib/main.js:91is>and the thrownRangeErrorsays "less than or equal to the period". The-1sentinel default at:89assignsopts.duration = opts.period, which would immediately throw under a strict-<guard. JSDoc updated to match.simulate/iter/lanczos-pulseThe
@throwstag atlib/main.js:43documentedpulse duration must be less than the period, but the runtime guard atlib/main.js:90is>and the thrownRangeErrorsays "less than or equal to the period". The-1sentinel default at:88assignsopts.duration = opts.period, which would immediately throw under a strict-<guard. JSDoc updated to match.Note on the sibling
simulate/iter/pulsepackagepulseis a square pulse whose formula returnsmaxwhent < durationandminotherwise. A square pulse withduration == periodis degenerate (constantmax, no return tomin), so its strict-<guard atlib/main.js:90and its@throwstext are internally consistent and correct. It is deliberately not modified.Related Issues
This pull request does not have any related issues.
Questions
No.
Other
Validation
What was checked:
package.json/manifest.jsonshape, README section sequences, test/benchmark/examples filenames, TypeScript declaration shape).lib/main.jsfiles (public signature, return kind, validation prologue, error construction, JSDoc shape, dependencies).-1sentinel default would throw under a>=guard, and that all five window functions are mathematically well-defined atduration == period. The inclusive guard is intentional; the JSDoc text is stale.<interpretation, and no sibling or namespace-level doc reproduces the@throwstext. The siblingpulsepackage is internally consistent at strict-<and is correctly excluded from the fix.RangeErrormessage exactly, and that no other@throwstag in the same JSDoc block needs adjustment.What was deliberately excluded:
lib/validate.jsabsence inawgn/awln/awun(13/16 majority): intentional. Noise iterators interleave positional (iterator,sigma) and options validation in a fixed error-firing order; factoring this into a helper would change the contract.ExtendedIteratorvsIterator(13/16 majority): intentional. The 3 noise iterators expose runtime PRNG-state properties (PRNG,seed,state,seedLength,stateLength,byteLength) that the wave iterators don't have.[options.period]JSDoc text drift insine-wave/cosine-wave(10/13 say "a waveform repeats"; sine/cosine say "a sine/cosine wave repeats"): the deviation appears identically inlib/main.js,lib/validate.js,docs/types/index.d.ts,docs/repl.txt, andREADME.md; the.d.tsandrepl.txtfiles are protected from automated edits, so the fix cannot be made internally consistent within a single package and was dropped. Also overlaps withcosine-wave/README.mdwork in docs: add cosine wave visualization tosimulate/iter/cosine-wave#9599.dirac-comb/lib/main.js:81inline normalize comment uses[0,T]instead of[0,τ](5/6 useτ):Tis the canonical period symbol in Dirac-comb literature; treated as intentional notation.awgnsetsPRNG: nullwhen an external PRNG is provided;awln/awunsetPRNG: options.prng. Real inconsistency, but invisible to the 16-member majority vote (2/3 within the 3-noise sub-cluster, sub-75% across the namespace). Belongs to a future cluster-internal drift pass.awgn/awln/awunREADMEs lack `mathblocks (13/16 have them): the noise iterators have no closed-form waveform worth typesetting.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was authored by Claude Code as part of an automated cross-package API drift-detection routine on a randomly picked stdlib namespace. Structural and semantic features were extracted across all 16 non-autogenerated members of
@stdlib/simulate/iter; the single high-signal finding (stale@throwstext contradicting the actual runtime behavior in 5 window-pulse packages) was validated by three parallel review agents (opus semantic-review, opus cross-reference, sonnet structural-review), all returningconfirmed-driftfor all five outliers. The applied fix is a one-line JSDoc text update per package with no runtime, type, test, or example changes.@stdlib-js/reviewers
Generated by Claude Code