{"id":15890559,"url":"https://github.com/dimfeld/unique-by","last_synced_at":"2025-04-02T17:20:43.608Z","repository":{"id":57108469,"uuid":"335449431","full_name":"dimfeld/unique-by","owner":"dimfeld","description":null,"archived":false,"fork":false,"pushed_at":"2021-02-03T02:25:24.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-11T14:27:32.336Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dimfeld.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-02T23:16:32.000Z","updated_at":"2021-02-03T02:25:26.000Z","dependencies_parsed_at":"2022-08-21T04:30:34.401Z","dependency_job_id":null,"html_url":"https://github.com/dimfeld/unique-by","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Funique-by","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Funique-by/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Funique-by/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dimfeld%2Funique-by/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dimfeld","download_url":"https://codeload.github.com/dimfeld/unique-by/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246856582,"owners_count":20844974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-06T07:06:44.028Z","updated_at":"2025-04-02T17:20:43.589Z","avatar_url":"https://github.com/dimfeld.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unique-by\n\nFilter an array of items based on a function that returns a value. The resulting array will have only one item for each value returned by the callback.\n\n```js\nimport uniqueBy from '@dimfeld/unique-by';\n\nlet items = [\n  { first: 'Bob', last: 'Johnson' },\n  { first: 'Alice', last: 'Rama' },\n  { first: 'Bob', last: 'Bobber' },\n  { first: 'Xavier', last: 'Xylophone' },\n  { first: 'Bob', last: 'Johnson' },\n  { first: 'George', last: 'Costanza' },\n  { first: 'Xavier', last: 'Xylophone' },\n  { first: 'Bob', last: 'Bobber' },\n  { first: 'Sally', last: 'Sappa' },\n  { first: 'Alice', last: 'Rama' },\n  { first: 'Sarah', last: 'Dara' },\n  { first: 'Sarah', last: 'Dara' },\n  { first: 'John', last: 'Bob' },\n];\n\n\nlet filtered = uniqueBy(items, (i) =\u003e i.first + i.last);\n\nconsole.dir(items);\n// [\n//   { first: 'Bob', last: 'Johnson' },\n//   { first: 'Alice', last: 'Rama' },\n//   { first: 'Bob', last: 'Bobber' },\n//   { first: 'Xavier', last: 'Xylophone' },\n//   { first: 'George', last: 'Costanza' },\n//   { first: 'Sally', last: 'Sappa' },\n//   { first: 'Sarah', last: 'Dara' },\n//   { first: 'John', last: 'Bob' },\n// ];\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimfeld%2Funique-by","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdimfeld%2Funique-by","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdimfeld%2Funique-by/lists"}