{"action":"created","comment":{"url":"https://api.github.com/repos/trekjs/route-mapper/pulls/comments/54358880","id":54358880,"diff_hunk":"@@ -8,6 +8,7 @@\n \n import _ from 'lodash'\n import utils from './utils'\n+import { stringify } from 'qs'","path":"src/Route.js","position":4,"original_position":4,"commit_id":"23bd3d1c9778400caec3868fce1d8282ee5f25de","original_commit_id":"23bd3d1c9778400caec3868fce1d8282ee5f25de","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"'import' is only available in ES6 (use esnext option).<br>Missing semicolon.","created_at":"2016-02-28T23:24:15Z","updated_at":"2016-02-28T23:24:15Z","html_url":"https://github.com/trekjs/route-mapper/pull/10#discussion_r54358880","pull_request_url":"https://api.github.com/repos/trekjs/route-mapper/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/trekjs/route-mapper/pulls/comments/54358880"},"html":{"href":"https://github.com/trekjs/route-mapper/pull/10#discussion_r54358880"},"pull_request":{"href":"https://api.github.com/repos/trekjs/route-mapper/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/trekjs/route-mapper/pulls/10","id":61012248,"html_url":"https://github.com/trekjs/route-mapper/pull/10","diff_url":"https://github.com/trekjs/route-mapper/pull/10.diff","patch_url":"https://github.com/trekjs/route-mapper/pull/10.patch","issue_url":"https://api.github.com/repos/trekjs/route-mapper/issues/10","number":10,"state":"open","locked":false,"title":"Route#pathHelp: append trailing object parameter as query string","user":{"login":"noahlange","id":5496798,"avatar_url":"https://avatars.githubusercontent.com/u/5496798?v=3","gravatar_id":"","url":"https://api.github.com/users/noahlange","html_url":"https://github.com/noahlange","followers_url":"https://api.github.com/users/noahlange/followers","following_url":"https://api.github.com/users/noahlange/following{/other_user}","gists_url":"https://api.github.com/users/noahlange/gists{/gist_id}","starred_url":"https://api.github.com/users/noahlange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noahlange/subscriptions","organizations_url":"https://api.github.com/users/noahlange/orgs","repos_url":"https://api.github.com/users/noahlange/repos","events_url":"https://api.github.com/users/noahlange/events{/privacy}","received_events_url":"https://api.github.com/users/noahlange/received_events","type":"User","site_admin":false},"body":"Inspired by Phoenix's [path_helpers](http://www.phoenixframework.org/docs/routing#section-more-on-path-helpers), I took the liberty of reimplementing `Route#pathHelp` to allow the stringification of a single trailing argument (specifically, the first argument after the final matching regex argument) into a query string for the returned path. Given the following router configuration...\r\n\r\n```javascript\r\nimport { Router } from 'route-mapper';\r\nconst router = new Router();\r\n\r\nrouter.resources('photos', { as: 'google', format: false }, () => {\r\n  router.resources('books', () => {\r\n    router.resources('users');\r\n    router.get('show');\r\n  });\r\n});\r\n```\r\n\r\nWe can use the router as before, specifying params for the positional matches in the path regex. We can also add a JS object after the last param argument that will be stringified using the `qs` module and appended to the path as a query string.\r\n\r\n```javascript\r\nconst { google_book_users } = router.helpers;\r\n\r\nconst url1 = google_book_users(233, 377);\r\nconst url2 = google_book_users(233, 377, { admin: 0, francis: 'bacon' });\r\n\r\nconsole.log(url1); // /photos/233/books/377/users\r\nconsole.log(url2); // /photos/233/books/377/users?admin=0&francis=bacon\r\n```\r\n\r\nAdded several tests, but the original suite was a little hard to compare against. For proper use of the path helpers, it's a drop-in replacement, but if the end-user is putting garbage in, behavior will be inconsistent with the original module - e.g., using too few arguments along with the qs object will get you an `[Object object]` in your path instead of an `undefined`. But broadly speaking, so long as it's not already being abused, it'll work fine.\r\n\r\nAnyway! Really love Route-Mapper, hoping this is a helpful contribution.","created_at":"2016-02-28T23:24:06Z","updated_at":"2016-02-28T23:24:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"16511f8efa65f2abd2cb7161c6f17eb92c7c3de7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/trekjs/route-mapper/pulls/10/commits","review_comments_url":"https://api.github.com/repos/trekjs/route-mapper/pulls/10/comments","review_comment_url":"https://api.github.com/repos/trekjs/route-mapper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/trekjs/route-mapper/issues/10/comments","statuses_url":"https://api.github.com/repos/trekjs/route-mapper/statuses/23bd3d1c9778400caec3868fce1d8282ee5f25de","head":{"label":"noahlange:master","ref":"master","sha":"23bd3d1c9778400caec3868fce1d8282ee5f25de","user":{"login":"noahlange","id":5496798,"avatar_url":"https://avatars.githubusercontent.com/u/5496798?v=3","gravatar_id":"","url":"https://api.github.com/users/noahlange","html_url":"https://github.com/noahlange","followers_url":"https://api.github.com/users/noahlange/followers","following_url":"https://api.github.com/users/noahlange/following{/other_user}","gists_url":"https://api.github.com/users/noahlange/gists{/gist_id}","starred_url":"https://api.github.com/users/noahlange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noahlange/subscriptions","organizations_url":"https://api.github.com/users/noahlange/orgs","repos_url":"https://api.github.com/users/noahlange/repos","events_url":"https://api.github.com/users/noahlange/events{/privacy}","received_events_url":"https://api.github.com/users/noahlange/received_events","type":"User","site_admin":false},"repo":{"id":52731191,"name":"route-mapper","full_name":"noahlange/route-mapper","owner":{"login":"noahlange","id":5496798,"avatar_url":"https://avatars.githubusercontent.com/u/5496798?v=3","gravatar_id":"","url":"https://api.github.com/users/noahlange","html_url":"https://github.com/noahlange","followers_url":"https://api.github.com/users/noahlange/followers","following_url":"https://api.github.com/users/noahlange/following{/other_user}","gists_url":"https://api.github.com/users/noahlange/gists{/gist_id}","starred_url":"https://api.github.com/users/noahlange/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noahlange/subscriptions","organizations_url":"https://api.github.com/users/noahlange/orgs","repos_url":"https://api.github.com/users/noahlange/repos","events_url":"https://api.github.com/users/noahlange/events{/privacy}","received_events_url":"https://api.github.com/users/noahlange/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/noahlange/route-mapper","description":"Route Mapper - Generate Rails Style Routing & RESTful Routes.","fork":true,"url":"https://api.github.com/repos/noahlange/route-mapper","forks_url":"https://api.github.com/repos/noahlange/route-mapper/forks","keys_url":"https://api.github.com/repos/noahlange/route-mapper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/noahlange/route-mapper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/noahlange/route-mapper/teams","hooks_url":"https://api.github.com/repos/noahlange/route-mapper/hooks","issue_events_url":"https://api.github.com/repos/noahlange/route-mapper/issues/events{/number}","events_url":"https://api.github.com/repos/noahlange/route-mapper/events","assignees_url":"https://api.github.com/repos/noahlange/route-mapper/assignees{/user}","branches_url":"https://api.github.com/repos/noahlange/route-mapper/branches{/branch}","tags_url":"https://api.github.com/repos/noahlange/route-mapper/tags","blobs_url":"https://api.github.com/repos/noahlange/route-mapper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/noahlange/route-mapper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/noahlange/route-mapper/git/refs{/sha}","trees_url":"https://api.github.com/repos/noahlange/route-mapper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/noahlange/route-mapper/statuses/{sha}","languages_url":"https://api.github.com/repos/noahlange/route-mapper/languages","stargazers_url":"https://api.github.com/repos/noahlange/route-mapper/stargazers","contributors_url":"https://api.github.com/repos/noahlange/route-mapper/contributors","subscribers_url":"https://api.github.com/repos/noahlange/route-mapper/subscribers","subscription_url":"https://api.github.com/repos/noahlange/route-mapper/subscription","commits_url":"https://api.github.com/repos/noahlange/route-mapper/commits{/sha}","git_commits_url":"https://api.github.com/repos/noahlange/route-mapper/git/commits{/sha}","comments_url":"https://api.github.com/repos/noahlange/route-mapper/comments{/number}","issue_comment_url":"https://api.github.com/repos/noahlange/route-mapper/issues/comments{/number}","contents_url":"https://api.github.com/repos/noahlange/route-mapper/contents/{+path}","compare_url":"https://api.github.com/repos/noahlange/route-mapper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/noahlange/route-mapper/merges","archive_url":"https://api.github.com/repos/noahlange/route-mapper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/noahlange/route-mapper/downloads","issues_url":"https://api.github.com/repos/noahlange/route-mapper/issues{/number}","pulls_url":"https://api.github.com/repos/noahlange/route-mapper/pulls{/number}","milestones_url":"https://api.github.com/repos/noahlange/route-mapper/milestones{/number}","notifications_url":"https://api.github.com/repos/noahlange/route-mapper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/noahlange/route-mapper/labels{/name}","releases_url":"https://api.github.com/repos/noahlange/route-mapper/releases{/id}","deployments_url":"https://api.github.com/repos/noahlange/route-mapper/deployments","created_at":"2016-02-28T16:34:57Z","updated_at":"2016-02-28T16:34:58Z","pushed_at":"2016-02-28T23:07:40Z","git_url":"git://github.com/noahlange/route-mapper.git","ssh_url":"git@github.com:noahlange/route-mapper.git","clone_url":"https://github.com/noahlange/route-mapper.git","svn_url":"https://github.com/noahlange/route-mapper","homepage":"","size":352,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"trekjs:master","ref":"master","sha":"408707d51df1fc89c6356df83e42bb7ab8fc1854","user":{"login":"trekjs","id":7547144,"avatar_url":"https://avatars.githubusercontent.com/u/7547144?v=3","gravatar_id":"","url":"https://api.github.com/users/trekjs","html_url":"https://github.com/trekjs","followers_url":"https://api.github.com/users/trekjs/followers","following_url":"https://api.github.com/users/trekjs/following{/other_user}","gists_url":"https://api.github.com/users/trekjs/gists{/gist_id}","starred_url":"https://api.github.com/users/trekjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trekjs/subscriptions","organizations_url":"https://api.github.com/users/trekjs/orgs","repos_url":"https://api.github.com/users/trekjs/repos","events_url":"https://api.github.com/users/trekjs/events{/privacy}","received_events_url":"https://api.github.com/users/trekjs/received_events","type":"Organization","site_admin":false},"repo":{"id":29259360,"name":"route-mapper","full_name":"trekjs/route-mapper","owner":{"login":"trekjs","id":7547144,"avatar_url":"https://avatars.githubusercontent.com/u/7547144?v=3","gravatar_id":"","url":"https://api.github.com/users/trekjs","html_url":"https://github.com/trekjs","followers_url":"https://api.github.com/users/trekjs/followers","following_url":"https://api.github.com/users/trekjs/following{/other_user}","gists_url":"https://api.github.com/users/trekjs/gists{/gist_id}","starred_url":"https://api.github.com/users/trekjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trekjs/subscriptions","organizations_url":"https://api.github.com/users/trekjs/orgs","repos_url":"https://api.github.com/users/trekjs/repos","events_url":"https://api.github.com/users/trekjs/events{/privacy}","received_events_url":"https://api.github.com/users/trekjs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/trekjs/route-mapper","description":"Route Mapper - Generate Rails Style Routing & RESTful Routes.","fork":false,"url":"https://api.github.com/repos/trekjs/route-mapper","forks_url":"https://api.github.com/repos/trekjs/route-mapper/forks","keys_url":"https://api.github.com/repos/trekjs/route-mapper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/trekjs/route-mapper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/trekjs/route-mapper/teams","hooks_url":"https://api.github.com/repos/trekjs/route-mapper/hooks","issue_events_url":"https://api.github.com/repos/trekjs/route-mapper/issues/events{/number}","events_url":"https://api.github.com/repos/trekjs/route-mapper/events","assignees_url":"https://api.github.com/repos/trekjs/route-mapper/assignees{/user}","branches_url":"https://api.github.com/repos/trekjs/route-mapper/branches{/branch}","tags_url":"https://api.github.com/repos/trekjs/route-mapper/tags","blobs_url":"https://api.github.com/repos/trekjs/route-mapper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/trekjs/route-mapper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/trekjs/route-mapper/git/refs{/sha}","trees_url":"https://api.github.com/repos/trekjs/route-mapper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/trekjs/route-mapper/statuses/{sha}","languages_url":"https://api.github.com/repos/trekjs/route-mapper/languages","stargazers_url":"https://api.github.com/repos/trekjs/route-mapper/stargazers","contributors_url":"https://api.github.com/repos/trekjs/route-mapper/contributors","subscribers_url":"https://api.github.com/repos/trekjs/route-mapper/subscribers","subscription_url":"https://api.github.com/repos/trekjs/route-mapper/subscription","commits_url":"https://api.github.com/repos/trekjs/route-mapper/commits{/sha}","git_commits_url":"https://api.github.com/repos/trekjs/route-mapper/git/commits{/sha}","comments_url":"https://api.github.com/repos/trekjs/route-mapper/comments{/number}","issue_comment_url":"https://api.github.com/repos/trekjs/route-mapper/issues/comments{/number}","contents_url":"https://api.github.com/repos/trekjs/route-mapper/contents/{+path}","compare_url":"https://api.github.com/repos/trekjs/route-mapper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/trekjs/route-mapper/merges","archive_url":"https://api.github.com/repos/trekjs/route-mapper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/trekjs/route-mapper/downloads","issues_url":"https://api.github.com/repos/trekjs/route-mapper/issues{/number}","pulls_url":"https://api.github.com/repos/trekjs/route-mapper/pulls{/number}","milestones_url":"https://api.github.com/repos/trekjs/route-mapper/milestones{/number}","notifications_url":"https://api.github.com/repos/trekjs/route-mapper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/trekjs/route-mapper/labels{/name}","releases_url":"https://api.github.com/repos/trekjs/route-mapper/releases{/id}","deployments_url":"https://api.github.com/repos/trekjs/route-mapper/deployments","created_at":"2015-01-14T18:37:07Z","updated_at":"2015-09-30T21:00:30Z","pushed_at":"2016-02-28T23:24:06Z","git_url":"git://github.com/trekjs/route-mapper.git","ssh_url":"git@github.com:trekjs/route-mapper.git","clone_url":"https://github.com/trekjs/route-mapper.git","svn_url":"https://github.com/trekjs/route-mapper","homepage":"","size":733,"stargazers_count":13,"watchers_count":13,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":13,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/trekjs/route-mapper/pulls/10"},"html":{"href":"https://github.com/trekjs/route-mapper/pull/10"},"issue":{"href":"https://api.github.com/repos/trekjs/route-mapper/issues/10"},"comments":{"href":"https://api.github.com/repos/trekjs/route-mapper/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/trekjs/route-mapper/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/trekjs/route-mapper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/trekjs/route-mapper/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/trekjs/route-mapper/statuses/23bd3d1c9778400caec3868fce1d8282ee5f25de"}}}}