{"id":17959984,"url":"https://github.com/febobo/react-validator","last_synced_at":"2025-08-16T09:30:37.216Z","repository":{"id":57347326,"uuid":"103637555","full_name":"febobo/react-validator","owner":"febobo","description":"react-validator in your react appliction is so ease","archived":false,"fork":false,"pushed_at":"2017-09-28T08:08:47.000Z","size":9,"stargazers_count":4,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-07T05:12:15.353Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/febobo.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":"2017-09-15T09:09:12.000Z","updated_at":"2019-10-19T09:09:10.000Z","dependencies_parsed_at":"2022-08-28T04:00:58.810Z","dependency_job_id":null,"html_url":"https://github.com/febobo/react-validator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/febobo%2Freact-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/febobo%2Freact-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/febobo%2Freact-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/febobo%2Freact-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/febobo","download_url":"https://codeload.github.com/febobo/react-validator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230026524,"owners_count":18161617,"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":[],"created_at":"2024-10-29T11:04:54.389Z","updated_at":"2024-12-16T21:21:00.051Z","avatar_url":"https://github.com/febobo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-validator\nreact-validator in your react appliction is so ease\n\n### Preview\n![demo](http://g.recordit.co/l8acHx5Dsc.gif)\n\n### Install\n\n```\nnpm install react-validator-ease` or `yarn install react-validator-ease\n```\n\n### Usege\n\n- link\n\n```bash\nconst ReactValidator from 'react-valid-ease'\n```\n\n- es5\n```js\ncomponentWillMount: function() {\n  this.validator = new ReactValidator();\n},\n```\n\n- es6\n\n```js\nconstructor() {\n  this.validator = new ReactValidator();\n}\n```\n\n- jsx \n\n```jsx \n  render: function() {\n    return (\n      \u003cdiv className=\"container card my-4\"\u003e\n        \u003cdiv className=\"card-block\"\u003e\n          \u003ch3\u003eExample Form\u003c/h3\u003e\n\n          \u003cdiv className=\"form-group\"\u003e\n            \u003clabel\u003eemail\u003c/label\u003e\n            \u003cinput className=\"form-control\" name=\"email\" value={this.state.email} onChange={this.setStateFromInput} /\u003e\n            {this.validator.message('email', this.state.email, 'required|email','',{\n              required: 'email不能为空',\n              email: 'email 格式不正确'\n            })}\n          \u003c/div\u003e\n          \u003cdiv className=\"form-group\"\u003e\n            \u003clabel\u003erequired\u003c/label\u003e\n            \u003cinput className=\"form-control\" name=\"required\" value={this.state.require} onChange={this.setStateFromInput} /\u003e\n            {this.validator.message('required', this.state.required, 'required|max:12|min:6','',{\n              default: 'required不能为空',\n              min: '不能少于6个字符',\n              max: '不能大于12个字符'\n            })}\n          \u003c/div\u003e\n          \u003cbutton className=\"btn btn-primary\" onClick={this.submitForm}\u003eSubmit\u003c/button\u003e\n        \u003c/div\u003e\n      \u003c/div\u003e\n    );\n  }\n```\n\n* The message method have five arguments\n  - Field: Name: A unique string\n  - Value: Current field value\n  - Rules: Rules string, support use pipe separated\n  - Custom ClassName: ClassName string, your can custom you errorMessage style\n  - Custom Error Message: your can custom you errorMessage text\n\n\n### Rules \n\nExamples: `require|min:6|min:12`\n\n|Rule|Description|\n|---|---|\n|require|must be a valid input|\n|email|must be a valid email address|\n|max|may not be greater than max characters|\n|min|may not be greater than mix characters|\n|number|must be a number|\n|phone|must be a valid phone number|\n|url|must be a valid url|\n|accepted|must be a valid Boolean|\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffebobo%2Freact-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffebobo%2Freact-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffebobo%2Freact-validator/lists"}