{"id":16836685,"url":"https://github.com/jaredreich/tread","last_synced_at":"2025-04-11T05:12:27.979Z","repository":{"id":57141379,"uuid":"64607787","full_name":"jaredreich/tread","owner":"jaredreich","description":"👣 update an object with another object containing just the new key-value pairs. Objects can be infinitely nested, perfect for updating with PUT requests in your REST API","archived":false,"fork":false,"pushed_at":"2017-03-19T13:56:44.000Z","size":5,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T03:13:19.265Z","etag":null,"topics":["deep","javascript","nested","object","objects","recursive","update"],"latest_commit_sha":null,"homepage":"","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/jaredreich.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":"2016-07-31T18:03:04.000Z","updated_at":"2023-10-21T18:00:12.000Z","dependencies_parsed_at":"2022-09-19T08:01:05.999Z","dependency_job_id":null,"html_url":"https://github.com/jaredreich/tread","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredreich%2Ftread","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredreich%2Ftread/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredreich%2Ftread/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaredreich%2Ftread/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaredreich","download_url":"https://codeload.github.com/jaredreich/tread/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247916887,"owners_count":21017795,"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":["deep","javascript","nested","object","objects","recursive","update"],"created_at":"2024-10-13T12:14:26.441Z","updated_at":"2025-04-11T05:12:27.959Z","avatar_url":"https://github.com/jaredreich.png","language":"JavaScript","readme":"## Installation\n\n``` bash\nnpm install --save tread\n```\n\n## Usage\n\n```javascript\n// user from your database\nvar user = {\n  details: {\n    name: {\n      first: 'Jane',\n      last: 'Smith'\n    },\n    address: {\n      street: {\n        number: '5',\n        name: 'Oak Lane'\n      },\n      coordinates: {\n        lat: 50,\n        lng: 50\n      }\n    }\n  },\n  gender: 'm'\n}\n\n// userUpdates from your PUT request\nvar userUpdates = {\n  details: {\n    name: {\n      first: 'John'\n    },\n    address: {\n      coordinates: {\n        lat: 100\n      }\n    }\n  }\n}\n\n// perform the update\nuser = tread(user, userUpdates, strict)\n\n// save the updated user in the database\nuser.save(...)\n```\n\n#### Strict mode\n\nstrict (Boolean, default = false): only updates object if the key already existed.\nFor example:\n```javascript\ntread({ name: 'Jane' }, { name: 'John', age: 20 }, true)\n// outputs\n{ name: 'John' }\n\ntread({ name: 'Jane' }, { name: 'John', age: 20 }, false)\n// OR\ntread({ name: 'Jane' }, { name: 'John', age: 20 })\n// outputs\n{ name: 'John', age: 20 }\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredreich%2Ftread","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaredreich%2Ftread","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaredreich%2Ftread/lists"}