
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@krishnapawar/validator-helper
Advanced tools
The `validator-helper` is a lightweight JavaScript library designed to simplify data interaction and validation. It streamlines the validation processes and provides essential helper functions to enhance efficiency in your projects.This package provides a
The
validator-helper
is a lightweight JavaScript library designed to simplify data interaction and validation. It streamlines the validation processes and provides essential helper functions to enhance efficiency in your projects.
npm i validator-helper
npm i @krishnapawar/validator-helper
This package provides a lightweight JavaScript library for validating your JavaScript projects. It can be utilized in Node.js projects, as well as Vue.js and React.js projects, by installing it and incorporating a simple middleware.
validator-helper
All methods.const {
validater,
isObject,
isNotObject,
isNotEmpty,
isEmpty
} = require("validator-helper");
Simple validation example
const valid = validater(req,{
name:"required",
date:"required",
email:"required",
mobile:"required"
});
if(valid){
return res.json(valid);
}
//output you get
{
"status_code": "400",
"status": false,
"message": "mobile is required!"
}
we can manuplate status_code
, status
and message
as well
For Example
const valid = validater(req,{
name:"required",
date:"required",
email:"required",
mobile:"required"
},{
statusCode:404,
status: "error",
message:{
name:'User name is required',
date:'Invalid O black date field',
}
});
//output you get
{
"status_code": "404",
"status": "error",
"message": "User name is required"
}
we can gat all error in single array by using errors:true
For Example
const valid = validater(req,{
name:"required",
date:"required",
email:"required",
mobile:"required"
},{
errors:true,
message:{
name:'User name is required',
date:'Invalid date field',
}
});
//output you get like this
[
"User name is required",
"Invalid date field",
"email is required!",
"mobile is required!"
]
we can set Minimum and Maximum length by using min:1
and min:10
For Example
const valid = validater(req,{
name:"required",
date:"required",
email:"required",
mobile:{
require:true,
min:10,
max:12
}
},{
errors:true,
message:{
name:'User name is required',
date:'Invalid date field',
}
});
//output you get like this
[
"User name is required",
"Invalid date field",
"email is required!",
"mobile is required!"
]
//OR
[
...
"Minimum Length 10."
]
//OR
[
...
"Maximum Length 12."
]
we can also manipulate thes message accourding to us like this
For Example
const valid = validater(req,{
name:"required",
date:"required",
email:"required",
mobile:{
require:true,
min:10,
max:12
}
},{
errors:true,
message:{
name:'User name is required',
date:'Invalid date field',
mobile:{
require:"Mobile NO is required",
min:"Mobile No Minimum length 10 digit",
max:"Mobile No Maximum length 12 digit"
}
}
});
//output you get like this
[
"User name is required",
"Invalid date field",
"email is required!",
"Mobile NO is required"
]
//OR
[
...
"obile No Minimum length 10 digit"
]
//OR
[
...
"Mobile No Maximum length 12 digit"
]
Email validate
For Example
const valid = validater(req,{
description:{
required:true,
email:true
}
});
Mobile No or Phone validation
For Example
const valid = validater(req,{
mobile:{
phone:true,
},
});
Data type validation
For Example
const valid = validater(req,{
mobile:{
phone:true,
type:"number"
},
});
//OR
const valid = validater(req,{
mobile:{
phone:true,
type:"string"
},
});
//like we can use
Date validation
For Example
const valid = validater(req,{
dob:{
required:true
date:true
}
});
Custome validate by regex
For Example
const valid = validater(req,{
description:{
required:true,
regex:/^.{25}$/
}
});
isObject
: Check if a variable is an object.isNotObject
: Verify if a variable is not an object.isNotEmpty
: Confirm that a variable is not empty.isEmpty
: Check if a variable is empty.This software is released under the MIT License. MIT
FAQs
The `validator-helper` is a lightweight JavaScript library designed to simplify data interaction and validation. It streamlines the validation processes and provides essential helper functions to enhance efficiency in your projects.This package provides a
The npm package @krishnapawar/validator-helper receives a total of 1 weekly downloads. As such, @krishnapawar/validator-helper popularity was classified as not popular.
We found that @krishnapawar/validator-helper 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.