🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@vee-validate/rules

Package Overview
Dependencies
Maintainers
0
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vee-validate/rules

Form Validation for Vue.js

4.15.0
latest
Source
npm
Version published
Weekly downloads
107K
-5.57%
Maintainers
0
Weekly downloads
 
Created
Source

@vee-validate/rules

Common Laravel-Like rules module for vee-validate

What's this

VeeValidate v4 breaks up the parts that made it a popular solution for form validation into it isolated parts. The core vee-validate package no longer includes the rules that came by default in previous releases, the built-in rules were rebranded as global validators,

This is where this package comes in, It includes the most common validators you will use in most of your applications, vee-validate allows you to express global rules just like Laravel's validation syntax.

Installation

yarn add @vee-validate/rules

# or with npm
npm install @vee-validate/rules

Usage

Use the defineRule function from vee-validate core library to add rules exported by this library:

import { defineRule } from 'vee-validate';
import { required, email, min } from '@vee-validate/rules';

defineRule('required', required);
defineRule('email', email);
defineRule('min', min);

Or you can globally define all the available rules in the @vee-validate/rules package:

import { defineRule } from 'vee-validate';
import * as rules from '@vee-validate/rules';

Object.keys(rules).forEach(rule => {
  defineRule(rule, rules[rule]);
});

Available Rules

  • alpha
  • alpha_dash
  • alpha_num
  • alpha_spaces
  • between
  • confirmed
  • digits
  • dimensions
  • email
  • excluded
  • ext
  • image
  • one_of
  • integer
  • is
  • is_not
  • length
  • max
  • max_value
  • mimes
  • min
  • min_value
  • numeric
  • regex
  • required
  • required_if
  • size

For more information about each rules, check the documentation for global validators

Credits

Keywords

VueJS

FAQs

Package last updated on 22 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts