{"id":16170423,"url":"https://github.com/corentinth/garant","last_synced_at":"2026-01-21T16:35:13.577Z","repository":{"id":46908836,"uuid":"242782608","full_name":"CorentinTh/garant","owner":"CorentinTh","description":"Simple and lightweight javascript object schema validation library.","archived":false,"fork":false,"pushed_at":"2023-01-05T08:21:01.000Z","size":312,"stargazers_count":1,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T20:48:56.989Z","etag":null,"topics":["assert","check","javascript","library","object","type","validation"],"latest_commit_sha":null,"homepage":"","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/CorentinTh.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-24T16:14:50.000Z","updated_at":"2023-09-08T18:03:48.000Z","dependencies_parsed_at":"2023-02-03T20:15:28.791Z","dependency_job_id":null,"html_url":"https://github.com/CorentinTh/garant","commit_stats":null,"previous_names":["corentinth/guarant"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Fgarant","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Fgarant/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Fgarant/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CorentinTh%2Fgarant/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CorentinTh","download_url":"https://codeload.github.com/CorentinTh/garant/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247707796,"owners_count":20982854,"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":["assert","check","javascript","library","object","type","validation"],"created_at":"2024-10-10T03:18:42.899Z","updated_at":"2026-01-21T16:35:13.533Z","avatar_url":"https://github.com/CorentinTh.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/garant\"\u003e\u003cimg alt=\"npm\" src=\"./.github/logo.png\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/CorentinTh/garant/actions\"\u003e\u003cimg src=\"https://github.com/CorentinTh/garant/workflows/Node%20CI/badge.svg\" alt=\"Node CI\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/CorentinTh/bame\"\u003e\u003cimg src=\"https://codecov.io/gh/CorentinTh/bame/branch/master/graph/badge.svg\" alt=\"coverage badge\"/\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/garant\"\u003e\u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/v/garant\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://www.npmjs.com/package/garant\"\u003e\u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dw/garant\"\u003e\u003c/a\u003e\n    \u003ca href=\"LICENSE\"\u003e\u003cimg alt=\"NPM\" src=\"https://img.shields.io/npm/l/garant\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\nSimple and lightweight javascript object schema validation library.\n\n## Description\n\n* **Lightweight**: when bundled with rollup and terser, the output weight less than 2kB (vs ~167kB for [@hapi/joi](https://www.npmjs.com/package/@hapi/joi), 80 times ratio!) \n* **Modular**: easily create new checkers (see [here](#road_map))\n* **Typescript support**\n\n## Installation\n\n**Garant** can be installed using yarn or npm.\n\n```shell\nnpm install garant\n# or\nyarn add garant\n```\n\n## Usage\n```javascript\nimport {Validator} from 'garant';\n// or\nconst {Validator} = require('garant');\n\nconst schema = {\n    username: {\n        type: 'string',\n        required: true\n    },\n    email: {\n        type: 'string',\n    },\n    info: {\n        type: 'object',\n        children:{\n            age: {\n                type: 'number',\n            },\n            height: {\n              type: 'number',\n          }\n        }\n    }   \n};\n\nconst validator = new Validator(schema);\n\nconst object = {\n    username: 'Jane',\n    email: 'jane@example.com',\n    info: {\n        age: 22,\n        height: 165\n    }\n};\n\nconst results = validator.check(object);\n\n// {\n//     hasError: false,\n//     messages: [],\n//     data: {\n//       username: 'Jane',\n//       email: 'jane@example.com',\n//       info: {\n//           age: 22,\n//           height: 165\n//       }\n//     }\n// }\n\n```\n\n## Road map\n\n- ~~**Required** checker~~\n- ~~**Type** checker~~\n- ~~**Children** checker~~\n- ~~**Default** checker (set default value if undefined)~~\n- Improve documentation\n- **Regex** checker\n- **Length** (min, max) checker\n- **Array content** checker\n\nWant to add your *checker*? Simply create yours in the [src/checkers](./src/checkers) directory and register it in the Validator class. Submit your pull request! \n\n## Contribute\n**Pull requests are welcome !** Feel free to contribute.\n\n## Credits\nCoded with ❤️ by [Corentin Thomasset](//corentin-thomasset.fr).\n\n## License\nThis project is under the [MIT license](./LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorentinth%2Fgarant","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcorentinth%2Fgarant","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcorentinth%2Fgarant/lists"}