{"id":16701076,"url":"https://github.com/scriptex/dator","last_synced_at":"2025-03-21T19:33:07.096Z","repository":{"id":40831542,"uuid":"45921654","full_name":"scriptex/dator","owner":"scriptex","description":"Frontend forms validator","archived":false,"fork":false,"pushed_at":"2025-03-03T09:03:23.000Z","size":1843,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T04:42:42.996Z","etag":null,"topics":["form-validation","form-validator"],"latest_commit_sha":null,"homepage":"https://dator.atanas.info","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/scriptex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["scriptex"],"patreon":"atanas","open_collective":null,"ko_fi":"scriptex","tidelift":null,"community_bridge":null,"liberapay":"scriptex","issuehunt":"scriptex","otechie":null,"custom":["paypal.me/scriptex","revolut.me/scriptex"]}},"created_at":"2015-11-10T15:38:48.000Z","updated_at":"2025-03-03T09:03:21.000Z","dependencies_parsed_at":"2024-02-19T17:15:15.332Z","dependency_job_id":"ff54443b-b1f8-4895-8e09-5f43ab26b700","html_url":"https://github.com/scriptex/dator","commit_stats":{"total_commits":472,"total_committers":9,"mean_commits":52.44444444444444,"dds":"0.38983050847457623","last_synced_commit":"9cea58073dc6b4d7bff28935011dafd67c041003"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptex%2Fdator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptex%2Fdator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptex%2Fdator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scriptex%2Fdator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scriptex","download_url":"https://codeload.github.com/scriptex/dator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244855704,"owners_count":20521687,"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":["form-validation","form-validator"],"created_at":"2024-10-12T18:28:28.543Z","updated_at":"2025-03-21T19:33:06.626Z","avatar_url":"https://github.com/scriptex.png","language":"TypeScript","readme":"[![Travis CI](https://travis-ci.com/scriptex/dator.svg?branch=master)](https://travis-ci.com/scriptex/dator)\n[![Github Build](https://github.com/scriptex/dator/workflows/Build/badge.svg)](https://github.com/scriptex/dator/actions?query=workflow%3ABuild)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/34d3d75710534dc6a38c3584a1dcd068)](https://www.codacy.com/gh/scriptex/dator/dashboard?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=scriptex/dator\u0026utm_campaign=Badge_Grade)\n[![Codebeat Badge](https://codebeat.co/badges/d765a4c8-2c0e-44f2-89c3-fa364fdc14e6)](https://codebeat.co/projects/github-com-scriptex-dator-master)\n[![CodeFactor Badge](https://www.codefactor.io/repository/github/scriptex/dator/badge)](https://www.codefactor.io/repository/github/scriptex/dator)\n[![DeepScan grade](https://deepscan.io/api/teams/3574/projects/5257/branches/40799/badge/grade.svg)](https://deepscan.io/dashboard#view=project\u0026tid=3574\u0026pid=5257\u0026bid=40799)\n[![Analytics](https://ga-beacon-361907.ew.r.appspot.com/UA-83446952-1/github.com/scriptex/dator/README.md?pixel)](https://github.com/scriptex/dator/)\n\n# Dator. Vali-Dator\n\n\u003e Intuitive frontend forms validator based on HTML5 attributes and a tiny bit of JavaScript.\n\n## Visitor stats\n\n![GitHub stars](https://img.shields.io/github/stars/scriptex/dator?style=social)\n![GitHub forks](https://img.shields.io/github/forks/scriptex/dator?style=social)\n![GitHub watchers](https://img.shields.io/github/watchers/scriptex/dator?style=social)\n![GitHub followers](https://img.shields.io/github/followers/scriptex?style=social)\n\n## Code stats\n\n![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/scriptex/dator)\n![GitHub repo size](https://img.shields.io/github/repo-size/scriptex/dator?style=plastic)\n![GitHub language count](https://img.shields.io/github/languages/count/scriptex/dator?style=plastic)\n![GitHub top language](https://img.shields.io/github/languages/top/scriptex/dator?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/scriptex/dator?style=plastic)\n\n## About\n\nThere are a lot of form validators out there. This one aims at intuitive API and relies on extensive usage of HTML data-\\* attributes.\nIt's important to note that in order to use the validation, the `required` attribute must be present on your HTML element.\n\n## Demo\n\n[Here](https://dator.atanas.info) is a demo showing how to use the validator and all built-in validation types:\n\n## Install\n\n```sh\nnpm i dator\n\n# or\n\nyarn add dator\n```\n\nor include it from unpkg.com\n\n```html\n\u003cscript src=\"https://unpkg.com/dator\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nIn your JavaScript file:\n\n```javascript\nimport { Validator } from 'dator';\n\nconst myForm = document.querySelector('form');\nconst datorSettings = {}; // see below for more details\nconst datorCustomTypes = {}; // see below for more details\n\nconst formValidator = new Dator(myForm, datorSettings, datorCustomTypes);\n```\n\nIn your HTML file:\n\n```html\n\u003cinput type=\"text\" name=\"full-name\" required data-validate=\"name\" /\u003e\n```\n\nThe constuctor accepts three arguments:\n\n1. DOM element for the form that needs to be validated (Required)\n2. Object with settings (Optional) - more below\n3. Object with custom validation types - more below\n\n## Settings\n\n```javascript\n// These are the settings and their default values\nconst datorSettings = {\n\tvalidClass: 'is--valid', // The CSS classname that will be added to a valid form element\n\terrorClass: 'is--invalid', // The CSS classname that will be added to an invalid form element\n\tvalidatedClass: 'is--validated', // The CSS classname that will be added to the validated form\n\twatch: true, // If the validation should be applied \"as-you-type\"\n\tclassHolder: null, // The CSS classname of the element that should receive the `validClass` and `invalidClass`\n\tbeforeValidate: null, // A function to run before the actual form submission\n\tonSubmit: null, // A function to run during the actual form submission\n\tafterValidate: null // A function to run after the actual form submission\n};\n```\n\n## Validation types\n\nThere are several built-in validation types:\n\n-   name\n-   zip\n-   presence\n-   email\n-   phone\n-   address\n-   integer\n-   float\n-   credit-card\n-   cvc\n\nAll of these validation types represent a regular expression which is used to test the value of the form element against to.\n\nIn order to add more validatior types, use the third constructor argument as shown above.\n\nFor example, if you need to add a new `zip` type:\n\n```javascript\nconst datorCustomTypes = {\n\tzip: /^\\d{4}$/ // Change from 5 digits to 4 digits\n};\n```\n\n## LICENSE\n\nMIT\n\n---\n\n\u003cdiv align=\"center\"\u003e\n    Connect with me:\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://atanas.info\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/logo.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"mailto:hi@atanas.info\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/email.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://www.linkedin.com/in/scriptex/\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/linkedin.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://github.com/scriptex\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/github.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://gitlab.com/scriptex\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/gitlab.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://twitter.com/scriptexbg\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/twitter.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://www.npmjs.com/~scriptex\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/npm.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://www.youtube.com/user/scriptex\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/youtube.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://stackoverflow.com/users/4140082/atanas-atanasov\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/stackoverflow.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://codepen.io/scriptex/\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/codepen.svg\" width=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://profile.codersrank.io/user/scriptex\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/codersrank.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u0026nbsp;\n    \u003ca href=\"https://linktr.ee/scriptex\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/scriptex/socials/master/styled-assets/linktree.svg\" height=\"20\" alt=\"\"\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n---\n\n\u003cdiv align=\"center\"\u003e\nSupport and sponsor my work:\n\u003cbr /\u003e\n\u003cbr /\u003e\n\u003ca href=\"https://twitter.com/intent/tweet?text=Checkout%20this%20awesome%20developer%20profile%3A\u0026url=https%3A%2F%2Fgithub.com%2Fscriptex\u0026via=scriptexbg\u0026hashtags=software%2Cgithub%2Ccode%2Cawesome\" title=\"Tweet\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Tweet-Share_my_profile-blue.svg?logo=twitter\u0026color=38A1F3\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://paypal.me/scriptex\" title=\"Donate on Paypal\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Donate-Support_me_on_PayPal-blue.svg?logo=paypal\u0026color=222d65\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://revolut.me/scriptex\" title=\"Donate on Revolut\"\u003e\n\t\u003cimg src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/revolut.json\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://patreon.com/atanas\" title=\"Become a Patron\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Become_Patron-Support_me_on_Patreon-blue.svg?logo=patreon\u0026color=e64413\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://ko-fi.com/scriptex\" title=\"Buy Me A Coffee\"\u003e\n\t\u003cimg src=\"https://img.shields.io/badge/Donate-Buy%20me%20a%20coffee-yellow.svg?logo=ko-fi\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://liberapay.com/scriptex/donate\" title=\"Donate on Liberapay\"\u003e\n\t\u003cimg src=\"https://img.shields.io/liberapay/receives/scriptex?label=Donate%20on%20Liberapay\u0026logo=liberapay\" /\u003e\n\u003c/a\u003e\n\n\u003ca href=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/bitcoin.json\" title=\"Donate Bitcoin\"\u003e\n\t\u003cimg src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/bitcoin.json\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/etherium.json\" title=\"Donate Etherium\"\u003e\n\t\u003cimg src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/etherium.json\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/shiba-inu.json\" title=\"Donate Shiba Inu\"\u003e\n\t\u003cimg src=\"https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/scriptex/scriptex/master/badges/shiba-inu.json\" /\u003e\n\u003c/a\u003e\n\u003c/div\u003e\n","funding_links":["https://github.com/sponsors/scriptex","https://patreon.com/atanas","https://ko-fi.com/scriptex","https://liberapay.com/scriptex","https://issuehunt.io/r/scriptex","paypal.me/scriptex","revolut.me/scriptex","https://paypal.me/scriptex","https://liberapay.com/scriptex/donate"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptex%2Fdator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscriptex%2Fdator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscriptex%2Fdator/lists"}