Location: A review of cardiac cellular electrophysiology models @ f954e5918331 / dojo-presentation / js / dojo / dojox / validate / ca.js

Author:
David Nickerson <david.nickerson@gmail.com>
Date:
2021-09-16 00:41:19+12:00
Desc:
Updating Noble 1962 model: * Exposing the membrane potential to the top-level model; * adding SED-ML for the paced and pacemaker variants of the model. Using OpenCOR Snapshot release 2021-09-14.
Permanent Source URI:
https://models.fieldml.org/workspace/a1/rawfile/f954e59183314cd37f86c8832dc81317d01c8ec5/dojo-presentation/js/dojo/dojox/validate/ca.js

dojo.provide("dojox.validate.ca");

dojo.require("dojox.validate._base");

dojox.validate.ca.isPhoneNumber = function(/* String */value) {
	// summary: Validates 10 Canadian digit phone number for several common formats
	// returns: Boolean
        return dojox.validate.us.isPhoneNumber(value);  // same as US
};

dojox.validate.ca.isProvince = function(/* String[2] */value) {
	// summary: Validates Canadian province abbreviations (2 chars)
	// returns: Boolean
	var re = new RegExp("^" + dojox.regexp.ca.province() + "$", "i");
	return re.test(value);
}; 
 
dojox.validate.ca.isSocialInsuranceNumber = function(/* String */value) {
	// summary: Validates Canadian 9 digit social insurance number for several common formats
	// This routine only pattern matches and does not use the Luhn Algorithm to validate number.
	// returns: Boolean
        var flags = {
                format: [
                        "###-###-###",
                        "### ### ###",
                        "#########" 
                ]
        };
        return dojox.validate.isNumberFormat(value, flags);
};

dojox.validate.ca.isPostalCode = function(value) {
	// summary: Validates Canadian 6 digit postal code:
	//	Canadian postal codes are in the format ANA NAN,
	//	where A is a letter and N is a digit, with a space
	//	separating the third and fourth characters.
	// returns: Boolean
        var re = new RegExp("^" + dojox.regexp.ca.postalCode() + "$", "i");
        return re.test(value);
};