{"id":24211522,"url":"https://github.com/99x-incubator/js-input-validator","last_synced_at":"2025-09-22T08:32:04.490Z","repository":{"id":44130486,"uuid":"131000270","full_name":"99x-incubator/js-input-validator","owner":"99x-incubator","description":"Simple JS Input Validator","archived":false,"fork":false,"pushed_at":"2023-01-03T15:16:36.000Z","size":973,"stargazers_count":4,"open_issues_count":36,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-03T21:41:49.253Z","etag":null,"topics":["js","validate-js","validation-library"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/99x-incubator.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-25T12:05:00.000Z","updated_at":"2020-02-25T17:27:39.000Z","dependencies_parsed_at":"2023-02-01T07:01:11.379Z","dependency_job_id":null,"html_url":"https://github.com/99x-incubator/js-input-validator","commit_stats":null,"previous_names":["99xt-incubator/js-input-validator"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/99x-incubator%2Fjs-input-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/99x-incubator%2Fjs-input-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/99x-incubator%2Fjs-input-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/99x-incubator%2Fjs-input-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/99x-incubator","download_url":"https://codeload.github.com/99x-incubator/js-input-validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233835331,"owners_count":18737658,"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":["js","validate-js","validation-library"],"created_at":"2025-01-14T02:35:40.775Z","updated_at":"2025-09-22T08:31:59.209Z","avatar_url":"https://github.com/99x-incubator.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# js-input-validator\r\n\r\n[![npm](https://img.shields.io/npm/v/js-input-validator.svg)](https://www.npmjs.com/package/js-input-validator)\r\n[![license](https://img.shields.io/github/license/99xt-incubator/js-input-validator.svg)](https://github.com/99xt-incubator/js-input-validator/blob/master/LICENSE)\r\n\r\nSimple JS Input Validator\r\n\r\n## Installation\r\n\r\nTo install this library, run;\r\n\r\n```\r\nnpm i -S js-input-validator\r\n```\r\n\r\n## Usage\r\n\r\n```js\r\nimport Validator from \"js-input-validator\";\r\n\r\n// Schema\r\nconst schema = {\r\n  field1: {\r\n    name: \"field 1\",\r\n    type: \"number\",\r\n    required: true,\r\n    length: {\r\n      min: 1,\r\n      max: 3\r\n    },\r\n    min: 1\r\n  },\r\n  field2: {\r\n    name: \"field 2\",\r\n    type: [\"string\", \"number\"],\r\n    required: true,\r\n    min: 3,\r\n    validate: function(value, values={}) {\r\n      return true;\r\n    }\r\n  },\r\n  field3: {\r\n    name: \"field 3\",\r\n    type: \"number\",\r\n    required: false,\r\n    min: 3,\r\n    max: 5\r\n  },\r\n  field4: {\r\n    name: \"field 4\",\r\n    type: \"email\"\r\n  }\r\n};\r\n\r\n// Values\r\nconst errors = new Validator(schema).run({\r\n  field1: \"s\",\r\n  field3: 4,\r\n  field4: \"sasadsa@adsa\"\r\n});\r\n\r\n// Run Validator with `run` method and get error object\r\nconst errors = new Validator(schema).run(values);\r\n\r\n// Run Validator with `isValid` method\r\nconst data = new Validator(schema);\r\nif (data.isValid()) {\r\n  // Valid\r\n} else {\r\n  // Invalid\r\n}\r\n```\r\n\r\n## License\r\n\r\nMIT\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F99x-incubator%2Fjs-input-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F99x-incubator%2Fjs-input-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F99x-incubator%2Fjs-input-validator/lists"}