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-convenia-validator

v0.1.54

Published

A model-based form validation library for vue inspired by vuelidate and vee-validate.

Downloads

101

Readme

vue-convenia-validator is a model-based form validation library for Vue.js inspired by Vuelidate and VeeValidate. Unlike Vuelidate and VeeValidate, vue-convenia-validator is meant to be used as a mixin rather than as a plugin.

Installation

npm

npm install vue-convenia-validator --save

yarn

yarn add vue-convenia-validator

Usage

vue-convenia-validator is a model-based, template-independent validation library, which means that it is completely decoupled from how you build your templates. In order to use your component has to define a validation option object defining the validation rules for your form(s):

<template>
  <div id="vue-app">
    <form>
      <input name="fullName" type="text" v-model="fullName" />
      <input name="birthday" type="text" v-model="birthday" />
    </form>
  </div>
<template>

<script>
import FormValidator from 'cee-validate'

export default {
  mixins: [ FormValidator ],

  data () {
    return {
      fullName: '',
      birthday: ''
    }
  }

  validations: {
    fullName: 'required',
    birthday: 'required|date_format:DD/MM/YYYY'
  }
}
<script>

The name attribute on the <input /> fields here is necessary for the mixin to be able to listen for certain events on the form elements. The name attribute is only necessary on the <form> tag when using scoped forms:

<template>
  <div id="vue-app">
    <form name="formOne">
      <input name="fullName" type="text" v-model="formOne.fullName" />
      <input name="birthday" type="text" v-model="formOne.birthday" />
    </form>

    <form name="formTwo">
      <input name="fullName" type="text" v-model="formTwo.fullName" />
      <input name="birthday" type="text" v-model="formTwo.birthday" />
      <input name="age" type="number" v-model="formTwo.age" />
    </form>
  </div>
<template>

<script>
import FormValidator from 'cee-validate'

export default {
  mixins: [ FormValidator ],

  data () {
    return {
      formOne: {
        fullName: '',
        birthday: ''
      },
      formTwo: {
        fullName: '',
        birthday: ''
      }
    }
  }

  validations: {
    formOne: {
      fullName: 'required',
      birthday: 'required|date_format:DD/MM/YYYY'
    },
    formTwo: {
      fullName: 'required',
      birthday: 'required|date_format:DD/MM/YYYY'
      age: 'numeric'
    }
  }
}
<script>

To-do

  • Implement rules

    • [x] alphanumeric - Checks if all characters in a string are alphanumeric.
    • [x] custom - Executes a callback or array of callbacks with input value as argument.
    • [x] dateFormat - Checks if value is a valid date.
    • [x] numeric - Check if all characters in a string are numbers.
    • [x] regex - Tests a RegExp on value.
    • [x] required - Checks if value isn't empty.
    • [x] hour - Checks if value is a valid hour
    • [ ] dateBetween - Checks if date is in between two date values.
    • [ ] dateBefore - Checks if given date comes before another date.
    • [ ] dateAfter - Checks if given date comes after another date.
    • [x] email - Checks if value is a valid email address.
    • [ ] url - Checks if value is a valid URL address.
    • [ ] ip - Checks if value is a valid IP address.
    • [ ] creditCard - Checks if value is a valid credit card number.
  • [x] Implement unit tests

  • [ ] Improve project documentation

  • [ ] Implement option to customize validation error messages

  • [ ] Implement Vue directive