This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Valida un CUPS (Código Unificado de Punto de Suministro) dado | |
* @param {string} CUPS Código CUPS que se quiere verificar. Más información aquí: https://es.wikipedia.org/wiki/C%C3%B3digo_Unificado_de_Punto_de_Suministro | |
* @returns Resultado de la verificación. `true` si el CUPS dado es correcto, o `false` en caso contrario. | |
*/ | |
function validarCUPS(CUPS) { | |
let ret = false; | |
const reCUPS = /^[A-Z]{2}(\d{4}\d{12})([A-Z]{2})(\d[FPCRXYZ])?$/i; | |
if (reCUPS.test(CUPS)) { | |
const mCUPS = CUPS.toUpperCase().match(reCUPS); |