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

Ability to convert tokens to regex. #52

Closed
rill-js opened this issue May 11, 2015 · 3 comments · Fixed by #53
Closed

Ability to convert tokens to regex. #52

rill-js opened this issue May 11, 2015 · 3 comments · Fixed by #53

Comments

@rill-js
Copy link

rill-js commented May 11, 2015

The #parse method returns an array of tokens, it would be cool if we could pass in those tokens to get a regex again.

It would be useful to merge multiple parsed paths.

I could do a PR if anyone else things this is a good idea.

@blakeembrey
Copy link
Member

@rill-js Great thought and easy enough to expose since that's what is already happening. Just curious, any thoughts on what you'd use it for?

Edit: I got the gist, was curious if you had a practical example/use on hand.

@rill-js
Copy link
Author

rill-js commented May 11, 2015

Currently i'm creating a nested router, and the paths need to be merged to their parents as they are created. It would be a bit easier this way since I could just merge arbitrary tokens rather than worrying about repeating segments and "/".

More of a convenience really but it would be more efficient than rebuilding and re-parsing each regex every time. Also pretty easy to implement.

@blakeembrey
Copy link
Member

@rill-js Could you review #53 and let me know if that's simple enough for you to use?

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 a pull request may close this issue.

1 participant