{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/14075","repository_url":"https://api.github.com/repos/angular/angular.js","labels_url":"https://api.github.com/repos/angular/angular.js/issues/14075/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/14075/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/14075/events","html_url":"https://github.com/angular/angular.js/issues/14075","id":134472876,"number":14075,"title":"Why a function forEachSorted use Object.keys?","user":{"login":"rafaeldev","id":4596160,"avatar_url":"https://avatars.githubusercontent.com/u/4596160?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaeldev","html_url":"https://github.com/rafaeldev","followers_url":"https://api.github.com/users/rafaeldev/followers","following_url":"https://api.github.com/users/rafaeldev/following{/other_user}","gists_url":"https://api.github.com/users/rafaeldev/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaeldev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaeldev/subscriptions","organizations_url":"https://api.github.com/users/rafaeldev/orgs","repos_url":"https://api.github.com/users/rafaeldev/repos","events_url":"https://api.github.com/users/rafaeldev/events{/privacy}","received_events_url":"https://api.github.com/users/rafaeldev/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/angular/angular.js/labels/component:%20$http","name":"component: $http","color":"d7e102"},{"url":"https://api.github.com/repos/angular/angular.js/labels/frequency:%20low","name":"frequency: low","color":"bfe5bf"},{"url":"https://api.github.com/repos/angular/angular.js/labels/severity:%20inconvenient","name":"severity: inconvenient","color":"006b75"},{"url":"https://api.github.com/repos/angular/angular.js/labels/type:%20bug","name":"type: bug","color":"000000"}],"state":"closed","locked":false,"assignee":{"login":"gkalpak","id":8604205,"avatar_url":"https://avatars.githubusercontent.com/u/8604205?v=3","gravatar_id":"","url":"https://api.github.com/users/gkalpak","html_url":"https://github.com/gkalpak","followers_url":"https://api.github.com/users/gkalpak/followers","following_url":"https://api.github.com/users/gkalpak/following{/other_user}","gists_url":"https://api.github.com/users/gkalpak/gists{/gist_id}","starred_url":"https://api.github.com/users/gkalpak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkalpak/subscriptions","organizations_url":"https://api.github.com/users/gkalpak/orgs","repos_url":"https://api.github.com/users/gkalpak/repos","events_url":"https://api.github.com/users/gkalpak/events{/privacy}","received_events_url":"https://api.github.com/users/gkalpak/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/angular/angular.js/milestones/35","html_url":"https://github.com/angular/angular.js/milestones/Purgatory","labels_url":"https://api.github.com/repos/angular/angular.js/milestones/35/labels","id":526241,"number":35,"title":"Purgatory","description":"This milestone is for issues and PRs that weren't accepted yet and we are waiting for more info from the submitter.\r\n\r\nFor issues this typically means that we weren't able to reproduce the issue or we haven't decided yet if a feature request is a good idea at all.\r\n\r\nFor PRs this means that the PR still needs a lot of work and we might not even be interested in merging it because it looks like a non-core feature. We are still waiting for more discussion within the team or more info from the contributor before making the final decision.","creator":{"login":"IgorMinar","id":216296,"avatar_url":"https://avatars.githubusercontent.com/u/216296?v=3","gravatar_id":"","url":"https://api.github.com/users/IgorMinar","html_url":"https://github.com/IgorMinar","followers_url":"https://api.github.com/users/IgorMinar/followers","following_url":"https://api.github.com/users/IgorMinar/following{/other_user}","gists_url":"https://api.github.com/users/IgorMinar/gists{/gist_id}","starred_url":"https://api.github.com/users/IgorMinar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IgorMinar/subscriptions","organizations_url":"https://api.github.com/users/IgorMinar/orgs","repos_url":"https://api.github.com/users/IgorMinar/repos","events_url":"https://api.github.com/users/IgorMinar/events{/privacy}","received_events_url":"https://api.github.com/users/IgorMinar/received_events","type":"User","site_admin":false},"open_issues":125,"closed_issues":666,"state":"open","created_at":"2014-01-04T01:20:50Z","updated_at":"2016-03-28T19:47:35Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-02-18T03:39:26Z","updated_at":"2016-03-28T19:47:35Z","closed_at":"2016-03-28T19:47:35Z","body":"I was trying to pass an object by using the tool parameter setting _**$http**_:\r\n`{ Method: \"GET\", url: \"company/create\" params: { name: \"Rafael\", age: 23} }`\r\n\r\nIt turns out that given time the object passed in the params attribute is an object created from the _**Object.create()**_ function. As we know, this function returns an object, which if you have values, will be added to the prototype of it.\r\n\r\nI saw that every time I made the request through an object that had values ​​in the prototype, the keys/values ​​were ignored.\r\n\r\nStudying a little more code, I saw that the object passed in params is handled by the function _**$HttpParamSerializerProvider**_, which in turn uses the _**forEachSorted**_ function.\r\n\r\nWithin the _**forEachSorted**_ function is used to _**Object.keys().sort()**_. Viewing the documentation by [MDN](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/keys) saw that _**Object.keys**_ function does not return the keys at the prototype level, thus ignoring other attributes of the object.\r\n\r\nWell, after all this is the question. Why use _**Object.keys**_? Why not make a for ... in ...?\r\n\r\nThank you!\r\n\r\nP.S.: Google Translate"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/202555596","html_url":"https://github.com/angular/angular.js/issues/14075#issuecomment-202555596","issue_url":"https://api.github.com/repos/angular/angular.js/issues/14075","id":202555596,"user":{"login":"lgalfaso","id":391394,"avatar_url":"https://avatars.githubusercontent.com/u/391394?v=3","gravatar_id":"","url":"https://api.github.com/users/lgalfaso","html_url":"https://github.com/lgalfaso","followers_url":"https://api.github.com/users/lgalfaso/followers","following_url":"https://api.github.com/users/lgalfaso/following{/other_user}","gists_url":"https://api.github.com/users/lgalfaso/gists{/gist_id}","starred_url":"https://api.github.com/users/lgalfaso/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lgalfaso/subscriptions","organizations_url":"https://api.github.com/users/lgalfaso/orgs","repos_url":"https://api.github.com/users/lgalfaso/repos","events_url":"https://api.github.com/users/lgalfaso/events{/privacy}","received_events_url":"https://api.github.com/users/lgalfaso/received_events","type":"User","site_admin":false},"created_at":"2016-03-28T19:47:35Z","updated_at":"2016-03-28T19:47:35Z","body":"With the information above and no other feedback, closing this as works as expected."}}