Skip to content

You can also validate an array of items

Compare
Choose a tag to compare
@w3nl w3nl released this 19 Feb 20:47
· 297 commits to master since this release
2dd1ee8

Example usage:

const persons = [
    {
        name: "James",
        age: 25,
        siblings: ["Johnnathan"],
        metaData: {},
        active: true,
        address: {
            street: "Streetname",
            number: 1,
            postalCode: "1234AB",
            city: "City",
            country: "Somewehere"
        },
        companies: [
            { name: "Example company 1", website: "https://hckr.news" }
            { name: "Example company 2" }
        ]
    }
];

validator.validateAll(persons);