{"action":"created","issue":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/12875","labels_url":"https://api.github.com/repos/emberjs/ember.js/issues/12875/labels{/name}","comments_url":"https://api.github.com/repos/emberjs/ember.js/issues/12875/comments","events_url":"https://api.github.com/repos/emberjs/ember.js/issues/12875/events","html_url":"https://github.com/emberjs/ember.js/pull/12875","id":129915125,"number":12875,"title":"[FEATURE uniqBy] Adds Enumerable.uniqBy and Computed.uniqBy","user":{"login":"seanjohnson08","id":1444384,"avatar_url":"https://avatars.githubusercontent.com/u/1444384?v=3","gravatar_id":"","url":"https://api.github.com/users/seanjohnson08","html_url":"https://github.com/seanjohnson08","followers_url":"https://api.github.com/users/seanjohnson08/followers","following_url":"https://api.github.com/users/seanjohnson08/following{/other_user}","gists_url":"https://api.github.com/users/seanjohnson08/gists{/gist_id}","starred_url":"https://api.github.com/users/seanjohnson08/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seanjohnson08/subscriptions","organizations_url":"https://api.github.com/users/seanjohnson08/orgs","repos_url":"https://api.github.com/users/seanjohnson08/repos","events_url":"https://api.github.com/users/seanjohnson08/events{/privacy}","received_events_url":"https://api.github.com/users/seanjohnson08/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-29T23:56:46Z","updated_at":"2016-01-31T17:34:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/emberjs/ember.js/pulls/12875","html_url":"https://github.com/emberjs/ember.js/pull/12875","diff_url":"https://github.com/emberjs/ember.js/pull/12875.diff","patch_url":"https://github.com/emberjs/ember.js/pull/12875.patch"},"body":"ORIGINAL PR: https://github.com/emberjs/ember.js/pull/12758\r\n\r\nAlmost all of the enumerable methods that serve to produce some new result from a list follow the following pattern:\r\n\r\nEnumerate by object | Enumerate by object property\r\n------------ | -------------\r\n`filter` | `filterBy`\r\n`map` | `mapBy`\r\n`find` | `findBy`\r\n`reject` | `rejectBy`\r\n`uniq` | ????\r\n\r\nExcept `uniq`! My proposal is to add a `uniqBy` method to both the `Enumerable` class and to the computed reduce macros to allow the user to reduce a list down to its unique values given some key. A prime example is if I'm dealing with a list of records, or objects returned that have a primary key:\r\n\r\n```var records = Ember.A([\r\n{id: 1, name: 'Adam' },\r\n{id: 2, name: 'Eve' },\r\n{id: 1, name: 'Adam'}\r\n]);```\r\n\r\nIf I wanted to remove the duplicate records, I would then be able to use the result of `records.uniqBy('id')` to get a list of just the unique records in the list.\r\n\r\nThis would not alter or modify the existing `uniq` methods, it would just serve to fill in a blank."},"comment":{"url":"https://api.github.com/repos/emberjs/ember.js/issues/comments/177558437","html_url":"https://github.com/emberjs/ember.js/pull/12875#issuecomment-177558437","issue_url":"https://api.github.com/repos/emberjs/ember.js/issues/12875","id":177558437,"user":{"login":"rwjblue","id":12637,"avatar_url":"https://avatars.githubusercontent.com/u/12637?v=3","gravatar_id":"","url":"https://api.github.com/users/rwjblue","html_url":"https://github.com/rwjblue","followers_url":"https://api.github.com/users/rwjblue/followers","following_url":"https://api.github.com/users/rwjblue/following{/other_user}","gists_url":"https://api.github.com/users/rwjblue/gists{/gist_id}","starred_url":"https://api.github.com/users/rwjblue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rwjblue/subscriptions","organizations_url":"https://api.github.com/users/rwjblue/orgs","repos_url":"https://api.github.com/users/rwjblue/repos","events_url":"https://api.github.com/users/rwjblue/events{/privacy}","received_events_url":"https://api.github.com/users/rwjblue/received_events","type":"User","site_admin":false},"created_at":"2016-01-31T17:34:34Z","updated_at":"2016-01-31T17:34:34Z","body":"We should also ensure that a module is added to ember-cli-shims when Ember.computed.uniqBy is present. "}}