ds-nodejs-validation
v1.0.10
Published
The `ds-nodejs-validation` package provides simple validation capabilities for Node.js applications. It can be easily installed using npm:
Downloads
22
Maintainers
Readme
ds-nodejs-validation
Overview
The ds-nodejs-validation
package provides simple validation capabilities for Node.js applications. It can be easily installed using npm:
npm install ds-nodejs-validation
Usage
const { validations } = require("ds-nodejs-validation");
const data = {
name: "foo",
email: "foo"
};
const rules = {
name: "required",
email: "required|email"
};
const message = {
"name.required": "Please enter a valid name",
"email.required": "Please enter a valid email",
"email.email": "Please use a valid email address"
};
validations.setData(data, rules, message).validate();
const errors = validations.getErrors();
const checkErrors = validations.hasErrors();
Available Rules
required
email
date
min_string
max_string
between_string
number
min_number
max_number
between_number
boolean
same
url
Available methods
isNotEmpty
isValidEmail
isValidDate
isMinLengthString
isMaxLengthString
isStringBetweenLength
isNumeric
isMinNumber
isMaxNumber
isNumberBetween,
isBoolean
isSame
isValidUrl
We are actively working on expanding the list of supported rules and methods to make this package more versatile and user-friendly.
Contribution
We welcome contributions to enhance and add more features to this validation package. If you have any ideas or suggestions, feel free to open an issue or submit a pull request.
Thanks and Regards
Thank you for using ds-nodejs-validation. If you have any questions or feedback, please don't hesitate to reach out. Your input is valuable as we strive to improve and expand the functionality of this package.
Best regards,
The ds-nodejs-validation
Team