Skip to content

Commit

Permalink
Use const keys in pathToRegexp example
Browse files Browse the repository at this point in the history
`pathToRegexp` does not create a new array and it couldn't even work if it did because the variable binding would be lost. So this can be `const` and it does also match the module's docs:

https://github.com/pillarjs/path-to-regexp#path-to-regexp-1
  • Loading branch information
silverwind authored and molefrog committed Feb 20, 2024
1 parent 1f6964f commit 1fe98bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ import { pathToRegexp } from "path-to-regexp";
* Custom parser based on `pathToRegexp` with strict route option
*/
const strictParser = (path, loose) => {
let keys = [];
const keys = [];
const pattern = pathToRegexp(path, keys, { strict: true, end: !loose });

return {
Expand Down

0 comments on commit 1fe98bb

Please sign in to comment.