
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
smooth-validator
Advanced tools
npm install smooth-validator
Smooth-Validator provides you various types of validation for object.
Pass rules to be applied on data to the parser and parser will return validator which will validate data for you.
const parser = require("smooth-validator");
//Sample signup validation
var rules = {
email : 'required|email|min:5|max:100',
password: 'required|min:6|max:30',
confirm_password: 'required|same:password'
}
var validator = parser(rules) //parser returns validator, which can be used on data object
var data = {
email: 'gisueinc@gmail.com',
password: 'strong',
confirm_password: 'strong'
}
console.log(validator(data))
//OUTPUT: { message: 'validation passed', errors: [] }
Smooth-Validator also supports custom message in error.
const parser = require("smooth-validator");
rules = {
'*emailTo': ["email"],
created_at: 'after:tomorrow'
}
var validate = parser(rules, {
message: {
'emailTo[].email': ':variable failed :type for :value at index :zero',
'created_at.after' : ':variable is not after :first_value'
}
})
data = {
emailTo: ["gmail.com"],
created_at: new Date()
}
var res = validate(data);
console.log(res.message)
/* Output:
{
message: 'emailTo failed email for gmail.com at index 0',
errors: [
{
key: 'emailTo[]',
message: 'emailTo failed email for gmail.com at index 0'
},
{ key: 'created_at', message: 'created_at is not after tomorrow' }
]
} */
Please go through documentation from more details and examples
We would love to get help from you on Github.
Core Team
FAQs
Validator for javascript
We found that smooth-validator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.