{"id":13808588,"url":"https://github.com/validointi/validointi","last_synced_at":"2025-05-14T02:32:08.233Z","repository":{"id":39603371,"uuid":"496983055","full_name":"validointi/validointi","owner":"validointi","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-26T11:31:50.000Z","size":2680,"stargazers_count":24,"open_issues_count":2,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-02T13:05:46.195Z","etag":null,"topics":["angular"],"latest_commit_sha":null,"homepage":"https://validointi.github.io/","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/validointi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2022-05-27T12:10:56.000Z","updated_at":"2025-01-26T11:31:32.000Z","dependencies_parsed_at":"2024-03-02T08:27:21.555Z","dependency_job_id":"c9c13507-bea8-4e81-86e1-50c52a10ab5e","html_url":"https://github.com/validointi/validointi","commit_stats":{"total_commits":135,"total_committers":6,"mean_commits":22.5,"dds":0.6370370370370371,"last_synced_commit":"d38c5e1c39812fd80cb1fe638d2b2fe1a1115e45"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/validointi%2Fvalidointi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/validointi%2Fvalidointi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/validointi%2Fvalidointi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/validointi%2Fvalidointi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/validointi","download_url":"https://codeload.github.com/validointi/validointi/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253929358,"owners_count":21985802,"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":["angular"],"created_at":"2024-08-04T01:01:46.885Z","updated_at":"2025-05-14T02:32:03.664Z","avatar_url":"https://github.com/validointi.png","language":"TypeScript","readme":"\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\n# Validointi\n\n![logo](assets/logo.ico)\n\n## We finsish the validation debate\n\n# @validointi/core\n\nThis is a library to help you validate your template driven forms.\n\n## Installation\n\nTo install this library, run:\n\n```bash\n$ npm install @validointi/core --save\n```\n\n## Using it in your project.\n\nYou can use this library by importing the directives and services in the components you want to use them in.\n\nFirst you register your validation function to the service like this:\n\n```ts\n#vr = inject(ValidatorRegistryService);\n\nvalidate = this.#vr.registerValidator('sample-data', validateSampleData);\n```\n\na validation function can look like this:\n\n```ts\nasync function validateSampleData(data: SampleData, field?: string): Promise\u003cValidationErrors\u003e {\n  /**\n   * In here we use Vest to validate the data.\n   * However, you can validate the data however you want.\n   */\n  const errors = await suite(data, field).getErrors();\n  return Object.entries(errors).reduce((acc, [key, err]) =\u003e {\n    acc[key] = err;\n    return acc;\n  }, {} as ValidationErrors);\n}\n```\n\n\u003e **_Pro Tip:_** When you use vest, you can use the `createVestAdapter(suite)` function to create a validation function that can be used with this library.\n\u003e\n\u003e ```ts\n\u003e validate = this.#vr.registerValidator('sample-data', createVestAdapter(suite));\n\u003e ```\n\u003e\n\u003e will make sure the vest results are formatted correctly for this library.\n\nThe only restriction is that the function must return a Promise\u003c[ValidationErrors](https://github.com/validointi/validointi/blob/03249cb8d516bf88a638e30fba12a7d2783eb37c/projects/validointi/core/src/lib/validator.types.ts#L10-L12)\u003e.\n\nAfter that you can use the directive in your template like this:\n\n```html\n\u003cform validationId=\"sample-data\" (ngSubmit)=\"mySubmitFunction($any(data))\" #form=\"ngForm\"\u003e\n  \u003clabel for=\"name\"\u003e\n    \u003cspan\u003eName\u003c/span\u003e\n    \u003cinput type=\"text\" name=\"name\" placeholder=\"Your name\" [(ngModel)]=\"data.name\" /\u003e\n  \u003c/label\u003e\n  \u003cinput type=\"submit\" value=\"Submit\" [disabled]=\"form.invalid\" /\u003e\n\u003c/form\u003e\n```\n\nFrom this point the form will be validated on `formControl.valueChanges` and errors coming from the function will be set on the corresponding formControl.\n\n## Contributors\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://jefiozie.github.io/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/17835373?v=4?s=100\" width=\"100px;\" alt=\"Jeffrey Bosch\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJeffrey Bosch\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/validointi/validointi/commits?author=Jefiozie\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/validointi/validointi/commits?author=Jefiozie\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#example-Jefiozie\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"#tool-Jefiozie\" title=\"Tools\"\u003e🔧\u003c/a\u003e \u003ca href=\"#maintenance-Jefiozie\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/SanderElias\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/1249083?v=4?s=100\" width=\"100px;\" alt=\"Sander Elias\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eSander Elias\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/validointi/validointi/commits?author=SanderElias\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/validointi/validointi/commits?author=SanderElias\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#example-SanderElias\" title=\"Examples\"\u003e💡\u003c/a\u003e \u003ca href=\"#maintenance-SanderElias\" title=\"Maintenance\"\u003e🚧\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n","funding_links":[],"categories":["Third Party Components"],"sub_categories":["Form Validation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalidointi%2Fvalidointi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalidointi%2Fvalidointi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalidointi%2Fvalidointi/lists"}