{"id":19041998,"url":"https://github.com/writetome51/array-get-unique-items","last_synced_at":"2026-06-18T18:31:49.714Z","repository":{"id":57169555,"uuid":"151032910","full_name":"writetome51/array-get-unique-items","owner":"writetome51","description":"Returns every item in array without any duplicates","archived":false,"fork":false,"pushed_at":"2020-09-08T20:32:08.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-14T20:09:50.531Z","etag":null,"topics":["array","itemsjs","typescript","unique"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/writetome51.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":"2018-10-01T03:38:25.000Z","updated_at":"2020-09-08T20:32:10.000Z","dependencies_parsed_at":"2022-09-13T22:53:13.227Z","dependency_job_id":null,"html_url":"https://github.com/writetome51/array-get-unique-items","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/writetome51/array-get-unique-items","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Farray-get-unique-items","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Farray-get-unique-items/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Farray-get-unique-items/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Farray-get-unique-items/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/writetome51","download_url":"https://codeload.github.com/writetome51/array-get-unique-items/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/writetome51%2Farray-get-unique-items/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34503507,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["array","itemsjs","typescript","unique"],"created_at":"2024-11-08T22:33:46.073Z","updated_at":"2026-06-18T18:31:49.694Z","avatar_url":"https://github.com/writetome51.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# getUniqueItems(array): any[]\n\nReturns every item in `array` without any duplicates. Does not modify `array`. \n\nNote:  duplicate arrays do not have to match using the `===` operator.  \nHowever, duplicate objects do.  See the examples.\n\n\n## Examples\n\u003cdetails\u003e\n\u003csummary\u003eview examples\u003c/summary\u003e\n\n```\ngetUniqueItems( [ '', 1, 2, 3, '', 1, 2, 3, '' ] );  \n// --\u003e [ '', 1, 2, 3 ]\n\ngetUniqueItems( [ true, true, false, true, false, 'aa' ] );  \n// --\u003e [ true, false, 'aa' ]\n\n\n// Objects appearing identical, but not identical in memory, are not \n// considered duplicates:\n\nlet obj1 = {name: 'steve'};\nlet obj2 = {name: 'steve'};\n\ngetUniqueItems([obj1, obj2]);\n// --\u003e [ {name: 'steve'}, {name: 'steve'} ]\n\n// Try this:\n\nlet obj1 = {name: 'steve'};\nlet obj2 = obj1;\n\ngetUniqueItems([obj1, obj2]);\n// --\u003e [ {name: 'steve'} ]\n\n\n// Arrays appearing identical, but not identical in memory, can still \n// be considered duplicates. This is because the algorithm loops thru \n// them, checking if array1[i] === array2[i].  If array1[i] and array2[i] \n// are both arrays of identical length, the algorithm recursively operates \n// on those arrays.\n\ngetUniqueItems( [ [[1,2,3]], [[1,2,3]] ] );\n// --\u003e [ [[1,2,3]] ]\n\n\n// But, if the arrays contain objects not identical in memory, they're not \n// considered duplicates:\n\nlet arr = [ [[{name: 'steve'}]], [[{name: 'steve'}]] ];\n\ngetUniqueItems(arr);\n// --\u003e [ [[{name: 'steve'}]], [[{name: 'steve'}]] ]\n\n// Let's try that again with objects identical in memory:\n\nlet obj1 = {name: 'steve'};\nlet obj2 = obj1;\nlet arr = [ [[obj1]], [[obj2]] ];\ngetUniqueItems(arr);\n// --\u003e [ [[{name: 'steve'}]] ]\n```\n\u003c/details\u003e\n\n## Installation\n`npm i  @writetome51/array-get-unique-items`\n\n## Loading\n```js\nimport {getUniqueItems} from '@writetome51/array-get-unique-items';\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Farray-get-unique-items","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwritetome51%2Farray-get-unique-items","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwritetome51%2Farray-get-unique-items/lists"}