This is more of a usability enhancement vs. new feature but what do you think about breaking up the setRoute function into separate methods? I dislike how 'overloaded' it is. Depending on the params you pass in, the function will perform slightly different actions, making it hard to reason about and use.
RIght now, setRoute can be used in 4 different ways:
setRoute(route)
setRoute(start, length)
- remove a segment from the current route
setRoute(index, value)
- replace a segment of the current route
setRoute(start, length, value)
- remove and set a segment on the current route
Caveat is that this will introduce breaking changes to the router (I guess we could make it backwards compatible but not a huge fan of that idea)
Also, I'm willing to submit a PR for this if you think it's a good idea
Thoughts?
This is more of a usability enhancement vs. new feature but what do you think about breaking up the
setRoutefunction into separate methods? I dislike how 'overloaded' it is. Depending on the params you pass in, the function will perform slightly different actions, making it hard to reason about and use.RIght now, setRoute can be used in 4 different ways:
setRoute(route)setRoute(start, length)setRoute(index, value)setRoute(start, length, value)Caveat is that this will introduce breaking changes to the router (I guess we could make it backwards compatible but not a huge fan of that idea)
Also, I'm willing to submit a PR for this if you think it's a good idea
Thoughts?