{"id":17403109,"url":"https://github.com/thlorenz/unique-concat","last_synced_at":"2025-04-30T05:08:00.361Z","repository":{"id":9754467,"uuid":"11719957","full_name":"thlorenz/unique-concat","owner":"thlorenz","description":"Concatenates two arrays, removing duplicates in the process and returns one array with unique values.","archived":false,"fork":false,"pushed_at":"2013-07-28T15:33:45.000Z","size":86,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-30T05:07:54.012Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/thlorenz.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":"2013-07-28T13:18:09.000Z","updated_at":"2017-02-03T08:45:02.000Z","dependencies_parsed_at":"2022-09-26T20:41:19.314Z","dependency_job_id":null,"html_url":"https://github.com/thlorenz/unique-concat","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Funique-concat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Funique-concat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Funique-concat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thlorenz%2Funique-concat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thlorenz","download_url":"https://codeload.github.com/thlorenz/unique-concat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251644842,"owners_count":21620634,"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-16T18:53:43.419Z","updated_at":"2025-04-30T05:08:00.331Z","avatar_url":"https://github.com/thlorenz.png","language":"JavaScript","readme":"# unique-concat [![build status](https://secure.travis-ci.org/thlorenz/unique-concat.png)](http://travis-ci.org/thlorenz/unique-concat)\n\n[![testling badge](https://ci.testling.com/thlorenz/unique-concat.png)](https://ci.testling.com/thlorenz/unique-concat)\n\nConcatenates two arrays, removing duplicates in the process and returns one array with unique values.\n\n```js\nvar concat = require('unique-concat');\nvar res = concat([ 1, 2, 3 ], [ 1, 2, 3, 4, 5, 6])\nconsole.log(res);\n// =\u003e [1, 2, 3, 4, 5, 6]\n```\n\n## Installation\n\n    npm install unique-concat\n\n## API\n\n###*function uniqueConcat(arr1, arr2[, identity])*\n```\n/**\n * Concatenates two arrays, removing duplicates in the process and returns one array with unique values.\n * In case the elements in the array don't have a proper built in way to determine their identity,\n * a custom identity function must be provided.\n *\n * As an example, {Object}s all return '[ 'object' ]' when .toString()ed and therefore require a custom\n * identity function.\n *\n * @name exports\n * @function unique-concat\n * @param arr1 {Array} first batch of elements\n * @param arr2 {Array} second batch of elements\n * @param identity {Function} (optional) supply an alternative way to get an element's identity\n */\n```\n\n## Identity function example\n\n```js\nvar identity = function (obj) { return obj.a; }\nvar res = concat([{ a: 1 }, { a: 2, b: 1}], [{ a: 2, b: 2 }, { a: 3 }], identity);\nconsole.log(res);\n// =\u003e [ { a: 1 }, { a: 2, b: 2 }, { a: 3 } ]\n```\n\nFor more examples see [tests](https://github.com/thlorenz/unique-concat/blob/master/test/index.js)\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Funique-concat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthlorenz%2Funique-concat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthlorenz%2Funique-concat/lists"}