0.1.13-development • Published 5 years ago
datatypes-validation v0.1.13-development
datatypes-validation
This package was created with the purpose to facilitate the validation the backend level with NODEJS.
See the complete documentation.
Install
install with yarn
yarn add datatypes-validation
install with npm
npm add datatypes-validation
Importing
import {DataTypes} from 'datatypes-validation'; // ES6
const {DataTypes} = require('datatypes-validation'); // ES5
Simple example usage
const schema = {
name: DataTypes.string.isRequired({
shortMessage: (field) => `The field "${field.label}" is required`,
longMessage: 'The field "Name" is required'
}),
age: DataTypes.required,
locale: DataTypes.objectOf({
country: DataTypes.required
}).required
}
try {
const response = DataTypes.validate(schema, body);
}
catch (e) {
const {errors} = e;
}
0.1.13-development
5 years ago
0.1.12-development
5 years ago
0.1.11-development
5 years ago
0.1.9-development
5 years ago
0.1.8-development
5 years ago
0.1.7-development
5 years ago
0.1.6-development
5 years ago
0.1.5-development
5 years ago
0.1.4-development
5 years ago
0.1.3-development
5 years ago
0.1.3
5 years ago
0.1.2
5 years ago
0.1.1
5 years ago
0.1.0
5 years ago