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

Support ".compile" #68

Closed
kettanaito opened this issue Mar 28, 2022 · 4 comments
Closed

Support ".compile" #68

kettanaito opened this issue Mar 28, 2022 · 4 comments

Comments

@kettanaito
Copy link

Thank you for moving so fast with the URLPattern!

I'd like to know if you're planning on supporting a .compile method (referring to the .compile() from path-to-regexp). It'd be great to populate a URL pattern with values:

const pattern = new URLPattern('https://:environment.service.com/:service/:resource')

const url = pattern.compile({
  environment: 'staging',
  service: 'v2',
  resource: '/user'
})

url.toString() // "https://staging.service.com/v2/user"
@kettanaito
Copy link
Author

I recall there's been a discussion around this in the design document repo. Please feel free to link to it.

@kenchris
Copy link
Owner

Feature requests should be filed for the spec repo https://github.com/WICG/urlpattern

@wanderview
Copy link
Contributor

This is already on file at: whatwg/urlpattern#73

@kettanaito
Copy link
Author

Perfect! Thank you, @kenchris @wanderview!

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

No branches or pull requests

3 participants