{"id":21073925,"url":"https://github.com/horprogs/just-validate","last_synced_at":"2025-05-14T11:09:31.054Z","repository":{"id":15778323,"uuid":"76297745","full_name":"horprogs/Just-validate","owner":"horprogs","description":"Modern, simple, lightweight (~5kb gzip) form validation library written in Typescript, with no dependencies (no JQuery!). Support a wide range of predefined rules, async, files, dates validation, custom error messages and styles, localization. Support writing custom rules and plugins.","archived":false,"fork":false,"pushed_at":"2025-05-08T07:35:20.000Z","size":2931,"stargazers_count":552,"open_issues_count":51,"forks_count":90,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-05-08T08:34:48.539Z","etag":null,"topics":["async-validation","file-validation","form","form-validation","forms","input","javascript","validation","vanilla-javascript"],"latest_commit_sha":null,"homepage":"https://just-validate.dev/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/horprogs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2016-12-12T21:37:51.000Z","updated_at":"2025-05-05T09:05:14.000Z","dependencies_parsed_at":"2023-01-14T12:38:22.172Z","dependency_job_id":"1a073d57-62c3-4835-90ae-1028b0b376fa","html_url":"https://github.com/horprogs/Just-validate","commit_stats":{"total_commits":274,"total_committers":12,"mean_commits":"22.833333333333332","dds":0.3138686131386861,"last_synced_commit":"100a0a45558f1ed58b3be90f3d94be2b71811516"},"previous_names":[],"tags_count":64,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horprogs%2FJust-validate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horprogs%2FJust-validate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horprogs%2FJust-validate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/horprogs%2FJust-validate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/horprogs","download_url":"https://codeload.github.com/horprogs/Just-validate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254129489,"owners_count":22019628,"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-validation","file-validation","form","form-validation","forms","input","javascript","validation","vanilla-javascript"],"created_at":"2024-11-19T19:13:44.879Z","updated_at":"2025-05-14T11:09:30.990Z","avatar_url":"https://github.com/horprogs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg width=\"1223\" alt=\"Screenshot 2023-01-16 at 23 35 59\" src=\"https://user-images.githubusercontent.com/14051960/212780398-0a2512bc-9584-41b2-af04-8cd8aa99b18c.png\"\u003e\n\n\n[![codecov](https://codecov.io/gh/horprogs/Just-validate/branch/master/graph/badge.svg?token=O6DXXL5TUU)](https://codecov.io/gh/horprogs/Just-validate) \u003ca href=\"https://bundlephobia.com/result?p=just-validate@latest\" target=\"\\_parent\"\u003e \u003cimg alt=\"\" src=\"https://badgen.net/bundlephobia/minzip/just-validate@latest\" /\u003e \u003c/a\u003e\n[![npm](https://img.shields.io/npm/dm/just-validate?style=flat)](https://www.npmjs.org/package/just-validate)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/6c7a25cc9fdb4bf8869884339418352d)](https://www.codacy.com/gh/horprogs/Just-validate/dashboard?utm_source=github.com\\\u0026utm_medium=referral\\\u0026utm_content=horprogs/Just-validate\\\u0026utm_campaign=Badge_Grade)\n[![Known Vulnerabilities](https://snyk.io/test/github/horprogs/Just-validate/badge.svg)](https://snyk.io/test/github/horprogs/Just-validate)\n[![Release workflow](https://github.com/horprogs/Just-validate/workflows/Test%20and%20Release/badge.svg)](https://github.com/horprogs/Just-validate/actions)\n\nModern, simple, lightweight (~5kb gzip) form validation library written in Typescript, with no dependencies (no JQuery!).\nSupport a wide range of predefined rules, async, files, dates validation, custom error messages and styles, localization.\nSupporting writing custom rules and plugins.\n\n## Why JustValidate?\n\nIt's a right choice for you, if you have a site, a landing page without React, JQuery etc.\nand you want to quick, simple and powerful solution for validating your form.\n\n## Features\n\n*   small size and zero dependencies\n*   no need to change your HTML\n*   a wide range of pre-defined rules\n*   custom rules\n*   support plugins\n*   custom styles and css classes for invalid fields and error messages\n*   custom messages\n*   showing tooltips as error messages\n*   custom places for the error labels\n*   localization (defining error messages for different languages)\n*   user-friendly setup: console warning messages if something incorrect\n*   written in Typescript and good test coverage\n\n## Installation\n\n### npm\n\n```shell\nnpm install just-validate --save\n```\n\n### yarn\n\n```shell\nyarn add just-validate\n```\n\nAnd then use it as an imported module:\n\n```js\nimport JustValidate from 'just-validate';\n\nconst validate = new JustValidate('#form');\n```\n\nOr if you don't use module bundlers, just include JustValidate script on your page from CDN and call it as `window.JustValidate`:\n\n```html\n\u003cscript src=\"https://unpkg.com/just-validate@latest/dist/just-validate.production.min.js\"\u003e\u003c/script\u003e\n\u003cbody\u003e\n  \u003cscript\u003e\n    const validate = new window.JustValidate('#form');\n  \u003c/script\u003e\n\u003c/body\u003e\n```\n\n## Predefined rules\n\nThere are plenty of rules which you could use out of the box:\n\n*   required, non-empty fields\n*   valid email address\n*   min/max text length\n*   valid number\n*   min/max number\n*   valid password\n*   valid strong password\n*   check for the custom regexp\n*   min/max count of uploaded files\n*   min/max size, types, extensions, names of uploaded files\n*   format date, check for isAfter/isBefore dates\n\n## Quick start\n\nLet's say we have a basic HTML layout:\n\n```html\n\u003cform action=\"#\" id=\"form\" autocomplete=\"off\"\u003e\n  \u003clabel for=\"name\"\u003eEnter your name\u003c/label\u003e\n  \u003cinput\n    type=\"text\"\n    class=\"form__input form-control\"\n    placeholder=\"Enter your name\"\n    autocomplete=\"off\"\n    name=\"name\"\n    id=\"name\"\n  /\u003e\n  \u003clabel for=\"email\"\u003eEnter your email\u003c/label\u003e\n  \u003cinput\n    type=\"email\"\n    class=\"form__input form-control\"\n    placeholder=\"Enter your email\"\n    autocomplete=\"off\"\n    name=\"email\"\n    id=\"email\"\n  /\u003e\n  \u003cbutton class=\"btn btn-primary\" id=\"submit-btn\"\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n```\n\nNext, let's add JustValidate to our layout and define some simple rules.\n\nFirst, we should create the instance `new JustValidate('#form')` by passing a form selector, or the element as an argument.\n\nSecond, we call `.addField()` with a field selector as the first argument and an array of rules as the second argument.\n\n```js\nconst validation = new JustValidate('#form');\n\nvalidation\n  .addField('#name', [\n    {\n      rule: 'minLength',\n      value: 3,\n    },\n    {\n      rule: 'maxLength',\n      value: 30,\n    },\n  ])\n  .addField('#email', [\n    {\n      rule: 'required',\n      errorMessage: 'Email is required',\n    },\n    {\n      rule: 'email',\n      errorMessage: 'Email is invalid!',\n    },\n  ]);\n```\n\nAnd that's it! Now our form is validated!\n\n## More\n\nPlease, check out the [examples](https://just-validate.dev/examples/) and [documentation](https://just-validate.dev/docs/intro/). Or try the [playground](https://just-validate.dev/playground/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorprogs%2Fjust-validate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhorprogs%2Fjust-validate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhorprogs%2Fjust-validate/lists"}