Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How about match an empty array? #291

Open
circlesharp opened this issue Feb 21, 2023 · 1 comment
Open

How about match an empty array? #291

circlesharp opened this issue Feb 21, 2023 · 1 comment
Labels

Comments

@circlesharp
Copy link

I pass an empty array in match function, then I get trouble:

const { match } = require('path-to-regexp')
urlMatchFn = match([])

console.log(urlMatchFn('/foo')) // { path: '', index: 0, params: [Object: null prototype] {} }

Shoule the result be false? Thanks.

@blakeembrey
Copy link
Member

This is an interesting bug, I think it should probably be throwing an error instead.

The issue today is the output regex would be (?:) which would match everything.

@blakeembrey blakeembrey added the bug label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants