npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-daval

v2.0.14

Published

Vue data validator

Downloads

23

Readme

Overview

This is a Vue data validator, trying to cover all needs and built on top of ES6 to achieve the best architecture.

npm npm npm bundle size (minified) npm bundle size (minified + gzip) GitHub issues GitHub Codacy Badge Codacy Badge

Demo

You can view a demo and examples here.

Features

| Feature | Description | |---------|-------------| | Template agnostic | No matter what template library you use, this validator will simply work | | Simplicity | Focused in developer easiness to save time and code | | Dynamic | Validations can be run on defined circumstances | | Reactivity persistance | When data is replaced there is no worring, it will restore the watchers | | Data tree | If you have nested data objects to validate, this mixin will deal with it without trouble | | Maximum customization | Trying always to be as open and configurable as possible, validations, messages and behaviour | | Performance | It is developed with performance in mind, reducing time and processing considerably | | Promises | Will detect promises and handle properly without need of external packages | | Real time | Some validators show the results in next tick, so they are not displayed. This component updates the template once the validations are finished | | Async validations | If multiple validations are done it will control the times | | Revalidations | It controls whether a validation is performed or not and needs to revalide | | Dependencies free | Its just ~46 KB minified and served as mixin just with vue as dependency | | Community open | Feel free to contribute or bring suggestions, any improvement will be at least taken in mind, discussed and accepted if reasonable, just keep the the previous rules in mind |

Quickstart

npm install --save vue-daval
<form @submit.prevent="doLogin">
   <input v-model="login.email">
   <input type="password" v-model="login.password">

   <button type="submit">Login</button>
</form>

<form @submit.prevent="doRegister">
   <input v-model="register.alias">
   <input type="email" v-model="register.email">
   <input type="password" v-model="register.password">

   <button type="submit">Register</button>
</form>
import VueDaval from 'vue-daval';

export default {
   mixins: [ VueDaval ],

   data: () => ({
      login: {
         email: undefined,
         password: undefined
      },

      register: {
         alias: undefined,
         email: undefined,
         password: undefined
      }
   }),

   vdRules: {
      login: {
         email: { required: true, type: 'email' },
         password: { required: true, minlen: 5 }
      },

      register: {
         alias: { required: true, minlen: 5, checkAlias: (alias) => {
            return alias === 'admin'? 'Alias already in use' : true;
         }},
         email: { required: true, type: 'email', checkEmail: (email) => {
            return this.$http.post('/users/check/email', { email: email });
         }},
         password: { required: true, minlen: 5 }
      }
   },

   methods: {
      doLogin() {
         this.$vd.login.$validate().then(() => {
            this.$http.post('/users/login', this.login);

         }).catch(() => {
            alert('Error in login form');
         });
      },

      doRegister() {
         this.$vd.register.$validate().then(() => {
            this.$http.post('/users/register', this.register);

         }).catch(() => {
            alert('Error in register form');
         });
      }
   }
}

Performance

Weight is just 46 KB so is pretty light and is tweaked to be as fast as possible keeping code readability, developed with ES6 syntax and built with Vue CLI 3.

Included validatiors

  • Type: check the type of value, supporting boolean, number, integer, float, string, url, email and date.
  • Required: check if value is empty.
  • Regular expression: check the value against regular expression.
  • Minimum: check if value is greater than the number specified.
  • Maximum: check if value is less than the number specified.
  • Minimum length: check if value lengh is greater than the number specified.
  • Maximum length: check if value lengh is less than the number specified.
  • Length: check if value lengh is exactly the number specified.
  • Equals: check if value equals another value.
  • Is: check if value is a given one.
  • Is not: check if value is not a given one.
  • Is in: check if value is in a string or one element of an array.

Troubleshooting

If you find yourself running into issues during installation or running the validator, please check our Wiki. If still need help open an issue. We would be happy to discuss how they can be solved.

Documentation

You can view the full documentation at the project's Wiki with examples and detailed information.

Contributing

Contributions, questions and comments are all welcome and encouraged.