{"id":30843420,"url":"https://github.com/RzoDev/ngx-compare-object","last_synced_at":"2025-09-06T22:02:44.096Z","repository":{"id":311524267,"uuid":"1043945196","full_name":"RzoDev/ngx-compare-object","owner":"RzoDev","description":"An Angular Class tool to compare an initial object with another modified version of self. ","archived":false,"fork":false,"pushed_at":"2025-09-01T05:49:36.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-01T07:44:05.452Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/RzoDev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-25T00:13:55.000Z","updated_at":"2025-08-25T00:25:48.000Z","dependencies_parsed_at":"2025-08-25T03:17:02.404Z","dependency_job_id":"9e04b063-9d9a-42ae-8ce5-94693e6af836","html_url":"https://github.com/RzoDev/ngx-compare-object","commit_stats":null,"previous_names":["rzodev/ngx-compare-object"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/RzoDev/ngx-compare-object","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RzoDev%2Fngx-compare-object","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RzoDev%2Fngx-compare-object/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RzoDev%2Fngx-compare-object/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RzoDev%2Fngx-compare-object/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RzoDev","download_url":"https://codeload.github.com/RzoDev/ngx-compare-object/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RzoDev%2Fngx-compare-object/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273968649,"owners_count":25199651,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"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":"2025-09-06T22:01:11.514Z","updated_at":"2025-09-06T22:02:44.085Z","avatar_url":"https://github.com/RzoDev.png","language":"TypeScript","readme":"# NgxCompareObject [![npm version](https://badge.fury.io/js/ngx-compare-object.svg)](https://badge.fury.io/js/ngx-cam-shoot) [![Build Status](https://api.travis-ci.com/rzodev/ngx-compare-object.svg?branch=main)](https://app.travis-ci.com/github/rzodev/ngx-compare-object) [![Support](https://img.shields.io/badge/Support-Angular%2019%2B-blue.svg?style=flat-square)]() [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/RzoDev/ngx-compare-object/blob/main/LICENSE.md)\n\nAn Angular Class tool to compare an initial object with another modified version of itself.\n\n## Prerequisites\n\n- Angular: `\u003e=19.2.0`\n\n\n## Usage\n\n1. Install via npm\n\n`npm i ngx-compare-object`\n\n2. Import\n\n```typescript\nimport { NgxCompareObject } from 'ngx-compare-object';\n```\n\n3. Usage example\n\n```html\n\u003cform [formGroup]=\"form\"\u003e\n   \u003cdiv\u003e\n      \u003ch2\u003eEdit user\u003c/h2\u003e\n   \u003c/div\u003e\n   \u003cdiv\u003e\n      \u003clabel\u003eFirst name\u003c/label\u003e\n      \u003cinput type=\"text\" formControlName=\"firtname\"\u003e\n   \u003c/div\u003e\n   \u003cdiv\u003e\n      \u003clabel\u003eLast name\u003c/label\u003e\n      \u003cinput type=\"text\" formControlName=\"lastname\"\u003e\n   \u003c/div\u003e\n   \u003cdiv\u003e\n      \u003clabel\u003eEmail\u003c/label\u003e\n      \u003cinput type=\"text\" formControlName=\"email\"\u003e\n   \u003c/div\u003e\n   \u003cdiv\u003e\n      \u003cbutton type=\"button\" [disabled]=\"!hasChanges()\" (click)=\"restore()\"\u003eCancel\u003c/button\u003e\n      \u003cbutton type=\"button\"  [disabled]=\"!hasChanges()\" (click)=\"submitUser()\"\u003eSubmit\u003c/button\u003e\n   \u003c/div\u003e\n\u003c/form\u003e\n```\n\n```typescript\nprivate fb = inject(FormBuilder);\nprivate route = inject(ActivatedRoute);\n\nprivate co!: CompareObject;\nform: FormGroup;\n@Input() id: string;\n\nngOnInit(){\n   if(this.id){\n      this.getInfo(this.id);\n   }\n}\n\nprivate getInfo(id: string){\n   this.http.get('https://example.com/users/'+id)\n   .subcribe((response)=\u003e{\n      this.initForm(response.user);\n   })\n}\n\nprivate initForm(user: IUser){\n   this.form = this.fb.group({\n    firstname: [user.firstname, Validators.required],\n    lastname: [user.lastname, Validators.required],\n    email: [user.email, Validators.required]\n   });\n\n   const originalForm = this.form.value();\n\n   this.co = new CompareObject(originalForm);\n}\n\nhasChanges(): boolean{\n   if(!this.co) return;\n   const form = this.form.value();\n   return !this.co.isSame(form);\n}\nprivate restore(){\n   this.form.reset(this.co.getOriginal());\n}\n\nsubmitUser(){\n   if(this.hasChanges()){\n      //do something\n   }\n}\ncancelSubmit(){\n   this.restore();\n}\n```\n","funding_links":[],"categories":["Development Utilities"],"sub_categories":["Runtime"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRzoDev%2Fngx-compare-object","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRzoDev%2Fngx-compare-object","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRzoDev%2Fngx-compare-object/lists"}