{"id":22428339,"url":"https://github.com/momsfriendlydevco/patch","last_synced_at":"2025-03-27T06:43:37.305Z","repository":{"id":63323103,"uuid":"567033156","full_name":"MomsFriendlyDevCo/Patch","owner":"MomsFriendlyDevCo","description":"Simple object patching","archived":false,"fork":false,"pushed_at":"2022-11-17T00:12:52.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T12:50:55.712Z","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/MomsFriendlyDevCo.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":"2022-11-16T23:33:08.000Z","updated_at":"2022-11-16T23:34:22.000Z","dependencies_parsed_at":"2022-11-17T01:04:52.154Z","dependency_job_id":null,"html_url":"https://github.com/MomsFriendlyDevCo/Patch","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/MomsFriendlyDevCo%2FPatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2FPatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2FPatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MomsFriendlyDevCo%2FPatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MomsFriendlyDevCo","download_url":"https://codeload.github.com/MomsFriendlyDevCo/Patch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245798538,"owners_count":20673901,"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-12-05T20:14:28.844Z","updated_at":"2025-03-27T06:43:37.274Z","avatar_url":"https://github.com/MomsFriendlyDevCo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"@MomsFriendlyDevCo/Patch\n========================\nSimple object patching.\n\nThis module is designed to compare two objects and return the differences between them in a third, patchable, object.\n\n**Features:**\n* Simple, fast, ES6 compatible object patching\n* Arrays are treated as atomic - any change within them copies the entire array\n* Various complex built-in types can be treated as simple scalars (Dates, Sets etc.)\n* Functions for comparison or deep cloning can be customized\n* Does not mutate A or B\n\n\n```javascript\nimport {patch} from '@momsfriendlydevco/patch';\n\nlet a = {\n    foo: 'Foo!',\n    bar: 'Bar!',\n    quz: [1, 2, 3],\n    quark: {one: 1, two: 2},\n    plugh: '123', // Wont be picked up as we're patching A against B\n};\n\nlet b = {\n    foo: 'Foo!',\n    quz: [1, 2, 3, 4],\n    quark: {two: 'two'},\n    flarp: {uno: 1},\n};\n\nconsole.log( patch(a, b) ) //=\nlet c = {\n    quz: [1, 2, 3, 4],\n    quark: {two: 'two'},\n    flarp: {uno: 1},\n}\n```\n\n\nAPI\n===\n\npatch(a, b, options)\n--------------------\nReturn a third, patch, object for the differences of B against A.\n\nOptions can be:\n\n| Option      | Type       | Default                    | Description                                              |\n|-------------|------------|----------------------------|----------------------------------------------------------|\n| `default`   | `*`        | `{}`                       | Value to return if the source object is exactly the same |\n| `scalars`   | `Array`    | `[Buffer, Date, Map, Set]` | Meta objects to treat as a single value                  |\n| `isEqual`   | `Function` | `_.isEqual`                | Equality tester                                          |\n| `cloneDeep` | `Function` | `_.cloneDeep`              | Deep cloner used for arrays                              |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Fpatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmomsfriendlydevco%2Fpatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmomsfriendlydevco%2Fpatch/lists"}