{"id":14962735,"url":"https://github.com/kamyarlajani/validoz","last_synced_at":"2026-01-19T09:34:16.391Z","repository":{"id":57152951,"uuid":"312811236","full_name":"KamyarLajani/validoz","owner":"KamyarLajani","description":"Client and Server side form validation","archived":false,"fork":false,"pushed_at":"2020-11-16T03:37:29.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-15T07:47:59.222Z","etag":null,"topics":["form-validation","valid","validation","validoz"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KamyarLajani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-14T12:20:01.000Z","updated_at":"2020-11-16T03:44:53.000Z","dependencies_parsed_at":"2022-09-06T20:50:53.294Z","dependency_job_id":null,"html_url":"https://github.com/KamyarLajani/validoz","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KamyarLajani%2Fvalidoz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KamyarLajani%2Fvalidoz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KamyarLajani%2Fvalidoz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KamyarLajani%2Fvalidoz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KamyarLajani","download_url":"https://codeload.github.com/KamyarLajani/validoz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247768258,"owners_count":20992803,"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","valid","validation","validoz"],"created_at":"2024-09-24T13:30:26.404Z","updated_at":"2026-01-19T09:34:16.364Z","avatar_url":"https://github.com/KamyarLajani.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Validoz\n\nValidoz is both Client side and Server side form field validator.\n\n### Installation\n\n```sh\n$ npm install validoz\n```\n##### Or [Download](https://docs.google.com/uc?export=download\u0026id=1K5tfVGaDT2CPgjzm-LsWG0Vu41ItbIpA)\n\n### Sample code\n\n```js\nlet {validoz, isValid} = require('validoz');\nlet fields = [\n    {\n        name: \"Full name\",\n        type: \"fullname\",\n        value: 'John doe'\n    },\n    {\n        name: \"Email address\",\n        type: \"email\",\n        value: 'example@gmail.com'\n    },\n    {\n        name: \"Age\",\n        type: \"number\",\n        value: 12,\n        min: 18,\n    }\n]\nlet result = validoz(fields);\nconsole.log(result); \n/* \nresult: \n[\n    { field: 'Full name', message: '' },\n    { field: 'Email address', message: '' },\n    { field: 'Age', message: 'Age must be at least 18' }\n] */\nconsole.log(isValid(result)); // false\n```\nWhenever a field message value be empty string ('') means no validation error.\nIn the example above we put fields in array and all the fields message shoul be be emptry string '' to isValid() function returns true otherwise it returns false.\n### Single field example\nHere is an example of single object field instead of array of objects.\n```js\nlet {validoz, isValid, isValidByName} = require('validoz');\n\nlet field = {\n    name: \"Full name\",\n    type: \"fullname\",\n    value: 'John doe'\n};\n\nlet result = validoz(field);\nconsole.log(result); // { field: 'Full name', message: '' }\nisValid(result); // true\nisValidByName(result, 'Full name'); // true\n```\n### Types\nHere is the types of field.\n\n| name | Description |\n| ------ | ------ |\n| `text` | Any characters |\n| `password` | String must contain at least one numberic, one upper case, one lower case characters and the length at least 6 characters |\n| `fullname` | String should contain at least 2 words with 3 characters for each of the words and separated by space. It can contain more than one word.|\n| `username` | Like Instagram username. |\n| `word` | Alphabet characters. |\n| `number` | An integer number |\n| `date` | Example `21/03/2020` string. |\n| `time` | Example `05:12` string. |\n\n### Options\n\n| name | Description |\n| ------------- | ------ |\n| `name` | Field name |\n| `value` | Field value |\n| `type` | Field type |\n| `required` | `Boolean`. default: `true` |\n| `min` and `max` | Minumum and Maximum of type number. Each of them can be passed alone. |\n| `minDigits` and `maxDigits` | Minumum and Maximum digits of type number. Each of them can be passed alone. |\n| `minLength` and `maxLength` | Minimum and Maximum length of the string types. |\n| `dateFormat` | String values of `mm/dd/yyyy`, `mm-dd-yyyy`, `dd/mm/yyyy`, `dd-mm-yyyy`, `yyyy/mm/dd` and `yyyy-mm-dd` |\n| `equal` | A field value and equal value to be equal. |\n| `notEqual` | A field value and equal value not to be equal. |\n\n\n\n### Date example\n```js\nlet {validoz, isValid, isValidByName} = require('validoz');\n\nlet field = {\n    name: \"Date\",\n    type: \"date\",\n    value: '24/05/2020',\n    dateFormat: 'dd/mm/yyyy',\n    startDate: '08/02/2020',\n    endDate: '24/05/2020',\n};\n\nlet result = validoz(field);\nconsole.log(result); // { field: 'Date', message: '' }\nisValid(result); // true\nisValidByName(result, 'Date'); // true\n```\n\n### Other example\n\n```js\nlet {validoz, isValid, isValidByName} = require('validoz');\n\nlet {field} = require('./form.js');\nlet result = validoz(field);\nconsole.log(result); \n/*\nReturns: \n[\n  { field: 'Full name', message: '' },\n  { field: 'Email address', message: 'Email address is invalid' },\n  { field: 'Age', message: 'Age must be between 18 and 60' },\n  { field: 'Best friend', message: 'Best friend value is wrong' },\n  {\n    field: 'Password',\n    message: 'Password must contain at least one numberic, one upper case, one lower case characters and the length at least 6 characters'\n  }\n]\n*/\nisValid(result); // false\nisValid(result); // false\nisValid(result[0]); // \"Full name\", true\nisValidByName(result, 'Full name'); // true\nisValidByName(result, 'Email address'); // false\nisValidByName(result, 'Password'); // false\n```\n\n```js\n// form.js file\nexport let field = [\n    {\n        name: \"Full name\",\n        type: \"text\",\n        value: 'Hello world',\n        minLength: 6\n    },\n    {\n        name: \"Email address\",\n        type: \"email\",\n        value: 'example@.com'\n    },\n    {\n        name: \"Age\",\n        type: \"number\",\n        value: 12,\n        min: 18,\n        max: 60,\n    },\n    {\n        name: \"Best friend\",\n        type: \"text\",\n        value: 'Doe',\n        equal: 'John' // value must be John\n    },\n    {\n        name: \"Password\",\n        type: \"password\", // you can also pass text if you don't want regex pattern to be conditioned\n        value: '123456',\n        minLength: 6,\n        maxLength: 30,\n    }\n];\n```\n### Author\nKamyar Lajani\n\nLicense\n----\n\nMIT\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamyarlajani%2Fvalidoz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkamyarlajani%2Fvalidoz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkamyarlajani%2Fvalidoz/lists"}