{"id":19757156,"url":"https://github.com/lyst/updated-obj-diff","last_synced_at":"2026-06-14T05:32:09.621Z","repository":{"id":45306960,"uuid":"321989440","full_name":"lyst/updated-obj-diff","owner":"lyst","description":null,"archived":false,"fork":false,"pushed_at":"2021-12-22T16:38:58.000Z","size":65,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T18:22:34.625Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lyst.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":"2020-12-16T13:22:56.000Z","updated_at":"2021-12-22T15:30:14.000Z","dependencies_parsed_at":"2022-09-26T16:22:26.048Z","dependency_job_id":null,"html_url":"https://github.com/lyst/updated-obj-diff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lyst/updated-obj-diff","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyst%2Fupdated-obj-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyst%2Fupdated-obj-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyst%2Fupdated-obj-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyst%2Fupdated-obj-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyst","download_url":"https://codeload.github.com/lyst/updated-obj-diff/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyst%2Fupdated-obj-diff/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34310801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-12T03:18:16.218Z","updated_at":"2026-06-14T05:32:09.606Z","avatar_url":"https://github.com/lyst.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# updated-obj-diff\n\nA small JavaScript library that returns the updated difference between two JavaScript objects, including nested objects.\n\nFeatures:\n\n- Handles values of data types including arrays, strings and integers\n- Handles situations where keys are not present in both objects\n- Omits keys with null values in both objects\n- Returns whole array values of keys in updated objects\n\n## Installation\n\n```\nnpm install updated-obj-diff\n```\n\n## Usage\n\nReturns top-level and nested updated values\n\n```javascript\nconst updatedDiff = require(\"updated-obj-diff\");\n\nconst pokemon1 = {\n  species: \"pikachu\",\n  type: \"electric\",\n  measurements: {\n    height: {\n      measurement: 0.4,\n      unit: \"m\",\n    },\n    weight: {\n      measurement: 6,\n      unit: \"kg\",\n    },\n  },\n};\nconst pokemon2 = {\n  species: \"raichu\",\n  type: \"electric\",\n  measurements: {\n    height: {\n      measurement: 31,\n      unit: \"in\",\n    },\n    weight: {\n      measurement: 30,\n      unit: \"kg\",\n    },\n  },\n};\n\nconsole.log(updatedDiff(pokemon1, pokemon2));\n/*\n{\n  species: \"raichu\",\n  measurements: {\n    height: {\n      measurement: 31,\n      unit: \"in\",\n    },\n    weight: {\n      measurement: 30,\n    },\n  },\n};\n*/\n```\n\nReturns whole updated arrays\n\n```javascript\nconst updatedDiff = require(\"updated-obj-diff\");\n\nconst pokemon1 = {\n  species: \"pikachu\",\n  moves: {\n    level_up: [\"quick attack\", \"slam\", \"spark\"],\n    machine: [\"frustration\"],\n  },\n};\nconst pokemon2 = {\n  species: \"raichu\",\n  moves: {\n    level_up: [\"quick attack\"],\n    machine: [\"frustration\", \"giga impact\", \"hyper beam\"],\n  },\n};\n\nconsole.log(updatedDiff(pokemon1, pokemon2));\n/*\n{\n    species: \"raichu\",\n    moves: {\n        level_up: [\"quick attack\"],\n        machine: [\"frustration\", \"giga impact\", \"hyper beam\"],\n    },\n};\n*/\n```\n\nReturns new keys and values\n\n```javascript\nconst updatedDiff = require(\"updated-obj-diff\");\n\nconst pokemon1 = {\n  species: \"pikachu\",\n};\nconst pokemon2 = {\n  species: \"raichu\",\n  thunder_stone: true,\n};\n\nconsole.log(updatedDiff(pokemon1, pokemon2));\n/*\n  {\n    species: \"raichu\",\n    thunder_stone: true,\n  };\n*/\n```\n\nReturns null values for missing keys\n\n```javascript\nconst updatedDiff = require(\"updated-obj-diff\");\n\nconst pokemon1 = {\n  species: \"pikachu\",\n  mascot: true,\n};\nconst pokemon2 = {\n  species: \"raichu\",\n};\n\nconsole.log(updatedDiff(pokemon1, pokemon2));\n/*\n  {\n    species: \"raichu\",\n    mascot: null,\n  };\n*/\n```\n\nReturns null for updated null values that were not previously null\n\n```javascript\nconst updatedDiff = require(\"updated-obj-diff\");\n\nconst pokemon1 = {\n  species: \"pikachu\",\n  dynamax: {\n    gigantamax: true,\n  },\n};\nconst pokemon2 = {\n  species: \"raichu\",\n  dynamax: null,\n};\n\nconsole.log(updatedDiff(pokemon1, pokemon2));\n/*\n  {\n    species: \"raichu\",\n    dynamax: null,\n  };\n*/\n```\n\nOmits keys that have the value of null in one object, and do not exist in the other object\n\n```javascript\nconst updatedDiff = require(\"updated-obj-diff\");\n\nconst pokemon1 = {\n  species: \"pikachu\",\n  old_key: null,\n};\nconst pokemon2 = {\n  species: \"raichu\",\n  new_key: null,\n};\n\nconsole.log(updatedDiff(pokemon1, pokemon2));\n/*\n  {\n    species: \"raichu\",\n  };\n*/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyst%2Fupdated-obj-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyst%2Fupdated-obj-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyst%2Fupdated-obj-diff/lists"}