{"id":16682579,"url":"https://github.com/jchip/xmerge","last_synced_at":"2025-12-28T21:32:57.769Z","repository":{"id":66137431,"uuid":"199550380","full_name":"jchip/xmerge","owner":"jchip","description":null,"archived":false,"fork":false,"pushed_at":"2019-07-30T01:19:53.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T07:25:24.772Z","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/jchip.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-07-30T01:18:13.000Z","updated_at":"2019-07-30T01:19:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"d32fd2c2-3a6f-4dc7-9e05-263359415562","html_url":"https://github.com/jchip/xmerge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fxmerge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fxmerge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fxmerge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jchip%2Fxmerge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jchip","download_url":"https://codeload.github.com/jchip/xmerge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243392326,"owners_count":20283565,"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-10-12T14:07:59.878Z","updated_at":"2025-12-28T21:32:52.738Z","avatar_url":"https://github.com/jchip.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Extended JSON Merge\n\n- converting ops\n\n  - `arrayify` - convert src and target value to array if they aren't array\n  - `stringify` - convert src and target values to strings\n\n- cmd and mod ops\n\n- `add ascend/descend arrayify` - for array\n- `add pre/post arrayify/stringify` - for string, buffer, typed array, and array\n- `del` - for any type, delete field\n- `xmerge` - for array, run xmerge on elements of two arrays\n- `uniq ascend/descend/pre/post arrayify` - for array (add according to attribute and then unique by value)\n\n- `if-not-exist` - for any type (even `undefined`)\n\n- function\n\n- chain pre/post\n- replace\n- clone pre/post\n\n```js\n{\n  \"cat /~xmerge(add start)\": [ \"hello\" ],\n  \"foo /~xmerge(add ascend arrayify)\": [ 90 ],\n  \"bar /~xmerge(add start stringify)\": \"blah\"\n}\n```\n\n## Example\n\n```js\nconst result = xmerge(\n  {},\n  { arr: [50], del: \"hello\", bar: \"oops\" },\n  { \"arr ~@\": [25], \"lit1 ~~\": \"set\" },\n  { \"arr ~+\": [30] },\n  { \"del ~-\": null },\n  { \"foo ~?\": \"default\", \"bar ~?\": \"blah\" }\n);\n\n// =\u003e\n\nresult ===\n  {\n    arr: [25, 50, 30],\n    \"~lit1\": \"set\",\n    foo: \"default\",\n    bar: \"oops\"\n  };\n```\n\n## Default Behaviors\n\n- Array - Append\n- `null` - Delete\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Fxmerge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjchip%2Fxmerge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjchip%2Fxmerge/lists"}