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

Map route parameters to correct function parameter names #1833

Closed
pwhisenhunt opened this Issue Nov 19, 2012 · 2 comments

Comments

Projects
None yet
2 participants
@pwhisenhunt

pwhisenhunt commented Nov 19, 2012

I think it would be useful to have route parameter names mapped to their correct function parameters names. The current implementation appears to apply the arguments from the route directly to the function from left to right. An example is as follows:

routes: {
     "page:p":        "index",
     "sort:s":        "index",
     "page:p/sort:s": "index"
},

function: index(page, sort) {
}

If you navigate to the route /sortasc the variable page will store asc instead of sort.

@jashkenas

This comment has been minimized.

Show comment
Hide comment
@jashkenas

jashkenas Nov 19, 2012

Owner

Yes, the positional mapping of route arguments to function arguments is by design. Instead of us trying to decompile your function and detect and match names ... just use a mapping function to normalize the arguments if you want to use the same generic handler.

Owner

jashkenas commented Nov 19, 2012

Yes, the positional mapping of route arguments to function arguments is by design. Instead of us trying to decompile your function and detect and match names ... just use a mapping function to normalize the arguments if you want to use the same generic handler.

@jashkenas jashkenas closed this Nov 19, 2012

@pwhisenhunt

This comment has been minimized.

Show comment
Hide comment
@pwhisenhunt

pwhisenhunt Nov 19, 2012

Ok, thanks for the quick response @jashkenas!

pwhisenhunt commented Nov 19, 2012

Ok, thanks for the quick response @jashkenas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment