---
agentTools:
  projectIndex: https://x-tag.readme.io/llms.txt
---

# xtag.merge

Recursively copies all values from one object to another, overwriting properties that collide.

\##`xtag.merge(IMPORTING_OBJECT, EXPORTING_OBJECT)`

[block:parameters]
{
  "data": {
    "h-0": "Arguments",
    "h-1": "Type",
    "h-2": "Description",
    "0-0": "IMPORTING_OBJECT",
    "0-1": "Object",
    "1-0": "EXPORTING_OBJECT",
    "1-1": "Object",
    "0-2": "The object that is having properties merged into it from the exporting object",
    "1-2": "The object whose keys and values are being recursively added to the importing object."
  },
  "cols": 3,
  "rows": 2
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "var foo = { one: 1, two: { value: 2 } };\nvar bar = { two: { value: 'two' }, three: 3 };\n\nxtag.merge(foo, bar); // returns { one: 1, two: { value: 'two' }, three: 3 }",
      "language": "javascript"
    }
  ]
}
[/block]