pasar de status 2 a status 3 listo

This commit is contained in:
2020-11-22 21:05:50 -06:00
parent 788ac0aab9
commit 2ae79c3962
4 changed files with 79 additions and 5 deletions
+6 -4
View File
@@ -13,9 +13,10 @@ const yaExiste = (campo) => {
throw new Error(`${campo} ya se encuentra en uso.`);
};
const validar = (texto, campo) => {
const validar = (texto, campo, length) => {
noHay(texto, campo);
if (typeof texto !== 'string') noValido(campo);
if (typeof texto !== 'string' || (length && texto.length > length))
noValido(campo);
return texto;
};
@@ -69,13 +70,14 @@ const validarFecha = (fecha) => {
return fechaMoment;
};
const validarNumero = (numero) => {
const validarNumero = (numero, length) => {
let campo = 'El numero';
noHay(numero, campo);
if (
typeof numero !== 'string' ||
!validator.isNumeric(numero, { no_symbols: true })
!validator.isNumeric(numero, { no_symbols: true }) ||
(length && numero.length > length)
)
noValido(campo);
return numero;