Skip to content

docs: correct parser parameter default and example index - #82

Merged
blakeembrey merged 1 commit into
jshttp:masterfrom
kilisamemarisaaa:codex/correct-parser-option-docs
Oct 30, 2026
Merged

blakeembrey merged 1 commit into
jshttp:masterfrom
kilisamemarisaaa:codex/correct-parser-option-docs

Conversation

@kilisamemarisaaa

Copy link
Copy Markdown
Contributor

ParseOptions.parameters currently says @default false in its TypeScript documentation, even though omitting the option parses parameters. The README also gives 33 as the returned index for image/svg+xml; charset=utf-8, whose actual length and returned index are 28.

This corrects the option description/default and the example index, and explains that index points at the stopping delimiter or the end of the input. Runtime behavior and public types are unchanged.

Verified on upstream d005d8bfd9846bb9eb73a9aad0944536e1a5cf39 using Node.js 24.12.0 on Windows:

const header = "image/svg+xml; charset=utf-8";
parse(header);
// { type: "image/svg+xml", index: 28, parameters: { charset: "utf-8" } }
parse(header, { parameters: false });
// { type: "image/svg+xml", index: 13, parameters: {} }
parse("text/html, application/json", { comma: true }).index;
// 9 (the comma's index)

Validation: npm test passes (build, Prettier, typecheck, 127 tests, and size limit: 1.09 kB / 1.15 kB). Also executed a separate six-check documentation/API probe: both documentation mismatches fail before the change and all six checks pass after it. No permanent test was added for this documentation-only correction.

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d005d8b) to head (4bfb9c8).

Additional details and impacted files
@@            Coverage Diff            @@
##            master       #82   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          192       192           
  Branches        52        52           
=========================================
  Hits           192       192           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blakeembrey
blakeembrey merged commit 6c517f4 into jshttp:master Oct 30, 2026
6 checks passed
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.

2 participants