📦Installation

You can install verifica into your project as a npm package. It is as simple as:

npm install verifica

And voilà! Verifica is installed and ready to be used. Now to use it you need to import functionality, e.g.:

const { asVerificable, ensure, isString } = require("verifica");

And use it:

function sayHello(name) {
    const vname = asVerificable(name);
    ensure(vname, isString);
    
    console.log(`Hello ${name}!`);
}

Here we ensured that provided name argument is a string. To see what other checks (called Predicates in verifica) are available out of the box, please see the Predicates section of the documentation. Good news are, you can also easily create your own Predicates to satisfy your business logic checks!

Last updated