{"_id":"@3-/merge","_rev":"2-80703f36c8ec8f1fe5303122fa51d953","name":"@3-/merge","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.1":{"name":"@3-/merge","version":"0.1.1","author":{"name":"i18n.site@gmail.com"},"license":"Apache-2.0","_id":"@3-/merge@0.1.1","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"homepage":"https://atomgit.com/i18n/lib/tree/dev/merge","dist":{"shasum":"a080273e8379997185ec8ca49c33b68b111b48d4","tarball":"https://registry.npmjs.org/@3-/merge/-/merge-0.1.1.tgz","fileCount":3,"integrity":"sha512-g1slmyS+rUUkKprqoyRP45c2AghHV7d2NzeAtIWWHy/LFt4AkD5DnhTDYGUpp1HyYqTU9HrbXYJIGIC+whve4g==","signatures":[{"sig":"MEQCIDslGUcvL9+6smJiAXwHp9Cg1gPXN6lcMW+DDVT9um5bAiBhno5P6G8bKmijDAry3ME9Qtv53cIUcviRaAFaGDH9OA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3745},"type":"module","_from":"file:3--merge-0.1.1.tgz","exports":{".":"./lib.js","./*":"./*"},"scripts":{},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"_resolved":"/private/var/folders/4x/n5x1dwrj39v_hl53vyprqcn80000gn/T/fd3274da1a983e65d9add211fdf0a0d4/3--merge-0.1.1.tgz","_integrity":"sha512-g1slmyS+rUUkKprqoyRP45c2AghHV7d2NzeAtIWWHy/LFt4AkD5DnhTDYGUpp1HyYqTU9HrbXYJIGIC+whve4g==","repository":{"url":"git+https://atomgit.com/i18n/lib.git","type":"git"},"_npmVersion":"11.4.2","description":"Deeply merges one or more source objects into a target object.","directories":{},"_nodeVersion":"24.3.0","_hasShrinkwrap":false,"devDependencies":{},"_npmOperationalInternal":{"tmp":"tmp/merge_0.1.1_1754024437701_0.05734723283498777","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@3-/merge","version":"0.1.2","repository":{"type":"git","url":"git+https://atomgit.com/i18n/lib.git"},"homepage":"https://atomgit.com/i18n/lib/tree/dev/merge","author":{"name":"i18n.site@gmail.com"},"license":"Apache-2.0","exports":{".":"./lib.js","./*":"./*"},"devDependencies":{},"type":"module","scripts":{},"_id":"@3-/merge@0.1.2","description":"[English](#english-readme) | [中文说明](#中文说明)","_integrity":"sha512-cE+sVJ6TFsHuOFvILkySzrOqLKUPSXfuai7IR18LuYEkUDAN+z5swwxRbcOoFaS5vrO2+ZXCLsJjaCb4oMc+1g==","_resolved":"/private/var/folders/4x/n5x1dwrj39v_hl53vyprqcn80000gn/T/64fcb7a85b56f1c5a93b949ec8c0244c/3--merge-0.1.2.tgz","_from":"file:3--merge-0.1.2.tgz","_nodeVersion":"24.3.0","_npmVersion":"11.4.2","dist":{"integrity":"sha512-cE+sVJ6TFsHuOFvILkySzrOqLKUPSXfuai7IR18LuYEkUDAN+z5swwxRbcOoFaS5vrO2+ZXCLsJjaCb4oMc+1g==","shasum":"564e5a7eb11de84b78ba2549778d8632da62d474","tarball":"https://registry.npmjs.org/@3-/merge/-/merge-0.1.2.tgz","fileCount":3,"unpackedSize":3833,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFqW/YPaQXe5rO5FMVg2iwYQ7EUAN2AzbE6KrU8BUEckAiEAqs4n5Nu7v2th6XDwAWYwmIagovVgXj1FNVDKNtVQvIk="}]},"_npmUser":{"name":"i18n-now","email":"i18n.site@gmail.com"},"directories":{},"maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/merge_0.1.2_1754024748854_0.3036416465854226"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-01T05:00:37.611Z","modified":"2025-08-01T05:05:49.232Z","0.1.1":"2025-08-01T05:00:37.888Z","0.1.2":"2025-08-01T05:05:49.019Z"},"author":{"name":"i18n.site@gmail.com"},"license":"Apache-2.0","homepage":"https://atomgit.com/i18n/lib/tree/dev/merge","repository":{"type":"git","url":"git+https://atomgit.com/i18n/lib.git"},"description":"[English](#english-readme) | [中文说明](#中文说明)","maintainers":[{"name":"i18n-now","email":"i18n.site@gmail.com"}],"readme":"# @3-/merge\n\n[English](#english-readme) | [中文说明](#中文说明)\n\n\n## English README\n\nDeeply merges one or more source objects into a target object.\n\n- If a key holds an object in both the target and the source, it recursively merges them.\n- If a key holds an array in both the target and the source, it concatenates the arrays.\n- Otherwise, the value from the source overwrites the value in the target.\n\n[test/main.test.js](./test/main.test.js) :\n\n```javascript\nimport merge from '@3-/merge';\n\nconst target = {\n  a: 1,\n  b: {\n    c: 2,\n    d: [3, 4]\n  }\n};\n\nconst source1 = {\n  b: {\n    d: [5, 6],\n    e: 7\n  },\n  f: 8\n};\n\nconst source2 = {\n  a: 9,\n  b: {\n    c: 10\n  }\n}\n\nconst result = merge({}, target, source1, source2);\n\nconsole.log(JSON.stringify(result, null, 2));\n```\n\noutput:\n\n```json\n{\n  \"a\": 9,\n  \"b\": {\n    \"c\": 10,\n    \"d\": [\n      3,\n      4,\n      5,\n      6\n    ],\n    \"e\": 7\n  },\n  \"f\": 8\n}\n```\n\n## 中文说明\n\n`@3-/merge` 深度合并一个或多个源对象到目标对象。\n\n- 如果目标和源中的同一个键的值都是对象，它将递归合并它们。\n- 如果目标和源中的同一个键的值都是数组，它将连接这两个数组。\n- 在其他情况下，源中的值将覆盖目标中的值。\n\n[test/main.test.js](./test/main.test.js) :\n\n```javascript\nimport merge from '@3-/merge';\n\nconst target = {\n  a: 1,\n  b: {\n    c: 2,\n    d: [3, 4]\n  }\n};\n\nconst source1 = {\n  b: {\n    d: [5, 6],\n    e: 7\n  },\n  f: 8\n};\n\nconst source2 = {\n  a: 9,\n  b: {\n    c: 10\n  }\n}\n\nconst result = merge({}, target, source1, source2);\n\nconsole.log(JSON.stringify(result, null, 2));\n```\n\n输出:\n\n```json\n{\n  \"a\": 9,\n  \"b\": {\n    \"c\": 10,\n    \"d\": [\n      3,\n      4,\n      5,\n      6\n    ],\n    \"e\": 7\n  },\n  \"f\": 8\n}\n```\n\n---\n\n## About\n\nThis project is an open-source component of [i18n.site ⋅ Internationalization Solution](https://i18n.site).\n\n* [i18 : MarkDown Command Line Translation Tool](https://i18n.site/i18)\n\n  The translation perfectly maintains the Markdown format.\n\n  It recognizes file changes and only translates the modified files.\n\n  The translated Markdown content is editable; if you modify the original text and translate it again, manually edited translations will not be overwritten (as long as the original text has not been changed).\n\n* [i18n.site : MarkDown Multi-language Static Site Generator](https://i18n.site/i18n.site)\n\n  Optimized for a better reading experience\n\n## 关于\n\n本项目为 [i18n.site ⋅ 国际化解决方案](https://i18n.site) 的开源组件。\n\n* [i18 :  MarkDown命令行翻译工具](https://i18n.site/i18)\n\n  翻译能够完美保持 Markdown 的格式。能识别文件的修改，仅翻译有变动的文件。\n\n  Markdown 翻译内容可编辑；如果你修改原文并再次机器翻译，手动修改过的翻译不会被覆盖（如果这段原文没有被修改）。\n\n* [i18n.site : MarkDown多语言静态站点生成器](https://i18n.site/i18n.site) 为阅读体验而优化。\n","readmeFilename":"README.md"}