{"id":18254257,"url":"https://github.com/brikcss/merge","last_synced_at":"2025-04-04T17:30:41.252Z","repository":{"id":54853491,"uuid":"126838971","full_name":"brikcss/merge","owner":"brikcss","description":"Utility to perform a deep merge of a list of objects or arrays.","archived":false,"fork":false,"pushed_at":"2021-02-21T04:34:59.000Z","size":4947,"stargazers_count":1,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-01T22:16:52.827Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brikcss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-03-26T14:11:21.000Z","updated_at":"2021-12-14T13:52:28.000Z","dependencies_parsed_at":"2022-08-14T04:50:26.753Z","dependency_job_id":null,"html_url":"https://github.com/brikcss/merge","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brikcss%2Fmerge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brikcss%2Fmerge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brikcss%2Fmerge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brikcss%2Fmerge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brikcss","download_url":"https://codeload.github.com/brikcss/merge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223150742,"owners_count":17095959,"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-11-05T10:11:17.956Z","updated_at":"2024-11-05T10:11:18.680Z","avatar_url":"https://github.com/brikcss.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deep Merge\n\n\u003c!-- Shields. --\u003e\n\u003cp\u003e\n\t\u003c!-- NPM version. --\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/@brikcss/merge\"\u003e\u003cimg alt=\"NPM version\" src=\"https://img.shields.io/npm/v/@brikcss/merge.svg?style=flat-square\"\u003e\u003c/a\u003e\n\t\u003c!-- NPM downloads/month. --\u003e\n\t\u003ca href=\"https://www.npmjs.com/package/@brikcss/merge\"\u003e\u003cimg alt=\"NPM downloads per month\" src=\"https://img.shields.io/npm/dm/@brikcss/merge.svg?style=flat-square\"\u003e\u003c/a\u003e\n\t\u003c!-- Travis branch. --\u003e\n\t\u003ca href=\"https://github.com/brikcss/merge/tree/master\"\u003e\u003cimg alt=\"Travis branch\" src=\"https://img.shields.io/travis/rust-lang/rust/master.svg?style=flat-square\u0026label=master\"\u003e\u003c/a\u003e\n\t\u003c!-- Codacy. --\u003e\n\t\u003ca href=\"https://www.codacy.com\"\u003e\u003cimg alt=\"Codacy code quality grade\" src=\"https://img.shields.io/codacy/grade/49af7ce4215c4720a6dbc90c3b7fcdbe/master.svg?style=flat-square\"\u003e\u003c/a\u003e\n\t\u003ca href=\"https://www.codacy.com\"\u003e\u003cimg alt=\"Codacy code coverage\" src=\"https://img.shields.io/codacy/coverage/49af7ce4215c4720a6dbc90c3b7fcdbe/master.svg?style=flat-square\"\u003e\u003c/a\u003e\n\t\u003c!-- Coveralls --\u003e\n\t\u003ca href='https://coveralls.io/github/brikcss/merge?branch=master'\u003e\u003cimg src='https://img.shields.io/coveralls/github/brikcss/merge/master.svg?style=flat-square' alt='Coverage Status' /\u003e\u003c/a\u003e\n\t\u003c!-- JS Standard style. --\u003e\n\t\u003ca href=\"https://standardjs.com\"\u003e\u003cimg alt=\"JavaScript Style Guide\" src=\"https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square\"\u003e\u003c/a\u003e\n\t\u003c!-- Prettier code style. --\u003e\n\t\u003ca href=\"https://prettier.io/\"\u003e\u003cimg alt=\"code style: prettier\" src=\"https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square\"\u003e\u003c/a\u003e\n\t\u003c!-- Semantic release. --\u003e\n\t\u003ca href=\"https://github.com/semantic-release/semantic-release\"\u003e\u003cimg alt=\"semantic release\" src=\"https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square\"\u003e\u003c/a\u003e\n\t\u003c!-- Commitizen friendly. --\u003e\n\t\u003ca href=\"http://commitizen.github.io/cz-cli/\"\u003e\u003cimg alt=\"Commitizen friendly\" src=\"https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=flat-square\"\u003e\u003c/a\u003e\n\t\u003c!-- Greenkeeper. --\u003e\n\t\u003ca href=\"https://greenkeeper.io/\"\u003e\u003cimg src=\"https://badges.greenkeeper.io/brikcss/merge.svg?style=flat-square\" alt=\"Greenkeeper badge\"\u003e\u003c/a\u003e\n\t\u003c!-- MIT License. --\u003e\n\t\u003ca href=\"https://choosealicense.com/licenses/mit/\"\u003e\u003cimg alt=\"License\" src=\"https://img.shields.io/npm/l/express.svg?style=flat-square\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nUtility to perform a deep merge of two or more Objects or Arrays.\n\n## Environment support\n\n| Node | CLI | UMD | ES Module | Browser |\n| :--: | :-: | :-: | :-------: | :-----: |\n|  ✔   |  x  |  ✔  |     ✔     |    ✔    |\n\n## Install\n\n```sh\nnpm install @brikcss/merge --save-dev\n```\n\n## Setup\n\n**Node:**\n\n```js\nconst merge = require('@brikcss/merge');\n```\n\n**JS Modules:**\n\n```js\nimport merge from '@brikcss/merge';\n```\n\n**Browser:**\n\n```js\nconst merge = window.brikcss.merge;\n```\n\n## Usage\n\nPass list of objects (or arrays) directly to the merge function:\n\n```js\nmerge(...objects);\n```\n\nTo use with options, set 1st argument as an Array of objects (or arrays) and set 2nd argument as options Object:\n\n```js\nmerge([...objects], options);\n```\n\n**Note:**\n\n`Merge` works similarly to the `Object.assign()` method in that the first object is set as the merge target and will mutate with each merged object. If you wish to do a full clone, simply pass an empty Object (or Array) as the first object:\n\n```js\nmerge({}, obj1, obj2);\n// Or with options:\nmerge([{}, obj1, obj2], options);\n```\n\n## API\n\n### `Merge(...objects)` or `Merge([...objects], options)`\n\nA container function to merge _either Objects or Arrays_. Any number of Objects or Arrays can be merged, _but they all need to be either Objects or Arrays, not a mix of both._\n\nIf only two arguments exist, and the 1st argument is an Array and the 2nd is an Object, `Merge` will merge the items in the Array and treat the Object as options.\n\n### `Merge.objects(target, source, options)`\n\nReturns the target Object, which is now merged with the source Object.\n\n-   `target` _{Object}_ Target to merge to.\n-   `source` _{Object}_ Object to merge with target.\n-   `options` _{Object}_ [Configuration options](#options).\n\n### `Merge.arrays(target, source, options)`\n\nReturns the target Array, which is now merged with the source Array.\n\n-   `target` _{Array}_ Target to merge to.\n-   `source` _{Array}_ Array to merge with target.\n-   `options` _{Object}_ [Configuration options](#options).\n\n### Options\n\n**`arrayStrategy`** _{String}_\n\n-   `unique` (_default_): Concatenate arrays and remove duplicates.\n-   `merge`: Same as unique, except nested objects and arrays are merged.\n-   `concat`: Concatenate arrays, but do not remove duplicates.\n-   `overwrite`: Overwrite target array with source.\n\n**`ignore`** _{String[]}_\n\nArray of string paths to ignore, or not merge. Use object key names and/or array index values to specify values to ignore. For example: `ignore: ['key', '1', 'a.b.c.d']` will ignore the object key `key`, the 2nd item an array, and the `d` property in the path `a.b.c.d`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrikcss%2Fmerge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrikcss%2Fmerge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrikcss%2Fmerge/lists"}