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

Fix getCurrentURLPath error and provide ability for named regex group replacement in generate method #333

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

MatthewJohn
Copy link

@MatthewJohn MatthewJohn commented Aug 4, 2023

Reverted 0aed88e as this was causing errors, both in tests and in real usage:

Uncaught ReferenceError: getCurrentURLPath is not defined

Added ability to replace regex groups (that are using named regex groups) in path, e.g:

    router.on({
        '/example/(?<name>.*)': {
            as: "TestRoute",
            uses: function ({ data }) { }
        }
    });

    router.generate('TestRoute', {name: 'myname'}, {replaceRegexGroups: true})
    > '/example/myname'

Disclaimer: I'm not too used to npm/yarn and how builds are generally performed for this type of project - I had to do some mangling to be able to build (during which some packages got updated), so I didn't include in this PR, but have committed them to https://github.com/MatthewJohn/navigo/tree/fix-build - apologies in advance!

@MatthewJohn MatthewJohn changed the title Fix error and provide ability for named regex group replacement in generate method Fix getCurrentURLPath error and provide ability for named regex group replacement in generate method Aug 4, 2023
rfranr added a commit to rfranr/navigo that referenced this pull request Nov 7, 2023
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.

1 participant