yyaroslavpysarvalidator
v1.0.1
Published
byyaroslavpysarpro
Readme
const Validator = require('your-package-name');
const schema = { name: { type: 'string', required: true }, age: { type: 'number', required: true }, email: { type: 'string', validate: (val) => /\S+@\S+.\S+/.test(val) || 'Invalid email format' }, };
const validator = new Validator(schema);
const result = validator.validate({ name: 'Alice', age: 25, email: '[email protected]' });
console.log(result); // { valid: true, errors: {} }
