You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently each component in a URLPattern produces a separate groups map. They are accessed like result.pathname.groups, result.hostname.groups, etc. This is a bit verbose and also requires the person accessing the groups to understand which named group the component is in.
We could instead try to expose a result.groups that combines all the matched values from all the components into one map.
The main issue is what to do for conflicting group names. For example, if both the hostname and pathname have :id groups. Or worse, what if both hostname and pathname have anonymous groups that get the 0 index name.
Maybe we could offer a convenience like result.uniqueGroups that contains any matched groups with a unique name. If you need a value that does not have a unique name then you have to go to result.pathname.groups.
The text was updated successfully, but these errors were encountered:
Currently each component in a URLPattern produces a separate
groups
map. They are accessed likeresult.pathname.groups
,result.hostname.groups
, etc. This is a bit verbose and also requires the person accessing the groups to understand which named group the component is in.We could instead try to expose a
result.groups
that combines all the matched values from all the components into one map.The main issue is what to do for conflicting group names. For example, if both the hostname and pathname have
:id
groups. Or worse, what if both hostname and pathname have anonymous groups that get the0
index name.Maybe we could offer a convenience like
result.uniqueGroups
that contains any matched groups with a unique name. If you need a value that does not have a unique name then you have to go toresult.pathname.groups
.The text was updated successfully, but these errors were encountered: