{"action":"created","issue":{"url":"https://api.github.com/repos/whatwg/url/issues/143","repository_url":"https://api.github.com/repos/whatwg/url","labels_url":"https://api.github.com/repos/whatwg/url/issues/143/labels{/name}","comments_url":"https://api.github.com/repos/whatwg/url/issues/143/comments","events_url":"https://api.github.com/repos/whatwg/url/issues/143/events","html_url":"https://github.com/whatwg/url/issues/143","id":170878126,"number":143,"title":"Convenience method to return an Object","user":{"login":"timruffles","id":249800,"avatar_url":"https://avatars.githubusercontent.com/u/249800?v=3","gravatar_id":"","url":"https://api.github.com/users/timruffles","html_url":"https://github.com/timruffles","followers_url":"https://api.github.com/users/timruffles/followers","following_url":"https://api.github.com/users/timruffles/following{/other_user}","gists_url":"https://api.github.com/users/timruffles/gists{/gist_id}","starred_url":"https://api.github.com/users/timruffles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timruffles/subscriptions","organizations_url":"https://api.github.com/users/timruffles/orgs","repos_url":"https://api.github.com/users/timruffles/repos","events_url":"https://api.github.com/users/timruffles/events{/privacy}","received_events_url":"https://api.github.com/users/timruffles/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-08-12T14:02:28Z","updated_at":"2016-08-17T12:34:30Z","closed_at":null,"body":"People who write Javascript mostly manipulate key-value data via `Object` instances, using their enumerable properties as keys. See lodash (`_.mapKeys`, support in `_.map` etc), jQuery (`$.ajax({ url: \"c2.com\", method: \"get\" })`) etc.\r\n\r\nAdding `toObject()` as below would make this feel like a natural part of the JS ecosystem:\r\n\r\n```\r\nclass URLSearchParams {  \r\n  toObject() {\r\n    const o = {};\r\n    for(const [k,v] of this.values()) o[k] = v;\r\n    return o;\r\n  }\r\n}\r\n```\r\n\r\nThis'd allow for idiomatic composition with other core JS APIs, making for a pleasant developer experience:\r\n\r\n```\r\nconst queries = [\"?name=grace\",\"?name=sussman\"]\r\n\r\nconst hackers = queries\r\n  .map(s => new URLSearchParams(s).toObject())\r\n  .map(q => q.name)\r\n```\r\n\r\nThe alternative is everyone having to add this boiler-plate in their project, which'd be a shame.\r\n"},"comment":{"url":"https://api.github.com/repos/whatwg/url/issues/comments/240397458","html_url":"https://github.com/whatwg/url/issues/143#issuecomment-240397458","issue_url":"https://api.github.com/repos/whatwg/url/issues/143","id":240397458,"user":{"login":"domenic","id":617481,"avatar_url":"https://avatars.githubusercontent.com/u/617481?v=3","gravatar_id":"","url":"https://api.github.com/users/domenic","html_url":"https://github.com/domenic","followers_url":"https://api.github.com/users/domenic/followers","following_url":"https://api.github.com/users/domenic/following{/other_user}","gists_url":"https://api.github.com/users/domenic/gists{/gist_id}","starred_url":"https://api.github.com/users/domenic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/domenic/subscriptions","organizations_url":"https://api.github.com/users/domenic/orgs","repos_url":"https://api.github.com/users/domenic/repos","events_url":"https://api.github.com/users/domenic/events{/privacy}","received_events_url":"https://api.github.com/users/domenic/received_events","type":"User","site_admin":false},"created_at":"2016-08-17T12:34:30Z","updated_at":"2016-08-17T12:34:30Z","body":"Also,\r\n\r\n> How many bugs in node core, Angular, etc are around objects-as-maps?\r\n\r\nThere have been a number of notable security advisories in Node core (not sure if they are public yet) around objects as maps in the HTTP and URL-parsing stacks..."}}
{"actor":{"display_login":"domenic"}}