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

@snsw/dvs-validation

v3.0.20

Published

Utilities to validate the DVS data

Downloads

20

Readme

User guide for DVS validation

Steps to use this package are:

  1. Import the package as a dependency by running: npm install @snsw/dvs-validation
  2. Import the package helper objects (dvsDocType, dvsField, dvsValidations) and validation function (validateDvsField) to use in your code:
import {validateDvsField, dvsDocType, dvsField, dvsValidations} from 'dvs-validation';

//Optional step: You can override the default message for specific validations if they are not suitable
var validationMessages = dvsValidations;
validationMessages.MEDICARE.CARD_NUMBER.MEDICARE_NUMBER = 'Card number format is not valid';

var result = validateDvsField(dvsDocType.MEDICARE, dvsField.MEDICARE.CARD_NUMBER, "abcde", validationMessages);

//result will return:
//{
//  success: false,
//  error: {
//    code: MEDICARE-CARD_NUMBER-MEDICARE_NUMBER,
//    text: 'Card number format is not valid'
//  }     
//}

IMPORTANT: For Birth Certificate, Change of Name and Marriage Certificate, an extra parameter 'otherFields' is necessary. This is because these have conditionally mandatory fields that depend on the values of other fields. IMPORTANT: All the name length are limited to 100, Make sure if you are using this package to truncate the name in the backend according to DVS documentation. E.g.

import {validateDvsField, dvsDocType, dvsField, dvsValidations} from 'dvs-validation';
//this contains all the fields for this doc type on the screen
var otherFields = [];
otherFields[dvsField.BIRTH_CERT.STATE] = "NSW";
otherFields[dvsField.BIRTH_CERT.GIVEN_NAMES] = "Tom";
otherFields[dvsField.BIRTH_CERT.FAMILY_NAME] = "Lee";
otherFields[dvsField.BIRTH_CERT.BIRTH_DATE] = "11-11-2000"
otherFields[dvsField.BIRTH_CERT.REGISTRATION_NUMBER] = "";
otherFields[dvsField.BIRTH_CERT.CERTIFICATE_NUMBER] = "";

var result = validateDvsField(dvsDocType.BIRTH_CERT, dvsField.BIRTH_CERT.REGISTRATION_NUMBER, "", {}, otherFields);

//result will return:
//{
//  success: false,
//  error: {
//    code: BIRTH_CERT-REGISTRATION_NUMBER_NSW_VIC-REQUIRED,
//    text: 'Either a Registration Number or Certificate Number is required.'
//  }     
//}

Version history / changelog

  • 3.0.20 add DOB validation for people over 120 years (applied for passport)
  • 3.0.18 update all name field maxLength to 100 to cater for customer who has long names
  • 3.0.16 fixing registration date for birth cert validation
  • 3.0.11 fixing registration date for marriage cert validation
  • 3.0.6 adding cetrelink DVA card validation
  • 3.0.5 adding cetrelink card validation
  • 3.0.3 change within range validation function to not use regex
  • 3.0.2 add IRN validation to be within the range 1-9 inclusive
  • 3.0.1 remove no multiple spaces between names
  • 3.0.0 Change date format to use hyphen instead of slash i.e. dd-MM-yyyy, MM-yyyy. Updated the validation messages for this format.
  • 2.0.0 Publish to public npm
  • 1.0.13 Bug fix for birth certificate TAS
  • 1.0.12 Add marriage certificate
  • 1.0.11 Add change of name certificate
  • 1.0.10 Add birth certificate
  • 1.0.9 Add citizenship acquisition date format fix
  • 1.0.8 Add immicard number fix
  • 1.0.7 Add passport given name fix
  • 1.0.6 Add immicard given name fix
  • 1.0.5 Add Citizenship/Registration By Descent validations, add immicard validations, add passport validations
  • 1.0.4 Bug fix
  • 1.0.2 Add driver licence validations and remove first, middle and last names from medicare
  • 1.0.1 Replace moment with luxon (for smaller date validation library size)
  • 1.0.0 Medicare initial implementation