feat: Add resolve() method
Follow up of #514 to make API consistent
This is rebased on #514 so for a real diff see https://github.com/Tofandel/ziggy/pull/1/files
Is there a particular use case you have for this? The code looks fine but I'm not sure it's necessary, the new resolve() method basically just does exactly what toString() does now, right?
It's to make the api consistent, I had some problems with the fact route().params currently doesn't give query params separately, so I fixed that in unresolve which returns an object of the form {name, query, params, route}, that the resolve method could take back in without having to go through object transformations and inner workings methods, the goal is to have a reversible transformation
You'll notice this is also the same api as vue router :to="{name, params, query}" and that's because I made a plugin to make inertia.js +ziggy a drop In vue router replacement so that it works with the whole vue ecosystem and I use this method instead because it provides a direct interface
Use case, which isn't possible to make without the resolve api, is to be able to just pass it params and have the current url returned with only the params passed (see last tests to understand) so basically this allows optional params