LuxUtils

LuxUtils

new LuxUtils()

JS library to validate and format common Luxembourgish administrative data.

Source:

Methods

(static) validateCodePostal(codePostalToValidate) → {boolean}

Returns true if the given postal code is valid

Source:
Parameters:
Name Type Description
codePostalToValidate string | integer

postal code to validate. Can be a string or a integer

Returns:
Type:
boolean

true or false

Example
// validate a postal code
 let isValid = LuxUtils.validateCodePostal(4402); //true;
 let isValid2 = LuxUtils.validateCodePostal("L-4402"); //true;
 let isValid3 = LuxUtils.validateCodePostal("0404"); //false;

(static) validateFixedPhone(fixedPhoneNumber) → {boolean}

Returns true if the fixed phone number is valid

Source:
Parameters:
Name Type Description
fixedPhoneNumber string | integer

fixed phone number to validate. Can be a string or a integer

Returns:
Type:
boolean

true or false

Example
// validate a fixed phone number
 let isValid = LuxUtils.validateFixedPhone(420288); //true;
 let isValid2 = LuxUtils.validateFixedPhone("44 12 34 22"); //true;
 let isValid3 = LuxUtils.validateFixedPhone("4444"); //false;

(static) validateFixedPhoneWithPrefix(fixedPhoneNumberWithPrefix) → {boolean}

Returns true if the fixed phone number with prefix is valid

Source:
Parameters:
Name Type Description
fixedPhoneNumberWithPrefix string

fixed phone number with prefix to validate. Can be a string

Returns:
Type:
boolean

true or false

Example
// validate a fixed phone number
 let isValid = LuxUtils.validateFixedPhoneWithPrefix(00352420288); //true;
 let isValid2 = LuxUtils.validateFixedPhoneWithPrefix("+35244 12 34 22"); //true;
 let isValid3 = LuxUtils.validateFixedPhoneWithPrefix("4444"); //false;

(static) validateLicensePlate(licensePlateToValidate) → {boolean}

Returns true if the given postal code is valid

Source:
Parameters:
Name Type Description
licensePlateToValidate string | integer

postal code to validate. Can be a string or a integer

Returns:
Type:
boolean

true or false

Example
// validate a postal code
 let isValid = LuxUtils.validateLicensePlate(4402); //true;
 let isValid2 = LuxUtils.validateLicensePlate("L-4402"); //true;
 let isValid3 = LuxUtils.validateLicensePlate("0404"); //false;

(static) validateMatricule(matriculeToValidate) → {boolean}

Returns true if the matricule is valid

Source:
Parameters:
Name Type Description
matriculeToValidate integer

matricule to validate

Returns:
Type:
boolean

true or false

Example
// validate a matricule
 let isValid = LuxUtils.validateMatricule(1893120105732); //true;

(static) validateMobilePhone(mobilePhoneNumber) → {boolean}

Returns true if the mobile phone number is valid

Source:
Parameters:
Name Type Description
mobilePhoneNumber string | integer

mobile phone number to validate. Can be a string or a integer

Returns:
Type:
boolean

true or false

Example
// validate a postal code
 let isValid = LuxUtils.validateMobilePhone(621123456); //true;
 let isValid2 = LuxUtils.validateMobilePhone("621 12 34 56"); //true;
 let isValid3 = LuxUtils.validateMobilePhone("4444"); //false;

(static) validateMobilePhoneWithPrefix(MobilePhoneNumberWithPrefix) → {boolean}

Returns true if the mobile phone number with prefix is valid

Source:
Parameters:
Name Type Description
MobilePhoneNumberWithPrefix string

mobile phone number with prefix to validate. Can be a string

Returns:
Type:
boolean

true or false

Example
// validate a Mobile phone number
 let isValid = LuxUtils.validateMobilePhoneWithPrefix(00352621123456); //true;
 let isValid2 = LuxUtils.validateMobilePhoneWithPrefix("+352 621 77 77 77"); //true;
 let isValid3 = LuxUtils.validateMobilePhoneWithPrefix("4444"); //false;

(static) validatePhone(phoneNumber) → {boolean}

Returns true if the phone number is valid

Source:
Parameters:
Name Type Description
phoneNumber string | integer

phone number to validate. Can be a string or a integer

Returns:
Type:
boolean

true or false

Example
// validate a phone number
 let isValid = LuxUtils.validatePhone(621123456); //true;
 let isValid2 = LuxUtils.validatePhone("444444"); //true;
 let isValid3 = LuxUtils.validatePhone("4444"); //false;

(static) validatePhoneWithPrefix(phoneNumber) → {boolean}

Returns true if the phone number with prefix is valid

Source:
Parameters:
Name Type Description
phoneNumber string

phone number with prefix to validate. Can be a string

Returns:
Type:
boolean

true or false

Example
// validate a phone number
 let isValid = LuxUtils.validatePhone(00352621123456); //true;
 let isValid2 = LuxUtils.validatePhone("+352444444"); //true;
 let isValid3 = LuxUtils.validatePhone("4444"); //false;