Matching search params object/map/array #60
                  
                    
                      OliverJAsh
                    
                  
                
                  started this conversation in
                Ideas
              
            Replies: 1 comment
-
| 
         I agree that pattern syntax is not really fit for extracting search params since they can be re-ordered.  My current expectation is that code that wants to get parameter values out would need to use  We could consider adding some kind of map-like matching construct like you suggest in the future.  It would be helpful to see use cases where it provides significant benefit over using just   | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm curious whether we could match the search params using a richer structure than just
stringso that we don't need to worry about matching characters such as&or=. For example:const p = new URLPattern({ protocol: 'https', username: '', password: '', hostname: 'example.com', port: '', pathname: '/foo/:image.jpg', - search: '', + searchParams: [['foo', 'bar'], ['abc', '*']], hash: '*', });For example, this would match a
searchof:foo=bar&abc=123abc=456&foo=barI thought about whether we could re-use
URLSearchParamsbut I'm not sure we can, because we don't want to encode characters for pattern matching. Perhaps we could introduce aURLSearchParamsPattern. This would allow it to be used on its own.Beta Was this translation helpful? Give feedback.
All reactions