Skip to content

docs: fix incorrect token type in custom path example#429

Merged
blakeembrey merged 1 commit into
pillarjs:masterfrom
mahmoodhamdi:docs/fix-custom-path-example
Mar 30, 2026
Merged

docs: fix incorrect token type in custom path example#429
blakeembrey merged 1 commit into
pillarjs:masterfrom
mahmoodhamdi:docs/fix-custom-path-example

Conversation

@mahmoodhamdi

Copy link
Copy Markdown
Contributor

What

Fixed two issues in the custom path example in the README:

  1. Token type "parameter""param"
  2. Removed non-existent index: 0 from the expected match output

Why

The current example throws Unknown token type: parameter when copy-pasted and run, because the actual token type value is "param", not "parameter". The token types listed in the Tokens section also referenced parameter instead of param.

The expected output also included index: 0 which is not part of the MatchResult interface — it only contains path and params.

// Before (broken)
{ type: "parameter", name: "foo" }
fn("/test"); //=> { path: '/test', index: 0, params: { foo: 'test' } }

// After (works)
{ type: "param", name: "foo" }
fn("/test"); //=> { path: '/test', params: { foo: 'test' } }

The custom path example in the README used `type: "parameter"` but the
actual token type is `"param"`, which caused the example to throw an
"Unknown token type" error when copy-pasted. Also removed the `index`
property from the expected output, which is not part of the match result.
@codecov

codecov Bot commented Mar 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.75%. Comparing base (34cb451) to head (f51664b).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #429   +/-   ##
=======================================
  Coverage   99.75%   99.75%           
=======================================
  Files           1        1           
  Lines         415      415           
  Branches      156      156           
=======================================
  Hits          414      414           
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 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 1e796b5 into pillarjs:master Mar 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