Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

146
Vistas
Can I use the data given to Joi.validate() function instead of the result.value that it returns

The documented way:

 const data = {...someDataHere}


 const { error, value } = joi.validate(data, schema);

 if (error) return console.log(error);

    
...do stuff using `value` here

Using try/catch:

const data = {...someDataHere}

try {
  const { error, value } = joi.validate(data, schema);

  if (error) throw new Error(error)
} catch (error) {
  console.log(error);
}

...do stuff using `data` here since we can not access `value`

Question:

In regards to Joi validation library

Since I can't access value here because it's in a try/catch block, can I use data instead? Is it the exact same data all the time? And is safe/okay?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda