UNPKG

lux-utils

Version:

JS library to validate and format common Luxembourgish administrative data.

1,723 lines (555 loc) 24.2 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title>LuxUtils - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css"> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav> <li class="nav-link nav-home-link"><a href="index.html">Home</a></li><li class="nav-heading">Classes</li><li class="nav-heading"><span class="nav-item-type type-class">C</span><span class="nav-item-name"><a href="LuxUtils.html">LuxUtils</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validateCodePostal">validateCodePostal</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validateFixedPhone">validateFixedPhone</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validateFixedPhoneWithPrefix">validateFixedPhoneWithPrefix</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validateLicensePlate">validateLicensePlate</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validateMatricule">validateMatricule</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validateMobilePhone">validateMobilePhone</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validateMobilePhoneWithPrefix">validateMobilePhoneWithPrefix</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validatePhone">validatePhone</a></span></li><li class="nav-item"><span class="nav-item-type type-function">F</span><span class="nav-item-name"><a href="LuxUtils.html#.validatePhoneWithPrefix">validatePhoneWithPrefix</a></span></li> </nav> <div id="main"> <h1 class="page-title">LuxUtils</h1> <section> <header> <h2> LuxUtils </h2> </header> <article> <div class="container-overview"> <div class="section-method"> <h4 class="name" id="LuxUtils"><span class="type-signature"></span>new LuxUtils<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> <p>JS library to validate and format common Luxembourgish administrative data.</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="index.js.html">index.js</a>, <a href="index.js.html#line1">line 1</a> </li></ul></dd> </dl> </div> </div> <h3 class="subsection-title">Methods</h3> <div class="section-method"> <h4 class="name" id=".validateCodePostal"><span class="type-signature">(static) </span>validateCodePostal<span class="signature">(codePostalToValidate)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the given postal code is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validateCodePostal_index.js.html">validateCodePostal/index.js</a>, <a href="validateCodePostal_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>codePostalToValidate</code></td> <td class="type"> <span class="param-type"><code>string</code></span> | <span class="param-type"><code>integer</code></span> </td> <td class="description last"> <p>postal code to validate. Can be a <code>string</code> or a <code>integer</code></p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// validate a postal code let isValid = LuxUtils.validateCodePostal(4402); //true; let isValid2 = LuxUtils.validateCodePostal("L-4402"); //true; let isValid3 = LuxUtils.validateCodePostal("0404"); //false;</code></pre> </div> </div> <div class="section-method"> <h4 class="name" id=".validateFixedPhone"><span class="type-signature">(static) </span>validateFixedPhone<span class="signature">(fixedPhoneNumber)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the fixed phone number is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validateFixedPhone_index.js.html">validateFixedPhone/index.js</a>, <a href="validateFixedPhone_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fixedPhoneNumber</code></td> <td class="type"> <span class="param-type"><code>string</code></span> | <span class="param-type"><code>integer</code></span> </td> <td class="description last"> <p>fixed phone number to validate. Can be a <code>string</code> or a <code>integer</code></p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// 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;</code></pre> </div> </div> <div class="section-method"> <h4 class="name" id=".validateFixedPhoneWithPrefix"><span class="type-signature">(static) </span>validateFixedPhoneWithPrefix<span class="signature">(fixedPhoneNumberWithPrefix)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the fixed phone number with prefix is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validateFixedPhoneWithPrefix_index.js.html">validateFixedPhoneWithPrefix/index.js</a>, <a href="validateFixedPhoneWithPrefix_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>fixedPhoneNumberWithPrefix</code></td> <td class="type"> <span class="param-type"><code>string</code></span> </td> <td class="description last"> <p>fixed phone number with prefix to validate. Can be a <code>string</code></p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// 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;</code></pre> </div> </div> <div class="section-method"> <h4 class="name" id=".validateLicensePlate"><span class="type-signature">(static) </span>validateLicensePlate<span class="signature">(licensePlateToValidate)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the given postal code is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validateLicensePlate_index.js.html">validateLicensePlate/index.js</a>, <a href="validateLicensePlate_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>licensePlateToValidate</code></td> <td class="type"> <span class="param-type"><code>string</code></span> | <span class="param-type"><code>integer</code></span> </td> <td class="description last"> <p>postal code to validate. Can be a <code>string</code> or a <code>integer</code></p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// validate a postal code let isValid = LuxUtils.validateLicensePlate(4402); //true; let isValid2 = LuxUtils.validateLicensePlate("L-4402"); //true; let isValid3 = LuxUtils.validateLicensePlate("0404"); //false;</code></pre> </div> </div> <div class="section-method"> <h4 class="name" id=".validateMatricule"><span class="type-signature">(static) </span>validateMatricule<span class="signature">(matriculeToValidate)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the matricule is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validateMatricule_index.js.html">validateMatricule/index.js</a>, <a href="validateMatricule_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>matriculeToValidate</code></td> <td class="type"> <span class="param-type"><code>integer</code></span> </td> <td class="description last"> <p>matricule to validate</p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// validate a matricule let isValid = LuxUtils.validateMatricule(1893120105732); //true;</code></pre> </div> </div> <div class="section-method"> <h4 class="name" id=".validateMobilePhone"><span class="type-signature">(static) </span>validateMobilePhone<span class="signature">(mobilePhoneNumber)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the mobile phone number is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validateMobilePhone_index.js.html">validateMobilePhone/index.js</a>, <a href="validateMobilePhone_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>mobilePhoneNumber</code></td> <td class="type"> <span class="param-type"><code>string</code></span> | <span class="param-type"><code>integer</code></span> </td> <td class="description last"> <p>mobile phone number to validate. Can be a <code>string</code> or a <code>integer</code></p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// 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;</code></pre> </div> </div> <div class="section-method"> <h4 class="name" id=".validateMobilePhoneWithPrefix"><span class="type-signature">(static) </span>validateMobilePhoneWithPrefix<span class="signature">(MobilePhoneNumberWithPrefix)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the mobile phone number with prefix is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validateMobilePhoneWithPrefix_index.js.html">validateMobilePhoneWithPrefix/index.js</a>, <a href="validateMobilePhoneWithPrefix_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>MobilePhoneNumberWithPrefix</code></td> <td class="type"> <span class="param-type"><code>string</code></span> </td> <td class="description last"> <p>mobile phone number with prefix to validate. Can be a <code>string</code></p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// 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;</code></pre> </div> </div> <div class="section-method"> <h4 class="name" id=".validatePhone"><span class="type-signature">(static) </span>validatePhone<span class="signature">(phoneNumber)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the phone number is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validatePhone_index.js.html">validatePhone/index.js</a>, <a href="validatePhone_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>phoneNumber</code></td> <td class="type"> <span class="param-type"><code>string</code></span> | <span class="param-type"><code>integer</code></span> </td> <td class="description last"> <p>phone number to validate. Can be a <code>string</code> or a <code>integer</code></p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// validate a phone number let isValid = LuxUtils.validatePhone(621123456); //true; let isValid2 = LuxUtils.validatePhone("444444"); //true; let isValid3 = LuxUtils.validatePhone("4444"); //false;</code></pre> </div> </div> <div class="section-method"> <h4 class="name" id=".validatePhoneWithPrefix"><span class="type-signature">(static) </span>validatePhoneWithPrefix<span class="signature">(phoneNumber)</span><span class="type-signature"> &rarr; {boolean}</span></h4> <div class="description"> <p>Returns <code>true</code> if the phone number with prefix is valid</p> </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="validatePhoneWithPrefix_index.js.html">validatePhoneWithPrefix/index.js</a>, <a href="validatePhoneWithPrefix_index.js.html#line1">line 1</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>phoneNumber</code></td> <td class="type"> <span class="param-type"><code>string</code></span> </td> <td class="description last"> <p>phone number with prefix to validate. Can be a <code>string</code></p> </td> </tr> </tbody> </table> <div class="section-returns"> <h5>Returns:</h5> <dl class="param-type"> <dt> Type: </dt> <dd> <span class="param-type"><code>boolean</code></span> </dd> </dl> <div class="param-desc"> <p><code>true</code> or <code>false</code></p> </div> </div> <div class="section-examples"> <h5>Example</h5> <pre class="prettyprint"><code>// validate a phone number let isValid = LuxUtils.validatePhone(00352621123456); //true; let isValid2 = LuxUtils.validatePhone("+352444444"); //true; let isValid3 = LuxUtils.validatePhone("4444"); //false;</code></pre> </div> </div> </article> </section> </div> <br class="clear"> <footer> Generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Mon Feb 18 2019 12:36:27 GMT+0000 (WET) using the Minami theme. </footer> <script>prettyPrint();</script> <script src="scripts/linenumber.js"></script> </body> </html>