🧑‍🎓 Multiple conditions

If you need to check value for multiple conditions at once, you can use the all() function that allows you to combine multiple Predicates into single one:

const { asVerificable, all, isInteger, isNumberInRange, ensure } = require("verifica");

function sayAge(age) {
    const vage = asVerificable(age);
    
    const isValidAge = all(
        isInteger,
        isNumberInRange({ min: 0, max: 120 }),
    );
    
    ensure(vage, isValidAge);
    console.log(`You are ${age} years old!`);
}

Last updated