{"id":20000876,"url":"https://github.com/thevxn/object-merge","last_synced_at":"2025-03-01T23:50:27.429Z","repository":{"id":172211819,"uuid":"647945826","full_name":"thevxn/object-merge","owner":"thevxn","description":"Small, fast, simple and 0 dependency utility for merging two objects.","archived":false,"fork":false,"pushed_at":"2023-06-08T08:33:38.000Z","size":380,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-20T10:37:45.370Z","etag":null,"topics":["deep-merge","deepmerge","merge-object","merge-objects","object-merge","object-merging"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@savla-dev/object-merge","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/thevxn.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-31T21:44:13.000Z","updated_at":"2023-06-07T06:54:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"fde8ae12-16f3-4963-8984-0fc2644f2cec","html_url":"https://github.com/thevxn/object-merge","commit_stats":null,"previous_names":["savla-dev/object-merge","thevxn/object-merge"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevxn%2Fobject-merge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevxn%2Fobject-merge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevxn%2Fobject-merge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thevxn%2Fobject-merge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thevxn","download_url":"https://codeload.github.com/thevxn/object-merge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241439470,"owners_count":19963097,"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":["deep-merge","deepmerge","merge-object","merge-objects","object-merge","object-merging"],"created_at":"2024-11-13T05:16:03.804Z","updated_at":"2025-03-01T23:50:27.401Z","avatar_url":"https://github.com/thevxn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# object-merge\n\nSmall, fast, simple and 0 dependency utility for merging two objects.\n\n## Install\n\n```bash\nnpm i @savla-dev/object-merge\n```\n\n## Usage\n\n```ts\nimport { merge } from '@savla-dev/object-merge'\n\nconst object1 = {\n  foo: 'bar',\n  baz: [1, 2, 3],\n  nestedObject: {\n    also: 'works'\n  }\n}\n\nconst object2 = {\n  key: 'value',\n  baz: [4, 5, 6],\n  nestedObject: {\n    also: 'this value overrides the one from object1 due to this object having priority',\n    anotherKey: 'anotherValue'\n  }\n}\n\n// Returns the resultingObject below\nmerge(object1, object2, {\n  priorityObject: 'right',\n  useStructuredClone: true,\n  mergeArrays: true\n})\n\nconst resultingObject = {\n  foo: 'bar',\n  baz: [1, 2, 3, 4, 5, 6],\n  nestedObject: {\n    also: 'this value overrides the one from object1 due to this object having priority',\n    anotherKey: 'anotherValue'\n  },\n  key: 'value'\n}\n```\n\n## Options\n\n- priorityObject\n  - Specifies the object to take priority during merging and overriding values at identical keys.\n  - `\"left\" | \"right\"`\n- mergeArrays\n  - Specifies whether arrays should be merged or overriden by the array from the priorityObject. True by default.\n  - `boolean`\n- useStructuredClone\n  - Specifies whether to use the structuredClone() function to clone the object that is not priorityObject. True by default. If set to false, the `merge()` function will mutate the object not set as priorityObject.\n  - `boolean`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthevxn%2Fobject-merge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthevxn%2Fobject-merge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthevxn%2Fobject-merge/lists"}