{"action":"opened","issue":{"url":"https://api.github.com/repos/aheckmann/mquery/issues/102","repository_url":"https://api.github.com/repos/aheckmann/mquery","labels_url":"https://api.github.com/repos/aheckmann/mquery/issues/102/labels{/name}","comments_url":"https://api.github.com/repos/aheckmann/mquery/issues/102/comments","events_url":"https://api.github.com/repos/aheckmann/mquery/issues/102/events","html_url":"https://github.com/aheckmann/mquery/issues/102","id":336066112,"node_id":"MDU6SXNzdWUzMzYwNjYxMTI=","number":102,"title":"Array sort options not parse correctly","user":{"login":"Fonger","id":5862369,"node_id":"MDQ6VXNlcjU4NjIzNjk=","avatar_url":"https://avatars3.githubusercontent.com/u/5862369?v=4","gravatar_id":"","url":"https://api.github.com/users/Fonger","html_url":"https://github.com/Fonger","followers_url":"https://api.github.com/users/Fonger/followers","following_url":"https://api.github.com/users/Fonger/following{/other_user}","gists_url":"https://api.github.com/users/Fonger/gists{/gist_id}","starred_url":"https://api.github.com/users/Fonger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Fonger/subscriptions","organizations_url":"https://api.github.com/users/Fonger/orgs","repos_url":"https://api.github.com/users/Fonger/repos","events_url":"https://api.github.com/users/Fonger/events{/privacy}","received_events_url":"https://api.github.com/users/Fonger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-27T03:38:26Z","updated_at":"2018-06-27T03:38:26Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"There's same problem with _pushMap too. I'll open a pull request or this.\r\n\r\n```js\r\nfunction _pushArr (opts, field, value) {\r\n  opts.sort = opts.sort || [];\r\n  if (!Array.isArray(opts.sort)) {\r\n    throw new TypeError(\"Can't mix sort syntaxes. Use either array or object:\" +\r\n      \"\\n- `.sort([['field', 1], ['test', -1]])`\" +\r\n      \"\\n- `.sort({ field: 1, test: -1 })`\");\r\n  }\r\n  var valueStr = value.toString()\r\n    .replace(\"asc\", \"1\")\r\n    .replace(\"ascending\", \"1\")\r\n              ^^^ because asc comes first, we get 1ending here\r\n    .replace(\"desc\", \"-1\")\r\n    .replace(\"descending\", \"-1\");\r\n              ^^^^ because desc comes first, we get -1ending here\r\n  opts.sort.push([field, value]);\r\n                         ^^^^^ use wrong variable here, should be valueStr\r\n}\r\n```"}}
{"actor":{"display_login":"Fonger"}}