{"action":"created","issue":{"url":"https://api.github.com/repos/websdk/rhumb/issues/18","repository_url":"https://api.github.com/repos/websdk/rhumb","labels_url":"https://api.github.com/repos/websdk/rhumb/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/websdk/rhumb/issues/18/comments","events_url":"https://api.github.com/repos/websdk/rhumb/issues/18/events","html_url":"https://github.com/websdk/rhumb/pull/18","id":206851515,"number":18,"title":"Introduce rhumb.interpolate()","user":{"login":"matthewdunsdon","id":100268,"avatar_url":"https://avatars.githubusercontent.com/u/100268?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewdunsdon","html_url":"https://github.com/matthewdunsdon","followers_url":"https://api.github.com/users/matthewdunsdon/followers","following_url":"https://api.github.com/users/matthewdunsdon/following{/other_user}","gists_url":"https://api.github.com/users/matthewdunsdon/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewdunsdon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewdunsdon/subscriptions","organizations_url":"https://api.github.com/users/matthewdunsdon/orgs","repos_url":"https://api.github.com/users/matthewdunsdon/repos","events_url":"https://api.github.com/users/matthewdunsdon/events{/privacy}","received_events_url":"https://api.github.com/users/matthewdunsdon/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":34,"created_at":"2017-02-10T17:07:23Z","updated_at":"2017-02-27T12:17:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/websdk/rhumb/pulls/18","html_url":"https://github.com/websdk/rhumb/pull/18","diff_url":"https://github.com/websdk/rhumb/pull/18.diff","patch_url":"https://github.com/websdk/rhumb/pull/18.patch"},"body":"**As a** developer using rhumb, :smiley: \r\n\r\n**I would like** rhumb to provide me with a function for interpolating params and producing URIs that I can use to mach upon,\r\n\r\n**So that**\r\n\r\n1. I do not have to actively maintain my own implementation :hammer:  \r\n1. To share what I have done with the world. :earth_africa:\r\n\r\n## Description\r\n\r\nSupports creating URIs from fixed parts:\r\n\r\n```javascript\r\ntest('Interpolating should handle multiple fixed parts', function(t) {\r\n  t.plan(1)\r\n\r\n  t.equal(rhumb.interpolate('/foo/bar/bing', {}), '/foo/bar/bing', 'returns correct url')\r\n})\r\n```\r\n\r\nSupports creating URIs from variable parts\r\n\r\n```javascript\r\ntest('Interpolating should return correct path for /{foo}', function(t) {\r\n  t.plan(4)\r\n\r\n  t.equal(rhumb.interpolate('/{foo}', { foo: 'bar' }), '/bar', 'handles all params present')\r\n\r\n  t.equal(rhumb.interpolate('/{foo}', {}), '/', 'handles missing foo param')\r\n  t.equal(rhumb.interpolate('/{foo}', { foo: null }), '/', 'handles null foo param')\r\n  t.equal(rhumb.interpolate('/{foo}', { foo: '' }), '/', 'handles empty foo param')\r\n})\r\n```\r\n\r\nSupports creating URIs from partial parts\r\n\r\n```javascript\r\ntest('Interpolating should return correct path for /{day}-{month}-{year}', function(t) {\r\n  t.plan(1)\r\n\r\n  t.equal(rhumb.interpolate('/{day}-{month}-{year}', { day: 'mon', month: '01', year: '2020' }), '/mon-01-2020', 'returns path /mon-01-2020')\r\n  t.plan(1)\r\n})\r\n```\r\n\r\nSupports creating URIs where a string query is included\r\n\r\n```javascript\r\ntest('Interpolating should handle multiple fixed part and query string params', function(t) {\r\n  t.plan(1)\r\n\r\n  t.equal(rhumb.interpolate('/sing/bird-song?foo=bar&baz=bam', {}), '/sing/bird-song?foo=bar&baz=bam', 'returns correct url')\r\n})\r\n```\r\n\r\nSupports creating URIs from optional parts (including nesting)\r\n\r\n```javascript\r\ntest('Interpolating should process with nested optional fixed parts', function(t){\r\n  t.plan(1)\r\n\r\n  t.equal(rhumb.interpolate('/one/two(/three/four(/five))', {}), '/one/two/three/four/five', 'nested optional elements are included in url')\r\n})\r\n```\r\n\r\n## Motivation and Context\r\n\r\nThis is functionality is being used in a variety of projects, and it is closely related to the functionality of rhumb, so it seems like rhumb should provide this .\r\n\r\n## How Was This Tested?\r\n\r\n:memo:  Unit tests have been written\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My change follows the style of this project\r\n- [x] My change requires a change to the documentation\r\n- [x] I have updated the documentation accordingly\r\n- [x] I have read the [contribution guidelines](../CONTRIBUTING.md)\r\n- [x] I have added tests to cover my changes\r\n- [x] All new and existing tests passed\r\n"},"comment":{"url":"https://api.github.com/repos/websdk/rhumb/issues/comments/282704775","html_url":"https://github.com/websdk/rhumb/pull/18#issuecomment-282704775","issue_url":"https://api.github.com/repos/websdk/rhumb/issues/18","id":282704775,"user":{"login":"mstade","id":605731,"avatar_url":"https://avatars.githubusercontent.com/u/605731?v=3","gravatar_id":"","url":"https://api.github.com/users/mstade","html_url":"https://github.com/mstade","followers_url":"https://api.github.com/users/mstade/followers","following_url":"https://api.github.com/users/mstade/following{/other_user}","gists_url":"https://api.github.com/users/mstade/gists{/gist_id}","starred_url":"https://api.github.com/users/mstade/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mstade/subscriptions","organizations_url":"https://api.github.com/users/mstade/orgs","repos_url":"https://api.github.com/users/mstade/repos","events_url":"https://api.github.com/users/mstade/events{/privacy}","received_events_url":"https://api.github.com/users/mstade/received_events","type":"User","site_admin":false},"created_at":"2017-02-27T12:17:12Z","updated_at":"2017-02-27T12:17:12Z","body":" I'm probably bike shedding, but – I'd prefer it if the style changes and reorganization happens in a separate PR. They aren't really related to the issue at hand and make it more difficult to review *this* PR.\r\n\r\nThe reorg and style changes make sense, and probably modularizing things makes sense *as well*, but I'd rather get these changes out the door first, and deal with those things after. Feel free to disagree though!! :o)"}}
{"actor":{"display_login":"mstade"}}