{"id":17932459,"url":"https://github.com/cheap-glitch/mazeru","last_synced_at":"2025-04-03T10:44:07.818Z","repository":{"id":57292851,"uuid":"331913621","full_name":"cheap-glitch/mazeru","owner":"cheap-glitch","description":"🍥 A flexible deep merging utility for JSON-like objects.","archived":false,"fork":false,"pushed_at":"2022-03-30T10:30:24.000Z","size":2266,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-28T21:30:54.566Z","etag":null,"topics":["deep-merge","deep-merge-object","merge-objects","node-module","typescript-module","utility-function"],"latest_commit_sha":null,"homepage":"https://npm.im/mazeru","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheap-glitch.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-01-22T10:34:04.000Z","updated_at":"2022-03-30T10:30:30.000Z","dependencies_parsed_at":"2022-08-27T12:20:59.665Z","dependency_job_id":null,"html_url":"https://github.com/cheap-glitch/mazeru","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheap-glitch%2Fmazeru","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheap-glitch%2Fmazeru/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheap-glitch%2Fmazeru/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheap-glitch%2Fmazeru/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheap-glitch","download_url":"https://codeload.github.com/cheap-glitch/mazeru/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229921605,"owners_count":18144995,"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","deep-merge-object","merge-objects","node-module","typescript-module","utility-function"],"created_at":"2024-10-28T21:27:24.229Z","updated_at":"2024-12-16T07:21:03.058Z","avatar_url":"https://github.com/cheap-glitch.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Mazeru, written in Japanase characters filled with blue and red swirls of paint.](docs/logo-small.png)\n\n[![License](https://shields.io/github/license/cheap-glitch/mazeru)](LICENSE)\n[![Latest release](https://shields.io/github/v/release/cheap-glitch/mazeru?sort=semver\u0026label=latest%20release\u0026color=green)](https://github.com/cheap-glitch/mazeru/releases/latest)\n[![Coverage status](https://shields.io/coveralls/github/cheap-glitch/mazeru)](https://coveralls.io/github/cheap-glitch/mazeru)\n\n**mazeru** ([混ぜる](https://jisho.org/word/%E6%B7%B7%E3%81%9C%E3%82%8B))\nis a deep merging utility module, aimed at JSON-compatible arrays and objects.\n\n## Features\n\n * Merge complex nested objects \u0026 arrays\n * Allow/exclude/filter keys\n * Several merge strategies for arrays (replace, append, etc.)\n * Doesn't break on cyclic references\n * Written in TypeScript and well-tested\n\n## Installation\n\n```\nnpm i mazeru\n```\n\n## Usage\n\n```javascript\nconst merge = require('mazeru');\n\nmerge({\n\tfoo: true,\n\tbar: { a: 'foo', b: [0, 1] },\n}, {\n\tbar: { a: 'bar', b: [2, 3, 4, 5], c: false },\n\tbaz: [],\n}, {\n\tarrays: 'append',\n\texcludeKeys: ['baz', 'c'],\n});\n\n// \tfoo: true,\n// \tbar: { a: 'bar', b: [0, 1, 2, 3, 4, 5] },\n```\n\n## API\n\n### merge(base: JsonValue, mixed: JsonValue, options?: MergeOptions): JsonValue\n\nMerge `mixed` into `base`.\n\nIf at least one of the passed value is a primitive, the return value will simply\nbe `mixed`.\n\nIf both  are arrays, the  return value will depend  on the `arrays`  option (see\nbelow for more infos).\n\nFinally, if both are objects, they will be merged recursively. In the case of as\nconflict between two keys at the same level with the same name, the value of the\nkey in `mixed` will always prevail.\n\n### Options\n\n#### `arrays`: replace | append | concat | merge\n\nDefault: `replace`\n\nThe strategy used to handle two conflicting arrays:\n * `replace` (default): simply replace the first array with the second one\n * `append`, `concat`: append the second array to the first one\n * `merge`: merge each pair of matching  items, adding any excess items at the\n end  (this  is  only  really  useful  when the  items  are  arrays  or  objects\n themselves)\n\n#### `onlyCommonKeys`: boolean\n\nDefault: `false`\n\nOnly keep the keys that present in  both objects. This applies to nested objects\nas well.\n\n#### `excludeKeys`: string[]\n\nDefault: `[]`\n\nExclude the listed keys from the resulting merged object.\n\n#### `allowKeys`: string[]\n\nDefault: `undefined`\n\nOnly allow the listed keys in the resulting merged object.\n\n#### `keysFilter`: (key: string, baseValue?: JsonValue, mixedValue?: JsonValue) =\u003e boolean\n\nDefault: `() =\u003e true`\n\nFilter keys in the resulting merged object using the provided sieve.\n\n## Changelog\n\nSee the full changelog [here](https://github.com/cheap-glitch/mazeru/releases).\n\n## Contributing\n\nContributions are welcomed! Please open an issue before submitting substantial changes.\n\n## Related\n\n * [`deepmerge`](https://github.com/TehShrike/deepmerge) – A library for deep (recursive) merging of JavaScript objects\n * [`deepmerge-ts`](https://github.com/RebeccaStevens/deepmerge-ts) – Deeply merge 2 or more objects respecting type information\n * [`flatted`](https://github.com/WebReflection/flatted) – Fast and minimal circular JSON parser\n\n## License\n\nISC\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheap-glitch%2Fmazeru","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheap-glitch%2Fmazeru","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheap-glitch%2Fmazeru/lists"}