{"action":"created","issue":{"url":"https://api.github.com/repos/koajs/qs/issues/5","labels_url":"https://api.github.com/repos/koajs/qs/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/koajs/qs/issues/5/comments","events_url":"https://api.github.com/repos/koajs/qs/issues/5/events","html_url":"https://github.com/koajs/qs/issues/5","id":68375036,"number":5,"title":"3.0.0 plan","user":{"login":"fengmk2","id":156269,"avatar_url":"https://avatars.githubusercontent.com/u/156269?v=3","gravatar_id":"","url":"https://api.github.com/users/fengmk2","html_url":"https://github.com/fengmk2","followers_url":"https://api.github.com/users/fengmk2/followers","following_url":"https://api.github.com/users/fengmk2/following{/other_user}","gists_url":"https://api.github.com/users/fengmk2/gists{/gist_id}","starred_url":"https://api.github.com/users/fengmk2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fengmk2/subscriptions","organizations_url":"https://api.github.com/users/fengmk2/orgs","repos_url":"https://api.github.com/users/fengmk2/repos","events_url":"https://api.github.com/users/fengmk2/events{/privacy}","received_events_url":"https://api.github.com/users/fengmk2/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/koajs/qs/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"fengmk2","id":156269,"avatar_url":"https://avatars.githubusercontent.com/u/156269?v=3","gravatar_id":"","url":"https://api.github.com/users/fengmk2","html_url":"https://github.com/fengmk2","followers_url":"https://api.github.com/users/fengmk2/followers","following_url":"https://api.github.com/users/fengmk2/following{/other_user}","gists_url":"https://api.github.com/users/fengmk2/gists{/gist_id}","starred_url":"https://api.github.com/users/fengmk2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fengmk2/subscriptions","organizations_url":"https://api.github.com/users/fengmk2/orgs","repos_url":"https://api.github.com/users/fengmk2/repos","events_url":"https://api.github.com/users/fengmk2/events{/privacy}","received_events_url":"https://api.github.com/users/fengmk2/received_events","type":"User","site_admin":false},"milestone":null,"comments":13,"created_at":"2015-04-14T13:30:43Z","updated_at":"2015-04-15T02:33:48Z","closed_at":null,"body":"Make `this.query[key]` return strict `String` value and add `this.getQuery(key, options)` to return `Array` or `Object` value.\r\n\r\n## `this.query[key]` \r\n\r\nequal to  `this.getQuery(key)` and  `this.getQuery(key, {type: 'string'})`\r\n\r\nreturn `String` value\r\n\r\n- if key not exists, return `undefined`\r\n- `foo[bar][baz]=foobarbaz` => `{ 'foo[bar][baz]': 'foobarbaz' }`\r\n - `this.query.foo` return `undefined` \r\n - `this.query['foo[bar][baz]']` return `'foobarbaz'`\r\n- `a[]=b&a[]=c` => `{ 'a[]': 'b' }`\r\n - `this.query.a` return `undefined` \r\n - `this.query['a[]']` return `b`\r\n\r\n## `this.getQuery(key, {type: array|string|object})`\r\n\r\n~~`this.queryArray[key]`~~\r\n\r\n- type {String} default is `'string'`\r\n\r\n### `this.getQuery(key, {type: 'array'})`\r\n\r\nreturn `Array` value\r\n\r\n- if key not exists, return `undefined`\r\n- `foo[bar][baz]=foobarbaz` => `{ 'foo[bar][baz]': [ 'foobarbaz' ] }`\r\n - `this.getQuery('foo', {type: 'array'})` return `undefined`\r\n - `this.getQuery('foo[bar][baz]', {type: 'array'})` return `[ 'foobarbaz' ]`\r\n- `a[]=b&a[]=c` => `{ 'a': [ 'b', 'c' ] }`\r\n - `this.getQuery('a', {type: 'array'})` return `['b', 'c']`\r\n - `this.getQuery('a[]', {type: 'array'})` return `undefined`\r\n- `a=b` => `{ 'a': [ 'b' ] }`\r\n - `this.getQuery('a', {type: 'array'})` return `['b']`\r\n\r\n### `this.getQuery(key, {type: 'object'})`\r\n\r\nreturn `Object` value\r\n\r\n- if key not exists, return `undefined`\r\n- if key exists and value is `non-object`, return `undefined`\r\n- `foo[bar][baz]=foobarbaz` => `this.getQuery('foo', {type: 'object'})` return `{ bar: { baz: 'foobarbaz' } }`\r\n- `a[]=b&a[]=c` => `this.getQuery('a', {type: 'object'})` return `undefined`\r\n- `a=b` => `this.getQuery('a', {type: 'object'})` return `undefined`"},"comment":{"url":"https://api.github.com/repos/koajs/qs/issues/comments/93157740","html_url":"https://github.com/koajs/qs/issues/5#issuecomment-93157740","issue_url":"https://api.github.com/repos/koajs/qs/issues/5","id":93157740,"user":{"login":"hotoo","id":143572,"avatar_url":"https://avatars.githubusercontent.com/u/143572?v=3","gravatar_id":"","url":"https://api.github.com/users/hotoo","html_url":"https://github.com/hotoo","followers_url":"https://api.github.com/users/hotoo/followers","following_url":"https://api.github.com/users/hotoo/following{/other_user}","gists_url":"https://api.github.com/users/hotoo/gists{/gist_id}","starred_url":"https://api.github.com/users/hotoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hotoo/subscriptions","organizations_url":"https://api.github.com/users/hotoo/orgs","repos_url":"https://api.github.com/users/hotoo/repos","events_url":"https://api.github.com/users/hotoo/events{/privacy}","received_events_url":"https://api.github.com/users/hotoo/received_events","type":"User","site_admin":false},"created_at":"2015-04-15T02:33:48Z","updated_at":"2015-04-15T02:33:48Z","body":"I think `this.queryObject` and `this.getQuery(key, {type:object})` is awful.\r\n\r\n```js\r\n// foo[bar][baz]=foobarbaz => this.queryObject.foo return { bar: { baz: 'foobarbaz' } }\r\n// developer write code following:\r\nvar baz = this.queryObject.foo.bar.baz;\r\n// if there not has `foo[bar][baz]` key in querystring, will throw javascript exception.\r\n\r\n// developer must write code like following for safe:\r\nvar baz;\r\nif (this.queryObject.foo && this.queryObject.foo.bar) {\r\n  baz = this.queryObject.foo.bar.baz;\r\n}\r\nif (typeof baz !== \"undefined\") {\r\n  // dosomething.\r\n}\r\n```"}}