path-to-regexp
path-to-regexp copied to clipboard
How about match an empty array?
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.
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.
This has been removed from the API in v7, closing as it no longer needs to be fixed.