{"_id":"@clearlyhope/vuelidate-core","_rev":"1-1e5662cda43368d8bfcf38d2add1f8b3","name":"@clearlyhope/vuelidate-core","dist-tags":{"latest":"2.0.0-alpha.11"},"versions":{"2.0.0-alpha.11":{"name":"@clearlyhope/vuelidate-core","description":"Simple, lightweight model-based validation for Vue.js","version":"2.0.0-alpha.11","main":"dist/index.js","types":"index.d.ts","module":"dist/index.esm.js","repository":{"type":"git","url":"git+https://github.com/clearlyhope/vuelidate.git"},"license":"MIT","scripts":{"build":"bili","test:unit":"jest","lint":"eslint src test","dev":"yarn build --watch"},"dependencies":{"vue-demi":"latest"},"devDependencies":{"bili":"^4.8.1","vue":"^3.0.1"},"peerDependencies":{"@vue/composition-api":"^1.0.0-beta.1","vue":"^2.0.0 || >=3.0.0-rc.0"},"publishConfig":{"access":"public"},"gitHead":"86181a6eaf8b49157e2aac2aae837dada3ddc791","bugs":{"url":"https://github.com/clearlyhope/vuelidate/issues"},"homepage":"https://github.com/clearlyhope/vuelidate#readme","_id":"@clearlyhope/vuelidate-core@2.0.0-alpha.11","_nodeVersion":"15.5.0","_npmVersion":"lerna/3.20.2/node@v15.5.0+x64 (darwin)","dist":{"integrity":"sha512-ISnB7Tl6LMaMppFky2yKGXbhSDetakJ/isrvypenEu10x446qlxjdt+AfUw6VfVlbQ+z9VAOk1w5NTINMLD1pw==","shasum":"10977d06bbf70de3ce4cebb0ea135318e464566d","tarball":"https://registry.npmjs.org/@clearlyhope/vuelidate-core/-/vuelidate-core-2.0.0-alpha.11.tgz","fileCount":7,"unpackedSize":73835,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgDz+HCRA9TVsSAnZWagAAenEP/2XAziCM2ht6bppWMAqr\nkj98iNT1zZ/FKi8V/PO0LD/gXZmTvDRaNruxO+PnpKxtJLWszGD7fCxmeThg\ntTcqHXRUm7NcM86VHVRkTcbht8YQK5n6JP0eKdtVK9AyELGSNoz9m6vR1V0D\ncCMH2PYhX5oGrqOjka/hUcmDHAZJGs6fCwG+J9SAfrberMg1ntYlFop/FGgx\n/AVltYp6cPTaJLC5DHQ7g7fk8vYV4uU3cHxtldvmtcJrC+/3rESwym5YpzR6\n6NiocImSchmxd9jrbECaxeAzfqz6POoEsIP64Ce7pFQYiWVXsC1HpKsSJ38o\nsKKUTHuZRAVSuClHFVWkWZltRvrFoyLfdqreSERBl7/tzkI/2XkexD6tK6H/\n6QrcZdrdCR/yXp0yyNGvY+xWxWnNev8vWarFI3IoYCTIsXirlYIW+pNdSEOI\n+6bHopZFL8wntUsdrTdnHfKnthSq+IjaPep4d2hpX518YJHsnBjhFOGMqzE6\n+tWAVQNDmtIxD+V6eVFHzEBHkhFOG6c9cT+qORe+gS4nPqTl496a360nXFVG\nzVboQTz0dMfQwuMZJRkjuGa8SfUH5N8ou9IGf4sIOahhG0JuxBhRmSqM8clt\nk7HTXmWNU9lyX1kuWAnPLBW7ApmXpLgxKUh2XQI+9xqknsw+XxDZNqsIN2Ga\nTddn\r\n=vogE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFDJC0db7MIbR6M6qTiieQvj6YdRKRk5ranAqxtHTOYLAiBJFZPLO0YejQXnQ8dY9jgr+03iXiQpt9j5V4Ia5/EUUg=="}]},"_npmUser":{"name":"clearlyhope","email":"accounts@clearlyhope.com"},"directories":{},"maintainers":[{"name":"clearlyhope","email":"accounts@clearlyhope.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/vuelidate-core_2.0.0-alpha.11_1611612039360_0.6679822163614928"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-25T22:00:39.307Z","2.0.0-alpha.11":"2021-01-25T22:00:39.508Z","modified":"2022-04-04T23:15:49.261Z"},"maintainers":[{"name":"clearlyhope","email":"accounts@clearlyhope.com"}],"description":"Simple, lightweight model-based validation for Vue.js","homepage":"https://github.com/clearlyhope/vuelidate#readme","repository":{"type":"git","url":"git+https://github.com/clearlyhope/vuelidate.git"},"bugs":{"url":"https://github.com/clearlyhope/vuelidate/issues"},"license":"MIT","readme":"# vuelidate\n\n> Simple, lightweight model-based validation for Vue.js 2.x & 3.0\n\nVisit [Vuelidate Docs](https://vuelidate-next.netlify.org) for detailed instructions.\n\n## Sponsors\n\n### Silver\n\n<p align=\"center\">\n  <a href=\"https://www.storyblok.com/developers?utm_source=newsletter&utm_medium=logo&utm_campaign=vuejs-newsletter\" target=\"_blank\">\n    <img src=\"https://a.storyblok.com/f/51376/3856x824/fea44d52a9/colored-full.png\" alt=\"Storyblok\" width=\"240px\">\n  </a>\n</p>\n\n### Bronze\n\n<p align=\"center\">\n  <a href=\"https://www.vuemastery.com/\" target=\"_blank\">\n    <img src=\"https://cdn.discordapp.com/attachments/258614093362102272/557267759130607630/Vue-Mastery-Big.png\" alt=\"Vue Mastery logo\" width=\"180px\">\n  </a>\n</p>\n\n## Installation\n\nYou can use Vuelidate just by itself, but we suggest you use it along `@vuelidate/validators`, as it gives a nice collection of commonly used validators.\n\n**Vuelidate supports both Vue 3.0 and Vue 2.x**\n\n```bash\nnpm install @vuelidate/core @vuelidate/validators\n# or\nyarn add @vuelidate/core @vuelidate/validators\n```\n\n## Install via plugin in Vue 3.0\n\n> This is only required if you want to use the `validations` option. `setup` usage documented later.\n\n```js\n// main.js\nimport { createApp } from 'vue'\nimport App from './App.vue'\nimport { VuelidatePlugin } from '@vuelidate/core'\n\nconst app = createApp(App)\napp.use(VuelidatePlugin)\napp.mount('#app')\n```\n\n## Install via plugin in Vue 2.x\n\n> This is only required if you want to use the `validations` option. `setup` usage documented later.\n\n```js\n// main.js\n\nimport Vue from 'vue'\nimport VueCompositionApi from '@vue/composition-api'\nimport { VuelidatePlugin } from '@vuelidate/core'\n\nVue.use(VueCompositionApi)\nVue.use(VuelidatePlugin)\n\n```\n\nThen you can use it in all components with the Options API\n\n```js\nimport { email, required } from '@vuelidate/validators'\n\nexport default {\n  name: 'UsersPage',\n  data: () => ({\n    form: {\n      name: '',\n      email: ''\n    }\n  }),\n  validations: {\n    form: {\n      name: { required },\n      email: { required, email }\n    }\n  }\n}\n```\n\n## Usage in `setup` function\n\n```js\nimport { ref } from 'vue' // or '@vue/composition-api' in Vue 2.x\nimport { useVuelidate } from '@vuelidate/core'\nimport { email, required } from '@vuelidate/validators'\n\nexport default {\n  setup () {\n    const name = ref('')\n    const emailAddress = ref('')\n    const rules = {\n      name: { required },\n      emailAddress: { required, email }\n    }\n\n    const $v = useVuelidate(rules, { name, emailAddress })\n\n    return { name, emailAddress, $v }\n  }\n}\n```\n\n## The `$v` object\n\n```js\n{\n  $dirty: false, // validations will only run when $dirty is true\n  $touch: <Function>, // call to turn the $dirty state to true\n  $reset: <Function>, // call to turn the $dirty state to false\n  $errors: [], // contains all the current errors { $message, $params, $pending, $invalid }\n  $error: false, // true if validations have not passed\n  $invalid: false, // as above for compatibility reasons\n  // there are some other properties here, read the docs\n}\n```\n\n## Lazy validations by default\n\nValidation in Vuelidate 2 is by default `lazy`, meaning validators are only called, after a field is dirty, so after `$touch()` is called or by using `$model`.\n\nThis saves extra invocations for async validators as well as makes the initial validation setup a bit more performant.\n\n### Resetting dirty state\n\nIf you wish to reset a form's `$dirty` state, you can do so by using the appropriately named `$reset` method. For example when closing a create/edit modal, you dont want the validation state to persist.\n\n```vue\n<app-modal @closed=\"$v.$reset()\">\n  <!-- some inputs  -->\n</app-modal>\n```\n\n## Displaying error messages\n\nThe validation state holds useful data, like the invalid state of each property validator, along with extra properties, like an error message or extra parameters.\n\nError messages come out of the box with the bundled validators in `@vuelidate/validators` package. You can check how change those them over at the [Custom Validators page](./custom_validators.md)\n\nThe easiest way to display errors is to use the form's top level `$errors` property. It is an array of validation objects, that you can iterate over.\n\n```vue\n<p\n  v-for=\"(error, index) of $v.$errors\"\n  :key=\"index\"\n>\n  <strong>{{ error.$validator }}</strong>\n  <small> on property</small>\n  <strong>{{ error.$property }}</strong>\n  <small> says:</small>\n  <strong>{{ error.$message }}</strong>\n</p>\n```\n\nYou can also check for errors on each form property:\n\n```vue\n<p\n  v-for=\"(error, index) of $v.name.$errors\"\n  :key=\"index\"\n>\n  <!-- Same as above -->\n</p>\n```\n\nFor more info, visit the [Vuelidate Docs](https://vuelidate-next.netlify.org).\n\n## Development\nTo test the package run\n\n```bash\nyarn test:unit\n```\n\nTo link the package run\n\n```bash\nyarn link\n```\n\nTo build run the package, run:\n\n```bash\nnpm run build\n```\n","readmeFilename":"README.md"}