Skip to content

Installation

This package contains validators to use in combination of your form library.

bash
  npm i @xerius/codey-validations

Usage in Vuelidate

Import the module into your project by using the named import.

js
import { isBelgianIban } from "@xerius/codey-validators";

export default {
  components: {
    XerAccountNumber,
  },
  data() {
    return {
      accountNumber: "",
    };
  },
  validations: {
    accountNumber: {
      required,
      isBelgianIban,
    },
  },
  methods: {
    setAccountNumber(value) {
      this.accountNumber = value;
      this.$v.accountNumber.$touch();
    },
  },
};

All validators

NameParameterDescription
isBelgianIbanChecks wether the given string is a valid Belgian iban
isIbanChecks wether the given string is a valid iban (you will need to provide the country code in the string yourself)
isValidDateformat (Example: dd-mm-yyyy)Checks wether the given string is a valid date
isValidSocialSecurityNumberChecks wether the given string is a valid social security number