MCPcopy
hub / github.com/vuelidate/vuelidate

github.com/vuelidate/vuelidate @v0.7.7 sqlite

repository ↗ · DeepWiki ↗ · release v0.7.7 ↗
109 symbols 245 edges 68 files 0 documented · 0%
README

vuelidate

codecov gzip size

Simple, lightweight model-based validation for Vue.js

Sponsors

Gold

Vuejs Amsterdam

Vue - The Road To Enterprise

Silver

Storyblok

Bronze

Vue Mastery logo Vue Mastery logo

Features & characteristics:

  • Model based
  • Decoupled from templates
  • Dependency free, minimalistic library
  • Support for collection validations
  • Support for nested models
  • Contextified validators
  • Easy to use with custom validators (e.g. Moment.js)
  • Support for function composition
  • Validates different data sources: Vuex getters, computed values, etc.

Demo & docs

https://vuelidate.js.org/

Vue 3 support

Vue 3 support is almost here with the Vuelidate 2 rewrite. Check out the next branch to see the latest progress.

Installation

npm install vuelidate --save

You can import the library and use as a Vue plugin to enable the functionality globally on all components containing validation configuration.

import Vue from 'vue'
import Vuelidate from 'vuelidate'
Vue.use(Vuelidate)

Alternatively it is possible to import a mixin directly to components in which it will be used.

import { validationMixin } from 'vuelidate'

var Component = Vue.extend({
  mixins: [validationMixin],
  validations: { ... }
})

The browser-ready bundle is also provided in the package.

<script src="https://github.com/vuelidate/vuelidate/raw/v0.7.7/vuelidate/dist/vuelidate.min.js"></script>

<script src="https://github.com/vuelidate/vuelidate/raw/v0.7.7/vuelidate/dist/validators.min.js"></script>
Vue.use(window.vuelidate.default)

Basic usage

For each value you want to validate, you have to create a key inside validations options. You can specify when input becomes dirty by using appropriate event on your input box.

import { required, minLength, between } from 'vuelidate/lib/validators'

export default {
  data () {
    return {
      name: '',
      age: 0
    }
  },
  validations: {
    name: {
      required,
      minLength: minLength(4)
    },
    age: {
      between: between(20, 30)
    }
  }
}

This will result in a validation object:

$v: {
  name: {
    "required": false,
    "minLength": false,
    "$invalid": true,
    "$dirty": false,
    "$error": false,
    "$pending": false
  },
  age: {
    "between": false
    "$invalid": true,
    "$dirty": false,
    "$error": false,
    "$pending": false
  }
}

Checkout the docs for more examples: https://vuelidate.js.org/

Contributing

# install dependencies
npm install

# serve with hot reload at localhost:8080
npm run dev

# create UMD bundle.
npm run build

# Create docs inside /gh-pages ready to be published
npm run docs

# run unit tests
npm run unit

# run all tests
npm test

For detailed explanation on how things work, checkout the guide and docs for vue-loader.

Contributors

Current

Damian Dulisz Damian Dulisz Natalia Tepluhina Natalia Tepluhina Natalia Tepluhina Dobromir Hristov Marina Mosti Marina Mosti

Emeriti

Here we honor past contributors who have been a major part on this project.

License

MIT

Core symbols most depended-on inside this repo

withParams
called by 39
src/params.js
h
called by 25
src/vval.js
req
called by 13
src/validators/common.js
patchChildren
called by 12
src/vval.js
isDef
called by 7
src/vval.js
regex
called by 7
src/validators/common.js
buildFromKeys
called by 6
src/index.js
sameVval
called by 5
src/vval.js

Shape

Function 109

Languages

TypeScript100%

Modules by API surface

src/index.js44 symbols
src/vval.js12 symbols
test/unit/specs/validation.spec.js11 symbols
src/params.js7 symbols
docs/main.js7 symbols
src/validators/common.js4 symbols
test/unit/specs/vval.spec.js3 symbols
test/ssr/ssr.spec.js3 symbols
test/unit/specs/validators/requiredUnless.spec.js2 symbols
test/unit/specs/validators/requiredIf.spec.js2 symbols
test/unit/specs/validators/or.spec.js2 symbols
test/unit/specs/validators/not.spec.js2 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

Dependencies from manifests, versioned

@babel/cli7.0.0-beta.47 · 1×
@babel/core7.0.0-beta.47 · 1×
@babel/plugin-proposal-export-default-from7.0.0-beta.47 · 1×
@babel/preset-env7.0.0-beta.47 · 1×
@babel/register7.0.0-beta.47 · 1×
autoprefixer8.5.0 · 1×
babel-loader8.0.0-beta.3 · 1×
chai4.1.2 · 1×
copy-webpack-plugin4.5.1 · 1×
cross-env5.1.5 · 1×
css-loader0.28.11 · 1×

For agents

$ claude mcp add vuelidate \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact