Validate the object values by a schema. I hope you like it.
Pieter Wigboldus
If you would test the validator, you can just run:
npm install
npm run test
Example schema:
const barSchema = {
name: "string",
address: "string",
drinks: "object"
};Example input:
const barObj = {
name: 'Jimmys drinks',
address: 'Somewhere over the rainbow',
drinks: {
beer: ['Straffe Hendrik', 'Rochefort', 'St Bernard'],
},
};Example usage:
const validator = new Validator(barSchema);
validator.validate(barObj);