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

342
Vistas
What is the equivalent "Yup.transform" of Joi?

I'm using Yup package for data validation schemas but I would like to start to use Joi now. Or atleast, learn it.

This screenshot is what I have now for my app : My Yup version

And I would like to do exactly the same thing but with Joi and I can't find the equivalent of Yup's "transform()" method.

My need is simple: I have a property, I want to accept null values BUT if I get a null value, then I transform it to false (as you see in the screenshot above).

Thanks in advance !

UPDATE:


Yup.boolean().nullable().transform((value) => (value === null ? false : value));

UPDATE 2::

I tried this, it doesn't work :

Joi.boolean().allow(null).custom((value, helper) => {
                if (value === null) {
                    return false;
                }

                return value;
            });

The result of my unit test of the code above :

Expected: false
Received: null
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