{"id":16867489,"url":"https://github.com/bodinsamuel/altheia","last_synced_at":"2025-03-22T07:30:50.109Z","repository":{"id":28866544,"uuid":"119565617","full_name":"bodinsamuel/altheia","owner":"bodinsamuel","description":"A very simple, fast and customizable async data validator","archived":true,"fork":false,"pushed_at":"2023-10-17T07:07:26.000Z","size":6523,"stargazers_count":10,"open_issues_count":9,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-03T04:47:17.516Z","etag":null,"topics":["async","async-validation","schema","typescript","validate","validation","validator"],"latest_commit_sha":null,"homepage":"https://bodinsamuel.github.io/altheia/","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/bodinsamuel.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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}},"created_at":"2018-01-30T16:50:32.000Z","updated_at":"2024-11-24T21:44:24.000Z","dependencies_parsed_at":"2024-10-28T12:29:51.974Z","dependency_job_id":null,"html_url":"https://github.com/bodinsamuel/altheia","commit_stats":{"total_commits":392,"total_committers":12,"mean_commits":"32.666666666666664","dds":0.6887755102040816,"last_synced_commit":"dadb590cb3419bdd905c0b395f9baf0474258069"},"previous_names":[],"tags_count":51,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodinsamuel%2Faltheia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodinsamuel%2Faltheia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodinsamuel%2Faltheia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bodinsamuel%2Faltheia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bodinsamuel","download_url":"https://codeload.github.com/bodinsamuel/altheia/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244924935,"owners_count":20532872,"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":["async","async-validation","schema","typescript","validate","validation","validator"],"created_at":"2024-10-13T14:54:31.707Z","updated_at":"2025-03-22T07:30:46.567Z","avatar_url":"https://github.com/bodinsamuel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Altheia\n\n[![CI](https://github.com/bodinsamuel/altheia/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/bodinsamuel/altheia/actions/workflows/ci.yml)\n\nA very simple, fast and customizable async data validator, inspired by Joi .\n\n```javascript\nawait alt\n  .string()\n  .email()\n  .custom('not_in_db', async (val) =\u003e await searchDB(val));\n```\n\nOnline documentation: [github.io/altheia/](https://bodinsamuel.github.io/altheia/)\n\n## 🤓 Why?\n\nAfter searching for a long time a simple data validator that allow async validation, I decided to implement one. Heavily inspired from Joi, it aim at being very lightweight, simple to use and allow to check anything from standard schema to very custom ones.\n\nThe goal of this library is to validate json -- for example in express middleware -- and complexe javascript object.\n\n- 💅 **Easy to customize.** Use builtin or create your own validation.\n- ⚡️**Async.** Call any resources asynchronously to do check your data (e.g: database, xhr...)\n- 🤩 **Typescript.** No more checking long documentation and wondering what to write.\n- 🧘 **Easy to use.** No configuration required\n\n## ✨ Install\n\n```bash\nnpm install altheia-async-data-validator\n```\n\n```sh\nyarn add altheia-async-data-validator\n```\n\n## 🖼 Example\n\n```javascript\nimport alt from 'altheia-async-data-validator'\n\nalt.lang('string.min', (name, args) =\u003e `This ${name} is too short`);\nalt.template('login', alt.string().min(3).not('admin'));\n\nconst errors = await alt({\n    login: alt.is('login'),\n    email: alt.string()\n        .email()\n        .custom('not_in_db', async (val) =\u003e await searchDB(val)),\n    eyes: alt.number().integer().positive().max(2),\n    date: alt.date().iso(),\n    gender: alt.string().if({\n        test: test =\u003e test.uppercase(),\n        then: test =\u003e test.in('F', 'M'),\n        otherwise: test =\u003e test.in('female', 'male')\n    })\n}).options({\n    required: true\n}).validate({\n    login: 'leela',\n    email: 'captain@planetexpress.com',\n    eyes: 1,\n    date: '2015-01-04T17:35:22Z',\n    gender: 'female',\n});\n\nconsole.log(errors); // false\n```\n\n## 📚 Documentation\n\n- Full [Documentation](/docs/)\n- Validator [API](/docs/api.md)\n- [Changelog](../master/CHANGELOG.md)\n\n## 📋 Contributing\n\nEvery contribution or feature requests will be gladly accepted in the issue section.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbodinsamuel%2Faltheia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbodinsamuel%2Faltheia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbodinsamuel%2Faltheia/lists"}