lukeed / lukeed/matchit

Wildcard to return an array of left over segments

Open
#13 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
323
Forks
13
PR merge metrics
No merged PRs in 30d

Description

## Actual

```js
const route = matchit.parse('/foo/*');
matchit.exec('foo/bar/baz', route)

// returns
{
'*': 'bar'
}
```

## Expected

```js
const route = matchit.parse('/foo/*');
matchit.exec('foo/bar/baz', route)

// returns
{
'*': ['bar', 'baz']
}
```

Not sure, if their is any specific reason that it returns a string with first segment and not all the segments as an array

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the matchit.parse and matchit.exec entry points used in the example to understand how wildcard segments are captured. Done means matching /foo/bar/baz against /foo/* returns {'*': ['bar', 'baz']} rather than only the first segment; check the project's existing behavior around wildcard matches before changing it.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
web-dev
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.